repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
apple/turicreate | src/unity/python/turicreate/toolkits/_supervised_learning.py | create_classification_with_model_selector | def create_classification_with_model_selector(dataset, target, model_selector,
features=None, validation_set='auto', verbose=True):
"""
Create a :class:`~turicreate.toolkits.SupervisedLearningModel`,
This is generic function that allows you to create any model that
implements SupervisedLearningMode... | python | def create_classification_with_model_selector(dataset, target, model_selector,
features=None, validation_set='auto', verbose=True):
"""
Create a :class:`~turicreate.toolkits.SupervisedLearningModel`,
This is generic function that allows you to create any model that
implements SupervisedLearningMode... | [
"def",
"create_classification_with_model_selector",
"(",
"dataset",
",",
"target",
",",
"model_selector",
",",
"features",
"=",
"None",
",",
"validation_set",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
")",
":",
"# Perform error-checking and trim inputs to specified colu... | Create a :class:`~turicreate.toolkits.SupervisedLearningModel`,
This is generic function that allows you to create any model that
implements SupervisedLearningModel. This function is normally not called, call
specific model's create function instead.
Parameters
----------
dataset : SFrame
... | [
"Create",
"a",
":",
"class",
":",
"~turicreate",
".",
"toolkits",
".",
"SupervisedLearningModel"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L337-L460 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_supervised_learning.py | SupervisedLearningModel.predict | def predict(self, dataset, missing_value_action='auto',
output_type='', options={}, **kwargs):
"""
Return predictions for ``dataset``, using the trained supervised_learning
model. Predictions are generated as class labels (0 or
1).
Parameters
----------
... | python | def predict(self, dataset, missing_value_action='auto',
output_type='', options={}, **kwargs):
"""
Return predictions for ``dataset``, using the trained supervised_learning
model. Predictions are generated as class labels (0 or
1).
Parameters
----------
... | [
"def",
"predict",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
",",
"output_type",
"=",
"''",
",",
"options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"missing_value_action",
"==",
"'auto'",
":",
"missing_value_ac... | Return predictions for ``dataset``, using the trained supervised_learning
model. Predictions are generated as class labels (0 or
1).
Parameters
----------
dataset : SFrame
Dataset of new observations. Must include columns with the same
names as the featur... | [
"Return",
"predictions",
"for",
"dataset",
"using",
"the",
"trained",
"supervised_learning",
"model",
".",
"Predictions",
"are",
"generated",
"as",
"class",
"labels",
"(",
"0",
"or",
"1",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L59-L116 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_supervised_learning.py | SupervisedLearningModel.evaluate | def evaluate(self, dataset, metric="auto",
missing_value_action='auto', with_predictions=False, options={}, **kwargs):
"""
Evaluate the model by making predictions of target values and comparing
these to actual values.
Parameters
----------
dataset : SFr... | python | def evaluate(self, dataset, metric="auto",
missing_value_action='auto', with_predictions=False, options={}, **kwargs):
"""
Evaluate the model by making predictions of target values and comparing
these to actual values.
Parameters
----------
dataset : SFr... | [
"def",
"evaluate",
"(",
"self",
",",
"dataset",
",",
"metric",
"=",
"\"auto\"",
",",
"missing_value_action",
"=",
"'auto'",
",",
"with_predictions",
"=",
"False",
",",
"options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"missing_value_action... | Evaluate the model by making predictions of target values and comparing
these to actual values.
Parameters
----------
dataset : SFrame
Dataset in the same format used for training. The columns names and
types of the dataset must be the same as that used in traini... | [
"Evaluate",
"the",
"model",
"by",
"making",
"predictions",
"of",
"target",
"values",
"and",
"comparing",
"these",
"to",
"actual",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L118-L159 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_supervised_learning.py | Classifier.classify | def classify(self, dataset, missing_value_action='auto'):
"""
Return predictions for ``dataset``, using the trained supervised_learning
model. Predictions are generated as class labels (0 or
1).
Parameters
----------
dataset: SFrame
Dataset of new obs... | python | def classify(self, dataset, missing_value_action='auto'):
"""
Return predictions for ``dataset``, using the trained supervised_learning
model. Predictions are generated as class labels (0 or
1).
Parameters
----------
dataset: SFrame
Dataset of new obs... | [
"def",
"classify",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"if",
"(",
"missing_value_action",
"==",
"'auto'",
")",
":",
"missing_value_action",
"=",
"select_default_missing_value_policy",
"(",
"self",
",",
"'classify'",
"... | Return predictions for ``dataset``, using the trained supervised_learning
model. Predictions are generated as class labels (0 or
1).
Parameters
----------
dataset: SFrame
Dataset of new observations. Must include columns with the same
names as the feature... | [
"Return",
"predictions",
"for",
"dataset",
"using",
"the",
"trained",
"supervised_learning",
"model",
".",
"Predictions",
"are",
"generated",
"as",
"class",
"labels",
"(",
"0",
"or",
"1",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_supervised_learning.py#L206-L245 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py | BoostedTreesRegression.evaluate | def evaluate(self, dataset, metric='auto', missing_value_action='auto'):
"""
Evaluate the model on the given dataset.
Parameters
----------
dataset : SFrame
Dataset in the same format used for training. The columns names and
types of the dataset must be t... | python | def evaluate(self, dataset, metric='auto', missing_value_action='auto'):
"""
Evaluate the model on the given dataset.
Parameters
----------
dataset : SFrame
Dataset in the same format used for training. The columns names and
types of the dataset must be t... | [
"def",
"evaluate",
"(",
"self",
",",
"dataset",
",",
"metric",
"=",
"'auto'",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"_raise_error_evaluation_metric_is_valid",
"(",
"metric",
",",
"[",
"'auto'",
",",
"'rmse'",
",",
"'max_error'",
"]",
")",
"retu... | Evaluate the model on the given dataset.
Parameters
----------
dataset : SFrame
Dataset in the same format used for training. The columns names and
types of the dataset must be the same as that used in training.
metric : str, optional
Name of the eva... | [
"Evaluate",
"the",
"model",
"on",
"the",
"given",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py#L152-L201 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py | BoostedTreesRegression.predict | def predict(self, dataset, missing_value_action='auto'):
"""
Predict the target column of the given dataset.
The target column is provided during
:func:`~turicreate.boosted_trees_regression.create`. If the target column is in the
`dataset` it will be ignored.
Parameters... | python | def predict(self, dataset, missing_value_action='auto'):
"""
Predict the target column of the given dataset.
The target column is provided during
:func:`~turicreate.boosted_trees_regression.create`. If the target column is in the
`dataset` it will be ignored.
Parameters... | [
"def",
"predict",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"return",
"super",
"(",
"BoostedTreesRegression",
",",
"self",
")",
".",
"predict",
"(",
"dataset",
",",
"output_type",
"=",
"'margin'",
",",
"missing_value_ac... | Predict the target column of the given dataset.
The target column is provided during
:func:`~turicreate.boosted_trees_regression.create`. If the target column is in the
`dataset` it will be ignored.
Parameters
----------
dataset : SFrame
A dataset that has the... | [
"Predict",
"the",
"target",
"column",
"of",
"the",
"given",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/boosted_trees_regression.py#L230-L271 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/disassemble.py | print_code | def print_code(co, lasti= -1, level=0):
"""Disassemble a code object."""
code = co.co_code
for constant in co.co_consts:
print( '| |' * level, end=' ')
print( 'constant:', constant)
labels = findlabels(code)
linestarts = dict(findlinestarts(co))
n = len... | python | def print_code(co, lasti= -1, level=0):
"""Disassemble a code object."""
code = co.co_code
for constant in co.co_consts:
print( '| |' * level, end=' ')
print( 'constant:', constant)
labels = findlabels(code)
linestarts = dict(findlinestarts(co))
n = len... | [
"def",
"print_code",
"(",
"co",
",",
"lasti",
"=",
"-",
"1",
",",
"level",
"=",
"0",
")",
":",
"code",
"=",
"co",
".",
"co_code",
"for",
"constant",
"in",
"co",
".",
"co_consts",
":",
"print",
"(",
"'| |'",
"*",
"level",
",",
"end",
"=... | Disassemble a code object. | [
"Disassemble",
"a",
"code",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/disassemble.py#L29-L92 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_regressor.py | convert | def convert(model, feature_names, target):
"""Convert a decision tree model to protobuf format.
Parameters
----------
decision_tree : DecisionTreeRegressor
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output... | python | def convert(model, feature_names, target):
"""Convert a decision tree model to protobuf format.
Parameters
----------
decision_tree : DecisionTreeRegressor
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output... | [
"def",
"convert",
"(",
"model",
",",
"feature_names",
",",
"target",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"_sklearn_util",
".",
"check_expected_type... | Convert a decision tree model to protobuf format.
Parameters
----------
decision_tree : DecisionTreeRegressor
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output column.
Returns
-------
model_spec: ... | [
"Convert",
"a",
"decision",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_regressor.py#L18-L42 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | _check_prob_and_prob_vector | def _check_prob_and_prob_vector(predictions):
"""
Check that the predictionsa are either probabilities of prob-vectors.
"""
from .._deps import numpy
ptype = predictions.dtype
import array
if ptype not in [float, numpy.ndarray, array.array, int]:
err_msg = "Input `predictions` must... | python | def _check_prob_and_prob_vector(predictions):
"""
Check that the predictionsa are either probabilities of prob-vectors.
"""
from .._deps import numpy
ptype = predictions.dtype
import array
if ptype not in [float, numpy.ndarray, array.array, int]:
err_msg = "Input `predictions` must... | [
"def",
"_check_prob_and_prob_vector",
"(",
"predictions",
")",
":",
"from",
".",
".",
"_deps",
"import",
"numpy",
"ptype",
"=",
"predictions",
".",
"dtype",
"import",
"array",
"if",
"ptype",
"not",
"in",
"[",
"float",
",",
"numpy",
".",
"ndarray",
",",
"ar... | Check that the predictionsa are either probabilities of prob-vectors. | [
"Check",
"that",
"the",
"predictionsa",
"are",
"either",
"probabilities",
"of",
"prob",
"-",
"vectors",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L36-L48 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | _supervised_evaluation_error_checking | def _supervised_evaluation_error_checking(targets, predictions):
"""
Perform basic error checking for the evaluation metrics. Check
types and sizes of the inputs.
"""
_raise_error_if_not_sarray(targets, "targets")
_raise_error_if_not_sarray(predictions, "predictions")
if (len(targets) != len... | python | def _supervised_evaluation_error_checking(targets, predictions):
"""
Perform basic error checking for the evaluation metrics. Check
types and sizes of the inputs.
"""
_raise_error_if_not_sarray(targets, "targets")
_raise_error_if_not_sarray(predictions, "predictions")
if (len(targets) != len... | [
"def",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
":",
"_raise_error_if_not_sarray",
"(",
"targets",
",",
"\"targets\"",
")",
"_raise_error_if_not_sarray",
"(",
"predictions",
",",
"\"predictions\"",
")",
"if",
"(",
"len",
"(",
"... | Perform basic error checking for the evaluation metrics. Check
types and sizes of the inputs. | [
"Perform",
"basic",
"error",
"checking",
"for",
"the",
"evaluation",
"metrics",
".",
"Check",
"types",
"and",
"sizes",
"of",
"the",
"inputs",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L50-L59 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | log_loss | def log_loss(targets, predictions, index_map=None):
r"""
Compute the logloss for the given targets and the given predicted
probabilities. This quantity is defined to be the negative of the sum
of the log probability of each observation, normalized by the number of
observations:
.. math::
... | python | def log_loss(targets, predictions, index_map=None):
r"""
Compute the logloss for the given targets and the given predicted
probabilities. This quantity is defined to be the negative of the sum
of the log probability of each observation, normalized by the number of
observations:
.. math::
... | [
"def",
"log_loss",
"(",
"targets",
",",
"predictions",
",",
"index_map",
"=",
"None",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"_check_prob_and_prob_vector",
"(",
"predictions",
")",
"_check_target_not_float",
"(",
"t... | r"""
Compute the logloss for the given targets and the given predicted
probabilities. This quantity is defined to be the negative of the sum
of the log probability of each observation, normalized by the number of
observations:
.. math::
\textrm{logloss} = - \frac{1}{N} \sum_{i \in 1,\ldots... | [
"r",
"Compute",
"the",
"logloss",
"for",
"the",
"given",
"targets",
"and",
"the",
"given",
"predicted",
"probabilities",
".",
"This",
"quantity",
"is",
"defined",
"to",
"be",
"the",
"negative",
"of",
"the",
"sum",
"of",
"the",
"log",
"probability",
"of",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L87-L245 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | max_error | def max_error(targets, predictions):
r"""
Compute the maximum absolute deviation between two SArrays.
Parameters
----------
targets : SArray[float or int]
An Sarray of ground truth target values.
predictions : SArray[float or int]
The prediction that corresponds to each target ... | python | def max_error(targets, predictions):
r"""
Compute the maximum absolute deviation between two SArrays.
Parameters
----------
targets : SArray[float or int]
An Sarray of ground truth target values.
predictions : SArray[float or int]
The prediction that corresponds to each target ... | [
"def",
"max_error",
"(",
"targets",
",",
"predictions",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"return",
"_turicreate",
".",
"extensions",
".",
"_supervised_streaming_evaluator",
"(",
"targets",
",",
"predictions",
... | r"""
Compute the maximum absolute deviation between two SArrays.
Parameters
----------
targets : SArray[float or int]
An Sarray of ground truth target values.
predictions : SArray[float or int]
The prediction that corresponds to each target value.
This vector must have the ... | [
"r",
"Compute",
"the",
"maximum",
"absolute",
"deviation",
"between",
"two",
"SArrays",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L248-L288 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | rmse | def rmse(targets, predictions):
r"""
Compute the root mean squared error between two SArrays.
Parameters
----------
targets : SArray[float or int]
An Sarray of ground truth target values.
predictions : SArray[float or int]
The prediction that corresponds to each target value.
... | python | def rmse(targets, predictions):
r"""
Compute the root mean squared error between two SArrays.
Parameters
----------
targets : SArray[float or int]
An Sarray of ground truth target values.
predictions : SArray[float or int]
The prediction that corresponds to each target value.
... | [
"def",
"rmse",
"(",
"targets",
",",
"predictions",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"return",
"_turicreate",
".",
"extensions",
".",
"_supervised_streaming_evaluator",
"(",
"targets",
",",
"predictions",
",",
... | r"""
Compute the root mean squared error between two SArrays.
Parameters
----------
targets : SArray[float or int]
An Sarray of ground truth target values.
predictions : SArray[float or int]
The prediction that corresponds to each target value.
This vector must have the sam... | [
"r",
"Compute",
"the",
"root",
"mean",
"squared",
"error",
"between",
"two",
"SArrays",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L290-L336 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | confusion_matrix | def confusion_matrix(targets, predictions):
r"""
Compute the confusion matrix for classifier predictions.
Parameters
----------
targets : SArray
Ground truth class labels (cannot be of type float).
predictions : SArray
The prediction that corresponds to each target value.
... | python | def confusion_matrix(targets, predictions):
r"""
Compute the confusion matrix for classifier predictions.
Parameters
----------
targets : SArray
Ground truth class labels (cannot be of type float).
predictions : SArray
The prediction that corresponds to each target value.
... | [
"def",
"confusion_matrix",
"(",
"targets",
",",
"predictions",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"_check_same_type_not_float",
"(",
"targets",
",",
"predictions",
")",
"return",
"_turicreate",
".",
"extensions",
... | r"""
Compute the confusion matrix for classifier predictions.
Parameters
----------
targets : SArray
Ground truth class labels (cannot be of type float).
predictions : SArray
The prediction that corresponds to each target value.
This vector must have the same length as ``ta... | [
"r",
"Compute",
"the",
"confusion",
"matrix",
"for",
"classifier",
"predictions",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L337-L372 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | accuracy | def accuracy(targets, predictions, average='micro'):
r"""
Compute the accuracy score; which measures the fraction of predictions made
by the classifier that are exactly correct. The score lies in the range [0,1]
with 0 being the worst and 1 being the best.
Parameters
----------
targets : SA... | python | def accuracy(targets, predictions, average='micro'):
r"""
Compute the accuracy score; which measures the fraction of predictions made
by the classifier that are exactly correct. The score lies in the range [0,1]
with 0 being the worst and 1 being the best.
Parameters
----------
targets : SA... | [
"def",
"accuracy",
"(",
"targets",
",",
"predictions",
",",
"average",
"=",
"'micro'",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"_check_same_type_not_float",
"(",
"targets",
",",
"predictions",
")",
"opts",
"=",
"... | r"""
Compute the accuracy score; which measures the fraction of predictions made
by the classifier that are exactly correct. The score lies in the range [0,1]
with 0 being the worst and 1 being the best.
Parameters
----------
targets : SArray
An SArray of ground truth class labels. Can ... | [
"r",
"Compute",
"the",
"accuracy",
"score",
";",
"which",
"measures",
"the",
"fraction",
"of",
"predictions",
"made",
"by",
"the",
"classifier",
"that",
"are",
"exactly",
"correct",
".",
"The",
"score",
"lies",
"in",
"the",
"range",
"[",
"0",
"1",
"]",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L374-L471 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | fbeta_score | def fbeta_score(targets, predictions, beta=1.0, average='macro'):
r"""
Compute the F-beta score. The F-beta score is the weighted harmonic mean of
precision and recall. The score lies in the range [0,1] with 1 being ideal
and 0 being the worst.
The `beta` value is the weight given to `precision` vs... | python | def fbeta_score(targets, predictions, beta=1.0, average='macro'):
r"""
Compute the F-beta score. The F-beta score is the weighted harmonic mean of
precision and recall. The score lies in the range [0,1] with 1 being ideal
and 0 being the worst.
The `beta` value is the weight given to `precision` vs... | [
"def",
"fbeta_score",
"(",
"targets",
",",
"predictions",
",",
"beta",
"=",
"1.0",
",",
"average",
"=",
"'macro'",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"_check_categorical_option_type",
"(",
"'average'",
",",
... | r"""
Compute the F-beta score. The F-beta score is the weighted harmonic mean of
precision and recall. The score lies in the range [0,1] with 1 being ideal
and 0 being the worst.
The `beta` value is the weight given to `precision` vs `recall` in the
combined score. `beta=0` considers only precision... | [
"r",
"Compute",
"the",
"F",
"-",
"beta",
"score",
".",
"The",
"F",
"-",
"beta",
"score",
"is",
"the",
"weighted",
"harmonic",
"mean",
"of",
"precision",
"and",
"recall",
".",
"The",
"score",
"lies",
"in",
"the",
"range",
"[",
"0",
"1",
"]",
"with",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L474-L605 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | f1_score | def f1_score(targets, predictions, average='macro'):
r"""
Compute the F1 score (sometimes known as the balanced F-score or
F-measure). The F1 score is commonly interpreted as the average of
precision and recall. The score lies in the range [0,1] with 1 being ideal
and 0 being the worst.
The F1 ... | python | def f1_score(targets, predictions, average='macro'):
r"""
Compute the F1 score (sometimes known as the balanced F-score or
F-measure). The F1 score is commonly interpreted as the average of
precision and recall. The score lies in the range [0,1] with 1 being ideal
and 0 being the worst.
The F1 ... | [
"def",
"f1_score",
"(",
"targets",
",",
"predictions",
",",
"average",
"=",
"'macro'",
")",
":",
"return",
"fbeta_score",
"(",
"targets",
",",
"predictions",
",",
"beta",
"=",
"1.0",
",",
"average",
"=",
"average",
")"
] | r"""
Compute the F1 score (sometimes known as the balanced F-score or
F-measure). The F1 score is commonly interpreted as the average of
precision and recall. The score lies in the range [0,1] with 1 being ideal
and 0 being the worst.
The F1 score is defined as:
.. math::
f_{1}... | [
"r",
"Compute",
"the",
"F1",
"score",
"(",
"sometimes",
"known",
"as",
"the",
"balanced",
"F",
"-",
"score",
"or",
"F",
"-",
"measure",
")",
".",
"The",
"F1",
"score",
"is",
"commonly",
"interpreted",
"as",
"the",
"average",
"of",
"precision",
"and",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L607-L723 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | precision | def precision(targets, predictions, average='macro'):
r"""
Compute the precision score for classification tasks. The precision score
quantifies the ability of a classifier to not label a `negative` example as
`positive`. The precision score can be interpreted as the probability that
a `positive` pr... | python | def precision(targets, predictions, average='macro'):
r"""
Compute the precision score for classification tasks. The precision score
quantifies the ability of a classifier to not label a `negative` example as
`positive`. The precision score can be interpreted as the probability that
a `positive` pr... | [
"def",
"precision",
"(",
"targets",
",",
"predictions",
",",
"average",
"=",
"'macro'",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"_check_categorical_option_type",
"(",
"'average'",
",",
"average",
",",
"[",
"'micro'... | r"""
Compute the precision score for classification tasks. The precision score
quantifies the ability of a classifier to not label a `negative` example as
`positive`. The precision score can be interpreted as the probability that
a `positive` prediction made by the classifier is `positive`. The score i... | [
"r"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L725-L839 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/evaluation.py | auc | def auc(targets, predictions, average='macro', index_map=None):
r"""
Compute the area under the ROC curve for the given targets and predictions.
Parameters
----------
targets : SArray
An SArray containing the observed values. For binary classification,
the alpha-numerically first ca... | python | def auc(targets, predictions, average='macro', index_map=None):
r"""
Compute the area under the ROC curve for the given targets and predictions.
Parameters
----------
targets : SArray
An SArray containing the observed values. For binary classification,
the alpha-numerically first ca... | [
"def",
"auc",
"(",
"targets",
",",
"predictions",
",",
"average",
"=",
"'macro'",
",",
"index_map",
"=",
"None",
")",
":",
"_supervised_evaluation_error_checking",
"(",
"targets",
",",
"predictions",
")",
"_check_categorical_option_type",
"(",
"'average'",
",",
"a... | r"""
Compute the area under the ROC curve for the given targets and predictions.
Parameters
----------
targets : SArray
An SArray containing the observed values. For binary classification,
the alpha-numerically first category is considered the reference
category.
prediction... | [
"r",
"Compute",
"the",
"area",
"under",
"the",
"ROC",
"curve",
"for",
"the",
"given",
"targets",
"and",
"predictions",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/evaluation.py#L1150-L1269 | train |
apple/turicreate | deps/src/boost_1_68_0/status/boost_check_library.py | check_library.get_library_meta | def get_library_meta(self):
'''
Fetches the meta data for the current library. The data could be in
the superlib meta data file. If we can't find the data None is returned.
'''
parent_dir = os.path.dirname(self.library_dir)
if self.test_file_exists(os.path.join(self.libra... | python | def get_library_meta(self):
'''
Fetches the meta data for the current library. The data could be in
the superlib meta data file. If we can't find the data None is returned.
'''
parent_dir = os.path.dirname(self.library_dir)
if self.test_file_exists(os.path.join(self.libra... | [
"def",
"get_library_meta",
"(",
"self",
")",
":",
"parent_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"library_dir",
")",
"if",
"self",
".",
"test_file_exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"library_dir",
"... | Fetches the meta data for the current library. The data could be in
the superlib meta data file. If we can't find the data None is returned. | [
"Fetches",
"the",
"meta",
"data",
"for",
"the",
"current",
"library",
".",
"The",
"data",
"could",
"be",
"in",
"the",
"superlib",
"meta",
"data",
"file",
".",
"If",
"we",
"can",
"t",
"find",
"the",
"data",
"None",
"is",
"returned",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/status/boost_check_library.py#L182-L205 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree.py | convert | def convert(model, feature_names = None, target = 'target', force_32bit_float = True):
"""
Convert a trained XGBoost model to Core ML format.
Parameters
----------
decision_tree : Booster
A trained XGboost tree model.
feature_names: [str] | str
Names of input features that will... | python | def convert(model, feature_names = None, target = 'target', force_32bit_float = True):
"""
Convert a trained XGBoost model to Core ML format.
Parameters
----------
decision_tree : Booster
A trained XGboost tree model.
feature_names: [str] | str
Names of input features that will... | [
"def",
"convert",
"(",
"model",
",",
"feature_names",
"=",
"None",
",",
"target",
"=",
"'target'",
",",
"force_32bit_float",
"=",
"True",
")",
":",
"return",
"_MLModel",
"(",
"_convert_tree_ensemble",
"(",
"model",
",",
"feature_names",
",",
"target",
",",
"... | Convert a trained XGBoost model to Core ML format.
Parameters
----------
decision_tree : Booster
A trained XGboost tree model.
feature_names: [str] | str
Names of input features that will be exposed in the Core ML model
interface.
Can be set to one of the following:
... | [
"Convert",
"a",
"trained",
"XGBoost",
"model",
"to",
"Core",
"ML",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree.py#L9-L51 | train |
apple/turicreate | src/unity/python/turicreate/_json.py | dumps | def dumps(obj):
"""
Dumps a serializable object to JSON. This API maps to the Python built-in
json dumps method, with a few differences:
* The return value is always valid JSON according to RFC 7159.
* The input can be any of the following types:
- SFrame
- SArray
- SGraph
... | python | def dumps(obj):
"""
Dumps a serializable object to JSON. This API maps to the Python built-in
json dumps method, with a few differences:
* The return value is always valid JSON according to RFC 7159.
* The input can be any of the following types:
- SFrame
- SArray
- SGraph
... | [
"def",
"dumps",
"(",
"obj",
")",
":",
"(",
"data",
",",
"schema",
")",
"=",
"to_serializable",
"(",
"obj",
")",
"return",
"_json",
".",
"dumps",
"(",
"{",
"'data'",
":",
"data",
",",
"'schema'",
":",
"schema",
"}",
")"
] | Dumps a serializable object to JSON. This API maps to the Python built-in
json dumps method, with a few differences:
* The return value is always valid JSON according to RFC 7159.
* The input can be any of the following types:
- SFrame
- SArray
- SGraph
- single flexible_typ... | [
"Dumps",
"a",
"serializable",
"object",
"to",
"JSON",
".",
"This",
"API",
"maps",
"to",
"the",
"Python",
"built",
"-",
"in",
"json",
"dumps",
"method",
"with",
"a",
"few",
"differences",
":"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_json.py#L20-L38 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/drawing_classifier/util/_visualization.py | draw_strokes | def draw_strokes(stroke_based_drawings):
"""
Visualizes drawings (ground truth or predictions) by
returning images to represent the stroke-based data from
the user.
Parameters
----------
stroke_based_drawings: SArray or list
An `SArray` of type `list`. Each element in the SArray
... | python | def draw_strokes(stroke_based_drawings):
"""
Visualizes drawings (ground truth or predictions) by
returning images to represent the stroke-based data from
the user.
Parameters
----------
stroke_based_drawings: SArray or list
An `SArray` of type `list`. Each element in the SArray
... | [
"def",
"draw_strokes",
"(",
"stroke_based_drawings",
")",
":",
"single_input",
"=",
"False",
"if",
"(",
"not",
"isinstance",
"(",
"stroke_based_drawings",
",",
"_tc",
".",
"SArray",
")",
"and",
"not",
"isinstance",
"(",
"stroke_based_drawings",
",",
"list",
")",... | Visualizes drawings (ground truth or predictions) by
returning images to represent the stroke-based data from
the user.
Parameters
----------
stroke_based_drawings: SArray or list
An `SArray` of type `list`. Each element in the SArray
should be a list of strokes, where each stroke... | [
"Visualizes",
"drawings",
"(",
"ground",
"truth",
"or",
"predictions",
")",
"by",
"returning",
"images",
"to",
"represent",
"the",
"stroke",
"-",
"based",
"data",
"from",
"the",
"user",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/drawing_classifier/util/_visualization.py#L10-L54 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py | Transformer.fit | def fit(self, data):
"""
Fit a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted version of the object)
See Also
--------
tra... | python | def fit(self, data):
"""
Fit a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted version of the object)
See Also
--------
tra... | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"_raise_error_if_not_sframe",
"(",
"data",
",",
"\"data\"",
")",
"self",
".",
"__proxy__",
".",
"fit",
"(",
"data",
")",
"return",
"self"
] | Fit a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted version of the object)
See Also
--------
transform, fit_transform
Examples
... | [
"Fit",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py#L236-L262 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py | _SampleTransformer._get_summary_struct | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where
relevant) the schema of the training data, description of the training
data, training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | python | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where
relevant) the schema of the training data, description of the training
data, training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"section",
"=",
"[",
"]",
"section_titles",
"=",
"[",
"'Attributes'",
"]",
"for",
"f",
"in",
"self",
".",
"_list_fields",
"(",
")",
":",
"section",
".",
"append",
"(",
"(",
"\"%s\"",
"%",
"f",
",",
... | Returns a structured description of the model, including (where
relevant) the schema of the training data, description of the training
data, training statistics, and model hyperparameters.
Returns
-------
sections : list (of list of tuples)
A list of summary sections... | [
"Returns",
"a",
"structured",
"description",
"of",
"the",
"model",
"including",
"(",
"where",
"relevant",
")",
"the",
"schema",
"of",
"the",
"training",
"data",
"description",
"of",
"the",
"training",
"data",
"training",
"statistics",
"and",
"model",
"hyperparam... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py#L392-L415 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | TreeModelMixin.extract_features | def extract_features(self, dataset, missing_value_action='auto'):
"""
For each example in the dataset, extract the leaf indices of
each tree as features.
For multiclass classification, each leaf index contains #num_class
numbers.
The returned feature vectors can be used... | python | def extract_features(self, dataset, missing_value_action='auto'):
"""
For each example in the dataset, extract the leaf indices of
each tree as features.
For multiclass classification, each leaf index contains #num_class
numbers.
The returned feature vectors can be used... | [
"def",
"extract_features",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"_raise_error_if_not_sframe",
"(",
"dataset",
",",
"\"dataset\"",
")",
"if",
"missing_value_action",
"==",
"'auto'",
":",
"missing_value_action",
"=",
"sele... | For each example in the dataset, extract the leaf indices of
each tree as features.
For multiclass classification, each leaf index contains #num_class
numbers.
The returned feature vectors can be used as input to train another
supervised learning model such as a
:py:cla... | [
"For",
"each",
"example",
"in",
"the",
"dataset",
"extract",
"the",
"leaf",
"indices",
"of",
"each",
"tree",
"as",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L65-L120 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | TreeModelMixin._extract_features_with_missing | def _extract_features_with_missing(self, dataset, tree_id = 0,
missing_value_action = 'auto'):
"""
Extract features along with all the missing features associated with
a dataset.
Parameters
----------
dataset: bool
Dataset on which to make predict... | python | def _extract_features_with_missing(self, dataset, tree_id = 0,
missing_value_action = 'auto'):
"""
Extract features along with all the missing features associated with
a dataset.
Parameters
----------
dataset: bool
Dataset on which to make predict... | [
"def",
"_extract_features_with_missing",
"(",
"self",
",",
"dataset",
",",
"tree_id",
"=",
"0",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"# Extract the features from only one tree.",
"sf",
"=",
"dataset",
"sf",
"[",
"'leaf_id'",
"]",
"=",
"self",
".",... | Extract features along with all the missing features associated with
a dataset.
Parameters
----------
dataset: bool
Dataset on which to make predictions.
missing_value_action: str, optional
Action to perform when missing values are encountered. This can ... | [
"Extract",
"features",
"along",
"with",
"all",
"the",
"missing",
"features",
"associated",
"with",
"a",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L122-L189 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | TreeModelMixin._dump_to_text | def _dump_to_text(self, with_stats):
"""
Dump the models into a list of strings. Each
string is a text representation of a tree.
Parameters
----------
with_stats : bool
If true, include node statistics in the output.
Returns
-------
o... | python | def _dump_to_text(self, with_stats):
"""
Dump the models into a list of strings. Each
string is a text representation of a tree.
Parameters
----------
with_stats : bool
If true, include node statistics in the output.
Returns
-------
o... | [
"def",
"_dump_to_text",
"(",
"self",
",",
"with_stats",
")",
":",
"return",
"tc",
".",
"extensions",
".",
"_xgboost_dump_model",
"(",
"self",
".",
"__proxy__",
",",
"with_stats",
"=",
"with_stats",
",",
"format",
"=",
"'text'",
")"
] | Dump the models into a list of strings. Each
string is a text representation of a tree.
Parameters
----------
with_stats : bool
If true, include node statistics in the output.
Returns
-------
out : SFrame
A table with two columns: feature... | [
"Dump",
"the",
"models",
"into",
"a",
"list",
"of",
"strings",
".",
"Each",
"string",
"is",
"a",
"text",
"representation",
"of",
"a",
"tree",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L192-L208 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | TreeModelMixin._dump_to_json | def _dump_to_json(self, with_stats):
"""
Dump the models into a list of strings. Each
string is a text representation of a tree.
Parameters
----------
with_stats : bool
If true, include node statistics in the output.
Returns
-------
o... | python | def _dump_to_json(self, with_stats):
"""
Dump the models into a list of strings. Each
string is a text representation of a tree.
Parameters
----------
with_stats : bool
If true, include node statistics in the output.
Returns
-------
o... | [
"def",
"_dump_to_json",
"(",
"self",
",",
"with_stats",
")",
":",
"import",
"json",
"trees_json_str",
"=",
"tc",
".",
"extensions",
".",
"_xgboost_dump_model",
"(",
"self",
".",
"__proxy__",
",",
"with_stats",
"=",
"with_stats",
",",
"format",
"=",
"'json'",
... | Dump the models into a list of strings. Each
string is a text representation of a tree.
Parameters
----------
with_stats : bool
If true, include node statistics in the output.
Returns
-------
out : SFrame
A table with two columns: feature... | [
"Dump",
"the",
"models",
"into",
"a",
"list",
"of",
"strings",
".",
"Each",
"string",
"is",
"a",
"text",
"representation",
"of",
"a",
"tree",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L210-L247 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | TreeModelMixin._get_summary_struct | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | python | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"data_fields",
"=",
"[",
"(",
"'Number of examples'",
",",
"'num_examples'",
")",
",",
"(",
"'Number of feature columns'",
",",
"'num_features'",
")",
",",
"(",
"'Number of unpacked features'",
",",
"'num_unpacked_f... | Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of list of tuples)
A list of summary sections... | [
"Returns",
"a",
"structured",
"description",
"of",
"the",
"model",
"including",
"(",
"where",
"relevant",
")",
"the",
"schema",
"of",
"the",
"training",
"data",
"description",
"of",
"the",
"training",
"data",
"training",
"statistics",
"and",
"model",
"hyperparam... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L279-L315 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_regressor.py | convert | def convert(model, input_features, output_features):
"""Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : GradientBoostingRegressor
A trained scikit-learn tree model.
input_feature: [str]
Name of the input columns.
output_features: str
... | python | def convert(model, input_features, output_features):
"""Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : GradientBoostingRegressor
A trained scikit-learn tree model.
input_feature: [str]
Name of the input columns.
output_features: str
... | [
"def",
"convert",
"(",
"model",
",",
"input_features",
",",
"output_features",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"_sklearn_util",
".",
"check_exp... | Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : GradientBoostingRegressor
A trained scikit-learn tree model.
input_feature: [str]
Name of the input columns.
output_features: str
Name of the output column.
Returns
-------
... | [
"Convert",
"a",
"boosted",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_regressor.py#L19-L58 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | _sort_topk_votes | def _sort_topk_votes(x, k):
"""
Sort a dictionary of classes and corresponding vote totals according to the
votes, then truncate to the highest 'k' classes.
"""
y = sorted(x.items(), key=lambda x: x[1], reverse=True)[:k]
return [{'class': i[0], 'votes': i[1]} for i in y] | python | def _sort_topk_votes(x, k):
"""
Sort a dictionary of classes and corresponding vote totals according to the
votes, then truncate to the highest 'k' classes.
"""
y = sorted(x.items(), key=lambda x: x[1], reverse=True)[:k]
return [{'class': i[0], 'votes': i[1]} for i in y] | [
"def",
"_sort_topk_votes",
"(",
"x",
",",
"k",
")",
":",
"y",
"=",
"sorted",
"(",
"x",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
",",
"reverse",
"=",
"True",
")",
"[",
":",
"k",
"]",
"return",
"[",
"{"... | Sort a dictionary of classes and corresponding vote totals according to the
votes, then truncate to the highest 'k' classes. | [
"Sort",
"a",
"dictionary",
"of",
"classes",
"and",
"corresponding",
"vote",
"totals",
"according",
"to",
"the",
"votes",
"then",
"truncate",
"to",
"the",
"highest",
"k",
"classes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L33-L39 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | _construct_auto_distance | def _construct_auto_distance(features, column_types):
"""
Construct a composite distance function for a set of features, based on the
types of those features.
NOTE: This function is very similar to
`:func:_nearest_neighbors.choose_auto_distance`. The function is separate
because the auto-distan... | python | def _construct_auto_distance(features, column_types):
"""
Construct a composite distance function for a set of features, based on the
types of those features.
NOTE: This function is very similar to
`:func:_nearest_neighbors.choose_auto_distance`. The function is separate
because the auto-distan... | [
"def",
"_construct_auto_distance",
"(",
"features",
",",
"column_types",
")",
":",
"## Put input features into buckets based on type.",
"numeric_ftrs",
"=",
"[",
"]",
"string_ftrs",
"=",
"[",
"]",
"dict_ftrs",
"=",
"[",
"]",
"for",
"ftr",
"in",
"features",
":",
"t... | Construct a composite distance function for a set of features, based on the
types of those features.
NOTE: This function is very similar to
`:func:_nearest_neighbors.choose_auto_distance`. The function is separate
because the auto-distance logic different than for each nearest
neighbors-based toolk... | [
"Construct",
"a",
"composite",
"distance",
"function",
"for",
"a",
"set",
"of",
"features",
"based",
"on",
"the",
"types",
"of",
"those",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L42-L108 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | create | def create(dataset, target, features=None, distance=None, verbose=True):
"""
Create a
:class:`~turicreate.nearest_neighbor_classifier.NearestNeighborClassifier`
model. This model predicts the class of a query instance by finding the most
common class among the query's nearest neighbors.
.. warn... | python | def create(dataset, target, features=None, distance=None, verbose=True):
"""
Create a
:class:`~turicreate.nearest_neighbor_classifier.NearestNeighborClassifier`
model. This model predicts the class of a query instance by finding the most
common class among the query's nearest neighbors.
.. warn... | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"features",
"=",
"None",
",",
"distance",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"## Set up",
"## ------",
"start_time",
"=",
"_time",
".",
"time",
"(",
")",
"## Validation and preprocessing",... | Create a
:class:`~turicreate.nearest_neighbor_classifier.NearestNeighborClassifier`
model. This model predicts the class of a query instance by finding the most
common class among the query's nearest neighbors.
.. warning::
The 'dot_product' distance is deprecated and will be removed in future... | [
"Create",
"a",
":",
"class",
":",
"~turicreate",
".",
"nearest_neighbor_classifier",
".",
"NearestNeighborClassifier",
"model",
".",
"This",
"model",
"predicts",
"the",
"class",
"of",
"a",
"query",
"instance",
"by",
"finding",
"the",
"most",
"common",
"class",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L115-L314 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | NearestNeighborClassifier._load_version | def _load_version(cls, state, version):
"""
A function to load a previously saved NearestNeighborClassifier model.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writ... | python | def _load_version(cls, state, version):
"""
A function to load a previously saved NearestNeighborClassifier model.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writ... | [
"def",
"_load_version",
"(",
"cls",
",",
"state",
",",
"version",
")",
":",
"assert",
"(",
"version",
"==",
"cls",
".",
"_PYTHON_NN_CLASSIFIER_MODEL_VERSION",
")",
"knn_model",
"=",
"_tc",
".",
"nearest_neighbors",
".",
"NearestNeighborsModel",
"(",
"state",
"["... | A function to load a previously saved NearestNeighborClassifier model.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer. | [
"A",
"function",
"to",
"load",
"a",
"previously",
"saved",
"NearestNeighborClassifier",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L353-L369 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | NearestNeighborClassifier.classify | def classify(self, dataset, max_neighbors=10, radius=None, verbose=True):
"""
Return the predicted class for each observation in *dataset*. This
prediction is made based on the closest neighbors stored in the nearest
neighbors classifier model.
Parameters
----------
... | python | def classify(self, dataset, max_neighbors=10, radius=None, verbose=True):
"""
Return the predicted class for each observation in *dataset*. This
prediction is made based on the closest neighbors stored in the nearest
neighbors classifier model.
Parameters
----------
... | [
"def",
"classify",
"(",
"self",
",",
"dataset",
",",
"max_neighbors",
"=",
"10",
",",
"radius",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"## Validate the query 'dataset'. Note that the 'max_neighbors' and",
"# 'radius' parameters are validated by the nearest nei... | Return the predicted class for each observation in *dataset*. This
prediction is made based on the closest neighbors stored in the nearest
neighbors classifier model.
Parameters
----------
dataset : SFrame
Dataset of new observations. Must include columns with the sa... | [
"Return",
"the",
"predicted",
"class",
"for",
"each",
"observation",
"in",
"*",
"dataset",
"*",
".",
"This",
"prediction",
"is",
"made",
"based",
"on",
"the",
"closest",
"neighbors",
"stored",
"in",
"the",
"nearest",
"neighbors",
"classifier",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L421-L533 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | NearestNeighborClassifier.predict | def predict(self, dataset, max_neighbors=10, radius=None,
output_type='class', verbose=True):
"""
Return predicted class labels for instances in *dataset*. This model
makes predictions based on the closest neighbors stored in the nearest
neighbors classifier model.
... | python | def predict(self, dataset, max_neighbors=10, radius=None,
output_type='class', verbose=True):
"""
Return predicted class labels for instances in *dataset*. This model
makes predictions based on the closest neighbors stored in the nearest
neighbors classifier model.
... | [
"def",
"predict",
"(",
"self",
",",
"dataset",
",",
"max_neighbors",
"=",
"10",
",",
"radius",
"=",
"None",
",",
"output_type",
"=",
"'class'",
",",
"verbose",
"=",
"True",
")",
":",
"ystar",
"=",
"self",
".",
"classify",
"(",
"dataset",
"=",
"dataset"... | Return predicted class labels for instances in *dataset*. This model
makes predictions based on the closest neighbors stored in the nearest
neighbors classifier model.
Parameters
----------
dataset : SFrame
Dataset of new observations. Must include the features used ... | [
"Return",
"predicted",
"class",
"labels",
"for",
"instances",
"in",
"*",
"dataset",
"*",
".",
"This",
"model",
"makes",
"predictions",
"based",
"on",
"the",
"closest",
"neighbors",
"stored",
"in",
"the",
"nearest",
"neighbors",
"classifier",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L535-L610 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | NearestNeighborClassifier.predict_topk | def predict_topk(self, dataset, max_neighbors=10, radius=None, k=3,
verbose=False):
"""
Return top-k most likely predictions for each observation in
``dataset``. Predictions are returned as an SFrame with three columns:
`row_id`, `class`, and `probability`.
... | python | def predict_topk(self, dataset, max_neighbors=10, radius=None, k=3,
verbose=False):
"""
Return top-k most likely predictions for each observation in
``dataset``. Predictions are returned as an SFrame with three columns:
`row_id`, `class`, and `probability`.
... | [
"def",
"predict_topk",
"(",
"self",
",",
"dataset",
",",
"max_neighbors",
"=",
"10",
",",
"radius",
"=",
"None",
",",
"k",
"=",
"3",
",",
"verbose",
"=",
"False",
")",
":",
"## Validate the number of results to return. Note that the",
"# 'max_neighbors' and 'radius... | Return top-k most likely predictions for each observation in
``dataset``. Predictions are returned as an SFrame with three columns:
`row_id`, `class`, and `probability`.
Parameters
----------
dataset : SFrame
Dataset of new observations. Must include the features use... | [
"Return",
"top",
"-",
"k",
"most",
"likely",
"predictions",
"for",
"each",
"observation",
"in",
"dataset",
".",
"Predictions",
"are",
"returned",
"as",
"an",
"SFrame",
"with",
"three",
"columns",
":",
"row_id",
"class",
"and",
"probability",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L612-L731 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | NearestNeighborClassifier.evaluate | def evaluate(self, dataset, metric='auto', max_neighbors=10, radius=None):
"""
Evaluate the model's predictive accuracy. This is done by predicting the
target class for instances in a new dataset and comparing to known
target values.
Parameters
----------
dataset... | python | def evaluate(self, dataset, metric='auto', max_neighbors=10, radius=None):
"""
Evaluate the model's predictive accuracy. This is done by predicting the
target class for instances in a new dataset and comparing to known
target values.
Parameters
----------
dataset... | [
"def",
"evaluate",
"(",
"self",
",",
"dataset",
",",
"metric",
"=",
"'auto'",
",",
"max_neighbors",
"=",
"10",
",",
"radius",
"=",
"None",
")",
":",
"## Validate the metric name",
"_raise_error_evaluation_metric_is_valid",
"(",
"metric",
",",
"[",
"'auto'",
",",... | Evaluate the model's predictive accuracy. This is done by predicting the
target class for instances in a new dataset and comparing to known
target values.
Parameters
----------
dataset : SFrame
Dataset of new observations. Must include columns with the same
... | [
"Evaluate",
"the",
"model",
"s",
"predictive",
"accuracy",
".",
"This",
"is",
"done",
"by",
"predicting",
"the",
"target",
"class",
"for",
"instances",
"in",
"a",
"new",
"dataset",
"and",
"comparing",
"to",
"known",
"target",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L734-L847 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain._compact_class_repr | def _compact_class_repr(obj):
""" A compact version of __repr__ for each of the steps.
"""
dict_str_list = []
post_repr_string = ""
# If features are present, then shorten it.
init_func = obj.__init__
if _sys.version_info.major == 2:
init_func = init_... | python | def _compact_class_repr(obj):
""" A compact version of __repr__ for each of the steps.
"""
dict_str_list = []
post_repr_string = ""
# If features are present, then shorten it.
init_func = obj.__init__
if _sys.version_info.major == 2:
init_func = init_... | [
"def",
"_compact_class_repr",
"(",
"obj",
")",
":",
"dict_str_list",
"=",
"[",
"]",
"post_repr_string",
"=",
"\"\"",
"# If features are present, then shorten it.",
"init_func",
"=",
"obj",
".",
"__init__",
"if",
"_sys",
".",
"version_info",
".",
"major",
"==",
"2"... | A compact version of __repr__ for each of the steps. | [
"A",
"compact",
"version",
"of",
"__repr__",
"for",
"each",
"of",
"the",
"steps",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L126-L165 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain._preprocess | def _preprocess(self, data):
"""
Internal function to perform fit_transform() on all but last step.
"""
transformed_data = _copy(data)
for name, step in self._transformers[:-1]:
transformed_data = step.fit_transform(transformed_data)
if type(transformed_da... | python | def _preprocess(self, data):
"""
Internal function to perform fit_transform() on all but last step.
"""
transformed_data = _copy(data)
for name, step in self._transformers[:-1]:
transformed_data = step.fit_transform(transformed_data)
if type(transformed_da... | [
"def",
"_preprocess",
"(",
"self",
",",
"data",
")",
":",
"transformed_data",
"=",
"_copy",
"(",
"data",
")",
"for",
"name",
",",
"step",
"in",
"self",
".",
"_transformers",
"[",
":",
"-",
"1",
"]",
":",
"transformed_data",
"=",
"step",
".",
"fit_trans... | Internal function to perform fit_transform() on all but last step. | [
"Internal",
"function",
"to",
"perform",
"fit_transform",
"()",
"on",
"all",
"but",
"last",
"step",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L192-L203 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain.fit | def fit(self, data):
"""
Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_tr... | python | def fit(self, data):
"""
Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_tr... | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_transformers",
":",
"return",
"transformed_data",
"=",
"self",
".",
"_preprocess",
"(",
"data",
")",
"final_step",
"=",
"self",
".",
"_transformers",
"[",
"-",
"1",
"]",
"fin... | Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_transform
Examples
-------... | [
"Fits",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L205-L233 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain.fit_transform | def fit_transform(self, data):
"""
First fit a transformer using the SFrame `data` and then return a transformed
version of `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer. The same data is then also
transformed.
... | python | def fit_transform(self, data):
"""
First fit a transformer using the SFrame `data` and then return a transformed
version of `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer. The same data is then also
transformed.
... | [
"def",
"fit_transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_transformers",
":",
"return",
"self",
".",
"_preprocess",
"(",
"data",
")",
"transformed_data",
"=",
"self",
".",
"_preprocess",
"(",
"data",
")",
"final_step",
"=",
... | First fit a transformer using the SFrame `data` and then return a transformed
version of `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer. The same data is then also
transformed.
Returns
-------
Transformed... | [
"First",
"fit",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"and",
"then",
"return",
"a",
"transformed",
"version",
"of",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L235-L271 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain.transform | def transform(self, data):
"""
Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
... | python | def transform(self, data):
"""
Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
... | [
"def",
"transform",
"(",
"self",
",",
"data",
")",
":",
"transformed_data",
"=",
"_copy",
"(",
"data",
")",
"for",
"name",
",",
"step",
"in",
"self",
".",
"_transformers",
":",
"transformed_data",
"=",
"step",
".",
"transform",
"(",
"transformed_data",
")"... | Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
A transformed SFrame.
See Also
... | [
"Transform",
"the",
"SFrame",
"data",
"using",
"a",
"fitted",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L273-L308 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain._load_version | def _load_version(cls, unpickler, version):
"""
An function to load an object with a specific version of the class.
Parameters
----------
pickler : file
A GLUnpickler file handle.
version : int
A version number as maintained by the class writer.
... | python | def _load_version(cls, unpickler, version):
"""
An function to load an object with a specific version of the class.
Parameters
----------
pickler : file
A GLUnpickler file handle.
version : int
A version number as maintained by the class writer.
... | [
"def",
"_load_version",
"(",
"cls",
",",
"unpickler",
",",
"version",
")",
":",
"obj",
"=",
"unpickler",
".",
"load",
"(",
")",
"return",
"TransformerChain",
"(",
"obj",
".",
"_state",
"[",
"\"steps\"",
"]",
")"
] | An function to load an object with a specific version of the class.
Parameters
----------
pickler : file
A GLUnpickler file handle.
version : int
A version number as maintained by the class writer. | [
"An",
"function",
"to",
"load",
"an",
"object",
"with",
"a",
"specific",
"version",
"of",
"the",
"class",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L348-L361 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/graph_analytics/pagerank.py | create | def create(graph, reset_probability=0.15,
threshold=1e-2,
max_iterations=20,
_single_precision=False,
_distributed='auto',
verbose=True):
"""
Compute the PageRank for each vertex in the graph. Return a model object
with total PageRank as well as the Pag... | python | def create(graph, reset_probability=0.15,
threshold=1e-2,
max_iterations=20,
_single_precision=False,
_distributed='auto',
verbose=True):
"""
Compute the PageRank for each vertex in the graph. Return a model object
with total PageRank as well as the Pag... | [
"def",
"create",
"(",
"graph",
",",
"reset_probability",
"=",
"0.15",
",",
"threshold",
"=",
"1e-2",
",",
"max_iterations",
"=",
"20",
",",
"_single_precision",
"=",
"False",
",",
"_distributed",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
")",
":",
"from"... | Compute the PageRank for each vertex in the graph. Return a model object
with total PageRank as well as the PageRank value for each vertex in the
graph.
Parameters
----------
graph : SGraph
The graph on which to compute the pagerank value.
reset_probability : float, optional
Pr... | [
"Compute",
"the",
"PageRank",
"for",
"each",
"vertex",
"in",
"the",
"graph",
".",
"Return",
"a",
"model",
"object",
"with",
"total",
"PageRank",
"as",
"well",
"as",
"the",
"PageRank",
"value",
"for",
"each",
"vertex",
"in",
"the",
"graph",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/pagerank.py#L105-L191 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/gcc.py | init | def init(version = None, command = None, options = None):
"""
Initializes the gcc toolset for the given version. If necessary, command may
be used to specify where the compiler is located. The parameter 'options' is a
space-delimited list of options, each one specified as
<option-nam... | python | def init(version = None, command = None, options = None):
"""
Initializes the gcc toolset for the given version. If necessary, command may
be used to specify where the compiler is located. The parameter 'options' is a
space-delimited list of options, each one specified as
<option-nam... | [
"def",
"init",
"(",
"version",
"=",
"None",
",",
"command",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"options",
"=",
"to_seq",
"(",
"options",
")",
"command",
"=",
"to_seq",
"(",
"command",
")",
"# Information about the gcc command...",
"# The c... | Initializes the gcc toolset for the given version. If necessary, command may
be used to specify where the compiler is located. The parameter 'options' is a
space-delimited list of options, each one specified as
<option-name>option-value. Valid option names are: cxxflags, linkflags and
li... | [
"Initializes",
"the",
"gcc",
"toolset",
"for",
"the",
"given",
"version",
".",
"If",
"necessary",
"command",
"may",
"be",
"used",
"to",
"specify",
"where",
"the",
"compiler",
"is",
"located",
".",
"The",
"parameter",
"options",
"is",
"a",
"space",
"-",
"de... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/gcc.py#L87-L203 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/gcc.py | init_link_flags | def init_link_flags(toolset, linker, condition):
"""
Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun.
"""
toolset_link = toolset + '.link'
if linker == 'gnu':
# Strip the binary when no debugging is needed. We use --strip-all flag
... | python | def init_link_flags(toolset, linker, condition):
"""
Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun.
"""
toolset_link = toolset + '.link'
if linker == 'gnu':
# Strip the binary when no debugging is needed. We use --strip-all flag
... | [
"def",
"init_link_flags",
"(",
"toolset",
",",
"linker",
",",
"condition",
")",
":",
"toolset_link",
"=",
"toolset",
"+",
"'.link'",
"if",
"linker",
"==",
"'gnu'",
":",
"# Strip the binary when no debugging is needed. We use --strip-all flag",
"# as opposed to -s since icc ... | Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun. | [
"Now",
"the",
"vendor",
"specific",
"flags",
".",
"The",
"parameter",
"linker",
"can",
"be",
"either",
"gnu",
"darwin",
"osf",
"hpux",
"or",
"sun",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/gcc.py#L494-L608 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.add_dependency | def add_dependency (self, targets, sources):
"""Adds a dependency from 'targets' to 'sources'
Both 'targets' and 'sources' can be either list
of target names, or a single target name.
"""
if isinstance (targets, str):
targets = [targets]
if isinstance (source... | python | def add_dependency (self, targets, sources):
"""Adds a dependency from 'targets' to 'sources'
Both 'targets' and 'sources' can be either list
of target names, or a single target name.
"""
if isinstance (targets, str):
targets = [targets]
if isinstance (source... | [
"def",
"add_dependency",
"(",
"self",
",",
"targets",
",",
"sources",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",
"sources",
",",
"str",
")",
":",
"sources",
"=",
"... | Adds a dependency from 'targets' to 'sources'
Both 'targets' and 'sources' can be either list
of target names, or a single target name. | [
"Adds",
"a",
"dependency",
"from",
"targets",
"to",
"sources"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L76-L91 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.get_target_variable | def get_target_variable(self, targets, variable):
"""Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value... | python | def get_target_variable(self, targets, variable):
"""Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value... | [
"def",
"get_target_variable",
"(",
"self",
",",
"targets",
",",
"variable",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"assert",
"is_iterable",
"(",
"targets",
")",
"assert",
"isinstance",
"(",
... | Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value of `variable` set on `targets` (list)
Example:
... | [
"Gets",
"the",
"value",
"of",
"variable",
"on",
"set",
"on",
"the",
"first",
"target",
"in",
"targets",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L93-L121 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.set_target_variable | def set_target_variable (self, targets, variable, value, append=0):
""" Sets a target variable.
The 'variable' will be available to bjam when it decides
where to generate targets, and will also be available to
updating rule for that 'taret'.
"""
if isinstance (targets, s... | python | def set_target_variable (self, targets, variable, value, append=0):
""" Sets a target variable.
The 'variable' will be available to bjam when it decides
where to generate targets, and will also be available to
updating rule for that 'taret'.
"""
if isinstance (targets, s... | [
"def",
"set_target_variable",
"(",
"self",
",",
"targets",
",",
"variable",
",",
"value",
",",
"append",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",
"value"... | Sets a target variable.
The 'variable' will be available to bjam when it decides
where to generate targets, and will also be available to
updating rule for that 'taret'. | [
"Sets",
"a",
"target",
"variable",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L123-L143 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.set_update_action | def set_update_action (self, action_name, targets, sources, properties=None):
""" Binds a target to the corresponding update action.
If target needs to be updated, the action registered
with action_name will be used.
The 'action_name' must be previously registered by
... | python | def set_update_action (self, action_name, targets, sources, properties=None):
""" Binds a target to the corresponding update action.
If target needs to be updated, the action registered
with action_name will be used.
The 'action_name' must be previously registered by
... | [
"def",
"set_update_action",
"(",
"self",
",",
"action_name",
",",
"targets",
",",
"sources",
",",
"properties",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",... | Binds a target to the corresponding update action.
If target needs to be updated, the action registered
with action_name will be used.
The 'action_name' must be previously registered by
either 'register_action' or 'register_bjam_action'
method. | [
"Binds",
"a",
"target",
"to",
"the",
"corresponding",
"update",
"action",
".",
"If",
"target",
"needs",
"to",
"be",
"updated",
"the",
"action",
"registered",
"with",
"action_name",
"will",
"be",
"used",
".",
"The",
"action_name",
"must",
"be",
"previously",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L145-L164 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.register_action | def register_action (self, action_name, command='', bound_list = [], flags = [],
function = None):
"""Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming th... | python | def register_action (self, action_name, command='', bound_list = [], flags = [],
function = None):
"""Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming th... | [
"def",
"register_action",
"(",
"self",
",",
"action_name",
",",
"command",
"=",
"''",
",",
"bound_list",
"=",
"[",
"]",
",",
"flags",
"=",
"[",
"]",
",",
"function",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"action_name",
",",
"basestring",
... | Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming the list of variables bound when the command is executed
and specified flag.
If 'function' is not None, it should be a ca... | [
"Creates",
"a",
"new",
"build",
"engine",
"action",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L166-L199 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.register_bjam_action | def register_bjam_action (self, action_name, function=None):
"""Informs self that 'action_name' is declared in bjam.
From this point, 'action_name' is a valid argument to the
set_update_action method. The action_name should be callable
in the global module of bjam.
"""
... | python | def register_bjam_action (self, action_name, function=None):
"""Informs self that 'action_name' is declared in bjam.
From this point, 'action_name' is a valid argument to the
set_update_action method. The action_name should be callable
in the global module of bjam.
"""
... | [
"def",
"register_bjam_action",
"(",
"self",
",",
"action_name",
",",
"function",
"=",
"None",
")",
":",
"# We allow duplicate calls to this rule for the same",
"# action name. This way, jamfile rules that take action names",
"# can just register them without specially checking if",
"#... | Informs self that 'action_name' is declared in bjam.
From this point, 'action_name' is a valid argument to the
set_update_action method. The action_name should be callable
in the global module of bjam. | [
"Informs",
"self",
"that",
"action_name",
"is",
"declared",
"in",
"bjam",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L201-L216 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/image.py | Image.pixel_data | def pixel_data(self):
"""
Returns the pixel data stored in the Image object.
Returns
-------
out : numpy.array
The pixel data of the Image object. It returns a multi-dimensional
numpy array, where the shape of the array represents the shape of
... | python | def pixel_data(self):
"""
Returns the pixel data stored in the Image object.
Returns
-------
out : numpy.array
The pixel data of the Image object. It returns a multi-dimensional
numpy array, where the shape of the array represents the shape of
... | [
"def",
"pixel_data",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"as",
"_extensions",
"data",
"=",
"_np",
".",
"zeros",
"(",
"(",
"self",
".",
"height",
",",
"self",
".",
"width",
",",
"self",
".",
"channels",
")",
",",
"dtype",
... | Returns the pixel data stored in the Image object.
Returns
-------
out : numpy.array
The pixel data of the Image object. It returns a multi-dimensional
numpy array, where the shape of the array represents the shape of
the image (height, weight, channels).
... | [
"Returns",
"the",
"pixel",
"data",
"stored",
"in",
"the",
"Image",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/image.py#L141-L167 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/image.py | Image.show | def show(self):
"""
Displays the image. Requires PIL/Pillow.
Alternatively, you can create an :class:`turicreate.SArray` of this image
and use py:func:`turicreate.SArray.show()`
See Also
--------
turicreate.image_analysis.resize
Examples
-------... | python | def show(self):
"""
Displays the image. Requires PIL/Pillow.
Alternatively, you can create an :class:`turicreate.SArray` of this image
and use py:func:`turicreate.SArray.show()`
See Also
--------
turicreate.image_analysis.resize
Examples
-------... | [
"def",
"show",
"(",
"self",
")",
":",
"from",
".",
".",
"visualization",
".",
"_plot",
"import",
"_target",
"try",
":",
"img",
"=",
"self",
".",
"_to_pil_image",
"(",
")",
"try",
":",
"# output into jupyter notebook if possible",
"if",
"_target",
"==",
"'aut... | Displays the image. Requires PIL/Pillow.
Alternatively, you can create an :class:`turicreate.SArray` of this image
and use py:func:`turicreate.SArray.show()`
See Also
--------
turicreate.image_analysis.resize
Examples
--------
>>> img = turicreate.Image... | [
"Displays",
"the",
"image",
".",
"Requires",
"PIL",
"/",
"Pillow",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/image.py#L218-L256 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | MLModel.predict | def predict(self, data, useCPUOnly=False, **kwargs):
"""
Return predictions for the model. The kwargs gets passed into the
model as a dictionary.
Parameters
----------
data : dict[str, value]
Dictionary of data to make predictions from where the keys are
... | python | def predict(self, data, useCPUOnly=False, **kwargs):
"""
Return predictions for the model. The kwargs gets passed into the
model as a dictionary.
Parameters
----------
data : dict[str, value]
Dictionary of data to make predictions from where the keys are
... | [
"def",
"predict",
"(",
"self",
",",
"data",
",",
"useCPUOnly",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"__proxy__",
":",
"return",
"self",
".",
"__proxy__",
".",
"predict",
"(",
"data",
",",
"useCPUOnly",
")",
"else",
":",... | Return predictions for the model. The kwargs gets passed into the
model as a dictionary.
Parameters
----------
data : dict[str, value]
Dictionary of data to make predictions from where the keys are
the names of the input features.
useCPUOnly : bool
... | [
"Return",
"predictions",
"for",
"the",
"model",
".",
"The",
"kwargs",
"gets",
"passed",
"into",
"the",
"model",
"as",
"a",
"dictionary",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L300-L347 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | MLModel.visualize_spec | def visualize_spec(self, port=None, input_shape_dict=None):
"""
Visualize the model.
Parameters
----------
port : int
if server is to be hosted on specific localhost port
input_shape_dict : dict
The shapes are calculat... | python | def visualize_spec(self, port=None, input_shape_dict=None):
"""
Visualize the model.
Parameters
----------
port : int
if server is to be hosted on specific localhost port
input_shape_dict : dict
The shapes are calculat... | [
"def",
"visualize_spec",
"(",
"self",
",",
"port",
"=",
"None",
",",
"input_shape_dict",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"_spec",
"model_type",
"=",
"spec",
".",
"WhichOneof",
"(",
"'Type'",
")",
"model_description",
"=",
"spec",
".",
"d... | Visualize the model.
Parameters
----------
port : int
if server is to be hosted on specific localhost port
input_shape_dict : dict
The shapes are calculated assuming the batch and sequence
are 1 i.e. (1, 1, C, H, W). If ei... | [
"Visualize",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L349-L478 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | _construct_auto_distance | def _construct_auto_distance(feature_names, column_names, column_types, sample):
"""
Construct composite distance parameters based on selected features and their
types.
"""
## Make a dictionary from the column_names and column_types
col_type_dict = {k: v for k, v in zip(column_names, column_typ... | python | def _construct_auto_distance(feature_names, column_names, column_types, sample):
"""
Construct composite distance parameters based on selected features and their
types.
"""
## Make a dictionary from the column_names and column_types
col_type_dict = {k: v for k, v in zip(column_names, column_typ... | [
"def",
"_construct_auto_distance",
"(",
"feature_names",
",",
"column_names",
",",
"column_types",
",",
"sample",
")",
":",
"## Make a dictionary from the column_names and column_types",
"col_type_dict",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"zip",
"(... | Construct composite distance parameters based on selected features and their
types. | [
"Construct",
"composite",
"distance",
"parameters",
"based",
"on",
"selected",
"features",
"and",
"their",
"types",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L33-L71 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | create | def create(dataset, label=None, features=None, distance=None, method='auto',
verbose=True, **kwargs):
"""
Create a nearest neighbor model, which can be searched efficiently and
quickly for the nearest neighbors of a query observation. If the `method`
argument is specified as `auto`, the type ... | python | def create(dataset, label=None, features=None, distance=None, method='auto',
verbose=True, **kwargs):
"""
Create a nearest neighbor model, which can be searched efficiently and
quickly for the nearest neighbors of a query observation. If the `method`
argument is specified as `auto`, the type ... | [
"def",
"create",
"(",
"dataset",
",",
"label",
"=",
"None",
",",
"features",
"=",
"None",
",",
"distance",
"=",
"None",
",",
"method",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"## Validate the 'dataset' input",
"_tku... | Create a nearest neighbor model, which can be searched efficiently and
quickly for the nearest neighbors of a query observation. If the `method`
argument is specified as `auto`, the type of model is chosen automatically
based on the type of data in `dataset`.
.. warning::
The 'dot_product' dis... | [
"Create",
"a",
"nearest",
"neighbor",
"model",
"which",
"can",
"be",
"searched",
"efficiently",
"and",
"quickly",
"for",
"the",
"nearest",
"neighbors",
"of",
"a",
"query",
"observation",
".",
"If",
"the",
"method",
"argument",
"is",
"specified",
"as",
"auto",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L74-L584 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel._get_summary_struct | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where
relevant) the schema of the training data, description of the training
data, training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | python | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where
relevant) the schema of the training data, description of the training
data, training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"model_fields",
"=",
"[",
"(",
"\"Method\"",
",",
"'method'",
")",
",",
"(",
"\"Number of distance components\"",
",",
"'num_distance_components'",
")",
",",
"(",
"\"Number of examples\"",
",",
"'num_examples'",
"... | Returns a structured description of the model, including (where
relevant) the schema of the training data, description of the training
data, training statistics, and model hyperparameters.
Returns
-------
sections : list (of list of tuples)
A list of summary sections... | [
"Returns",
"a",
"structured",
"description",
"of",
"the",
"model",
"including",
"(",
"where",
"relevant",
")",
"the",
"schema",
"of",
"the",
"training",
"data",
"description",
"of",
"the",
"training",
"data",
"training",
"statistics",
"and",
"model",
"hyperparam... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L619-L664 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel._list_fields | def _list_fields(self):
"""
List the fields stored in the model, including data, model, and
training options. Each field can be queried with the ``get`` method.
Returns
-------
out : list
List of fields queryable with the ``get`` method.
"""
o... | python | def _list_fields(self):
"""
List the fields stored in the model, including data, model, and
training options. Each field can be queried with the ``get`` method.
Returns
-------
out : list
List of fields queryable with the ``get`` method.
"""
o... | [
"def",
"_list_fields",
"(",
"self",
")",
":",
"opts",
"=",
"{",
"'model'",
":",
"self",
".",
"__proxy__",
",",
"'model_name'",
":",
"self",
".",
"__name__",
"}",
"response",
"=",
"_turicreate",
".",
"extensions",
".",
"_nearest_neighbors",
".",
"list_fields"... | List the fields stored in the model, including data, model, and
training options. Each field can be queried with the ``get`` method.
Returns
-------
out : list
List of fields queryable with the ``get`` method. | [
"List",
"the",
"fields",
"stored",
"in",
"the",
"model",
"including",
"data",
"model",
"and",
"training",
"options",
".",
"Each",
"field",
"can",
"be",
"queried",
"with",
"the",
"get",
"method",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L675-L688 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel._get | def _get(self, field):
"""
Return the value of a given field. The list of all queryable fields is
detailed below, and can be obtained with the
:func:`~turicreate.nearest_neighbors.NearestNeighborsModel._list_fields`
method.
+-----------------------+----------------------... | python | def _get(self, field):
"""
Return the value of a given field. The list of all queryable fields is
detailed below, and can be obtained with the
:func:`~turicreate.nearest_neighbors.NearestNeighborsModel._list_fields`
method.
+-----------------------+----------------------... | [
"def",
"_get",
"(",
"self",
",",
"field",
")",
":",
"opts",
"=",
"{",
"'model'",
":",
"self",
".",
"__proxy__",
",",
"'model_name'",
":",
"self",
".",
"__name__",
",",
"'field'",
":",
"field",
"}",
"response",
"=",
"_turicreate",
".",
"extensions",
"."... | Return the value of a given field. The list of all queryable fields is
detailed below, and can be obtained with the
:func:`~turicreate.nearest_neighbors.NearestNeighborsModel._list_fields`
method.
+-----------------------+----------------------------------------------+
| Fi... | [
"Return",
"the",
"value",
"of",
"a",
"given",
"field",
".",
"The",
"list",
"of",
"all",
"queryable",
"fields",
"is",
"detailed",
"below",
"and",
"can",
"be",
"obtained",
"with",
"the",
":",
"func",
":",
"~turicreate",
".",
"nearest_neighbors",
".",
"Neares... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L690-L739 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel._training_stats | def _training_stats(self):
"""
Return a dictionary of statistics collected during creation of the
model. These statistics are also available with the ``get`` method and
are described in more detail in that method's documentation.
Returns
-------
out : dict
... | python | def _training_stats(self):
"""
Return a dictionary of statistics collected during creation of the
model. These statistics are also available with the ``get`` method and
are described in more detail in that method's documentation.
Returns
-------
out : dict
... | [
"def",
"_training_stats",
"(",
"self",
")",
":",
"opts",
"=",
"{",
"'model'",
":",
"self",
".",
"__proxy__",
",",
"'model_name'",
":",
"self",
".",
"__name__",
"}",
"return",
"_turicreate",
".",
"extensions",
".",
"_nearest_neighbors",
".",
"training_stats",
... | Return a dictionary of statistics collected during creation of the
model. These statistics are also available with the ``get`` method and
are described in more detail in that method's documentation.
Returns
-------
out : dict
Dictionary of statistics compiled during ... | [
"Return",
"a",
"dictionary",
"of",
"statistics",
"collected",
"during",
"creation",
"of",
"the",
"model",
".",
"These",
"statistics",
"are",
"also",
"available",
"with",
"the",
"get",
"method",
"and",
"are",
"described",
"in",
"more",
"detail",
"in",
"that",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L741-L775 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel.query | def query(self, dataset, label=None, k=5, radius=None, verbose=True):
"""
For each row of the input 'dataset', retrieve the nearest neighbors
from the model's stored data. In general, the query dataset does not
need to be the same as the reference data stored in the model, but if
... | python | def query(self, dataset, label=None, k=5, radius=None, verbose=True):
"""
For each row of the input 'dataset', retrieve the nearest neighbors
from the model's stored data. In general, the query dataset does not
need to be the same as the reference data stored in the model, but if
... | [
"def",
"query",
"(",
"self",
",",
"dataset",
",",
"label",
"=",
"None",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"## Validate the 'dataset' input",
"_tkutl",
".",
"_raise_error_if_not_sframe",
"(",
"dataset",
"... | For each row of the input 'dataset', retrieve the nearest neighbors
from the model's stored data. In general, the query dataset does not
need to be the same as the reference data stored in the model, but if
it is, the 'include_self_edges' parameter can be set to False to
exclude results ... | [
"For",
"each",
"row",
"of",
"the",
"input",
"dataset",
"retrieve",
"the",
"nearest",
"neighbors",
"from",
"the",
"model",
"s",
"stored",
"data",
".",
"In",
"general",
"the",
"query",
"dataset",
"does",
"not",
"need",
"to",
"be",
"the",
"same",
"as",
"the... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L777-L935 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel.similarity_graph | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model. This is conceptually very similar to
running `query` wit... | python | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model. This is conceptually very similar to
running `query` wit... | [
"def",
"similarity_graph",
"(",
"self",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"include_self_edges",
"=",
"False",
",",
"output_type",
"=",
"'SGraph'",
",",
"verbose",
"=",
"True",
")",
":",
"## Validate inputs.",
"if",
"k",
"is",
"not",
"N... | Construct the similarity graph on the reference dataset, which is
already stored in the model. This is conceptually very similar to
running `query` with the reference set, but this method is optimized
for the purpose, syntactically simpler, and automatically removes
self-edges.
... | [
"Construct",
"the",
"similarity",
"graph",
"on",
"the",
"reference",
"dataset",
"which",
"is",
"already",
"stored",
"in",
"the",
"model",
".",
"This",
"is",
"conceptually",
"very",
"similar",
"to",
"running",
"query",
"with",
"the",
"reference",
"set",
"but",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L937-L1060 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/activity_classifier/util.py | random_split_by_session | def random_split_by_session(dataset, session_id, fraction=0.9, seed=None):
"""
Randomly split an SFrame into two SFrames based on the `session_id` such
that one split contains data for a `fraction` of the sessions while the
second split contains all data for the rest of the sessions.
Parameters
... | python | def random_split_by_session(dataset, session_id, fraction=0.9, seed=None):
"""
Randomly split an SFrame into two SFrames based on the `session_id` such
that one split contains data for a `fraction` of the sessions while the
second split contains all data for the rest of the sessions.
Parameters
... | [
"def",
"random_split_by_session",
"(",
"dataset",
",",
"session_id",
",",
"fraction",
"=",
"0.9",
",",
"seed",
"=",
"None",
")",
":",
"from",
"random",
"import",
"Random",
"_raise_error_if_not_of_type",
"(",
"dataset",
",",
"_SFrame",
",",
"'dataset'",
")",
"_... | Randomly split an SFrame into two SFrames based on the `session_id` such
that one split contains data for a `fraction` of the sessions while the
second split contains all data for the rest of the sessions.
Parameters
----------
dataset : SFrame
Dataset to split. It must contain a column of ... | [
"Randomly",
"split",
"an",
"SFrame",
"into",
"two",
"SFrames",
"based",
"on",
"the",
"session_id",
"such",
"that",
"one",
"split",
"contains",
"data",
"for",
"a",
"fraction",
"of",
"the",
"sessions",
"while",
"the",
"second",
"split",
"contains",
"all",
"dat... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/util.py#L20-L104 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | read_msbuild_xml | def read_msbuild_xml(path, values={}):
"""Reads the MS Build XML file at the path and returns its contents.
Keyword arguments:
values -- The map to append the contents to (default {})
"""
# Attempt to read the file contents
try:
document = parse(path)
except Exception as e:
... | python | def read_msbuild_xml(path, values={}):
"""Reads the MS Build XML file at the path and returns its contents.
Keyword arguments:
values -- The map to append the contents to (default {})
"""
# Attempt to read the file contents
try:
document = parse(path)
except Exception as e:
... | [
"def",
"read_msbuild_xml",
"(",
"path",
",",
"values",
"=",
"{",
"}",
")",
":",
"# Attempt to read the file contents",
"try",
":",
"document",
"=",
"parse",
"(",
"path",
")",
"except",
"Exception",
"as",
"e",
":",
"logging",
".",
"exception",
"(",
"'Could no... | Reads the MS Build XML file at the path and returns its contents.
Keyword arguments:
values -- The map to append the contents to (default {}) | [
"Reads",
"the",
"MS",
"Build",
"XML",
"file",
"at",
"the",
"path",
"and",
"returns",
"its",
"contents",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L38-L76 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | read_msbuild_json | def read_msbuild_json(path, values=[]):
"""Reads the MS Build JSON file at the path and returns its contents.
Keyword arguments:
values -- The list to append the contents to (default [])
"""
if not os.path.exists(path):
logging.info('Could not find MS Build JSON file at %s', path)
r... | python | def read_msbuild_json(path, values=[]):
"""Reads the MS Build JSON file at the path and returns its contents.
Keyword arguments:
values -- The list to append the contents to (default [])
"""
if not os.path.exists(path):
logging.info('Could not find MS Build JSON file at %s', path)
r... | [
"def",
"read_msbuild_json",
"(",
"path",
",",
"values",
"=",
"[",
"]",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"logging",
".",
"info",
"(",
"'Could not find MS Build JSON file at %s'",
",",
"path",
")",
"return",
"... | Reads the MS Build JSON file at the path and returns its contents.
Keyword arguments:
values -- The list to append the contents to (default []) | [
"Reads",
"the",
"MS",
"Build",
"JSON",
"file",
"at",
"the",
"path",
"and",
"returns",
"its",
"contents",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L79-L97 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | main | def main():
"""Script entrypoint."""
# Parse the arguments
parser = argparse.ArgumentParser(
description='Convert MSBuild XML to JSON format')
parser.add_argument(
'-t', '--toolchain', help='The name of the toolchain', required=True)
parser.add_argument(
'-o', '--output', he... | python | def main():
"""Script entrypoint."""
# Parse the arguments
parser = argparse.ArgumentParser(
description='Convert MSBuild XML to JSON format')
parser.add_argument(
'-t', '--toolchain', help='The name of the toolchain', required=True)
parser.add_argument(
'-o', '--output', he... | [
"def",
"main",
"(",
")",
":",
"# Parse the arguments",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Convert MSBuild XML to JSON format'",
")",
"parser",
".",
"add_argument",
"(",
"'-t'",
",",
"'--toolchain'",
",",
"help",
"=",
"'The... | Script entrypoint. | [
"Script",
"entrypoint",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L100-L168 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __merge_json_values | def __merge_json_values(current, previous):
"""Merges the values between the current and previous run of the script."""
for value in current:
name = value['name']
# Find the previous value
previous_value = __find_and_remove_value(previous, value)
if previous_value is not None:
... | python | def __merge_json_values(current, previous):
"""Merges the values between the current and previous run of the script."""
for value in current:
name = value['name']
# Find the previous value
previous_value = __find_and_remove_value(previous, value)
if previous_value is not None:
... | [
"def",
"__merge_json_values",
"(",
"current",
",",
"previous",
")",
":",
"for",
"value",
"in",
"current",
":",
"name",
"=",
"value",
"[",
"'name'",
"]",
"# Find the previous value",
"previous_value",
"=",
"__find_and_remove_value",
"(",
"previous",
",",
"value",
... | Merges the values between the current and previous run of the script. | [
"Merges",
"the",
"values",
"between",
"the",
"current",
"and",
"previous",
"run",
"of",
"the",
"script",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L173-L198 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __find_and_remove_value | def __find_and_remove_value(list, compare):
"""Finds the value in the list that corresponds with the value of compare."""
# next throws if there are no matches
try:
found = next(value for value in list
if value['name'] == compare['name'] and value['switch'] ==
... | python | def __find_and_remove_value(list, compare):
"""Finds the value in the list that corresponds with the value of compare."""
# next throws if there are no matches
try:
found = next(value for value in list
if value['name'] == compare['name'] and value['switch'] ==
... | [
"def",
"__find_and_remove_value",
"(",
"list",
",",
"compare",
")",
":",
"# next throws if there are no matches",
"try",
":",
"found",
"=",
"next",
"(",
"value",
"for",
"value",
"in",
"list",
"if",
"value",
"[",
"'name'",
"]",
"==",
"compare",
"[",
"'name'",
... | Finds the value in the list that corresponds with the value of compare. | [
"Finds",
"the",
"value",
"in",
"the",
"list",
"that",
"corresponds",
"with",
"the",
"value",
"of",
"compare",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L201-L213 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert | def __convert(root, tag, values, func):
"""Converts the tag type found in the root and converts them using the func
and appends them to the values.
"""
elements = root.getElementsByTagName(tag)
for element in elements:
converted = func(element)
# Append to the list
__append... | python | def __convert(root, tag, values, func):
"""Converts the tag type found in the root and converts them using the func
and appends them to the values.
"""
elements = root.getElementsByTagName(tag)
for element in elements:
converted = func(element)
# Append to the list
__append... | [
"def",
"__convert",
"(",
"root",
",",
"tag",
",",
"values",
",",
"func",
")",
":",
"elements",
"=",
"root",
".",
"getElementsByTagName",
"(",
"tag",
")",
"for",
"element",
"in",
"elements",
":",
"converted",
"=",
"func",
"(",
"element",
")",
"# Append to... | Converts the tag type found in the root and converts them using the func
and appends them to the values. | [
"Converts",
"the",
"tag",
"type",
"found",
"in",
"the",
"root",
"and",
"converts",
"them",
"using",
"the",
"func",
"and",
"appends",
"them",
"to",
"the",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L218-L228 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_enum | def __convert_enum(node):
"""Converts an EnumProperty node to JSON format."""
name = __get_attribute(node, 'Name')
logging.debug('Found EnumProperty named %s', name)
converted_values = []
for value in node.getElementsByTagName('EnumValue'):
converted = __convert_node(value)
conver... | python | def __convert_enum(node):
"""Converts an EnumProperty node to JSON format."""
name = __get_attribute(node, 'Name')
logging.debug('Found EnumProperty named %s', name)
converted_values = []
for value in node.getElementsByTagName('EnumValue'):
converted = __convert_node(value)
conver... | [
"def",
"__convert_enum",
"(",
"node",
")",
":",
"name",
"=",
"__get_attribute",
"(",
"node",
",",
"'Name'",
")",
"logging",
".",
"debug",
"(",
"'Found EnumProperty named %s'",
",",
"name",
")",
"converted_values",
"=",
"[",
"]",
"for",
"value",
"in",
"node",... | Converts an EnumProperty node to JSON format. | [
"Converts",
"an",
"EnumProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L231-L249 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_bool | def __convert_bool(node):
"""Converts an BoolProperty node to JSON format."""
converted = __convert_node(node, default_value='true')
# Check for a switch for reversing the value
reverse_switch = __get_attribute(node, 'ReverseSwitch')
if reverse_switch:
converted_reverse = copy.deepcopy(con... | python | def __convert_bool(node):
"""Converts an BoolProperty node to JSON format."""
converted = __convert_node(node, default_value='true')
# Check for a switch for reversing the value
reverse_switch = __get_attribute(node, 'ReverseSwitch')
if reverse_switch:
converted_reverse = copy.deepcopy(con... | [
"def",
"__convert_bool",
"(",
"node",
")",
":",
"converted",
"=",
"__convert_node",
"(",
"node",
",",
"default_value",
"=",
"'true'",
")",
"# Check for a switch for reversing the value",
"reverse_switch",
"=",
"__get_attribute",
"(",
"node",
",",
"'ReverseSwitch'",
")... | Converts an BoolProperty node to JSON format. | [
"Converts",
"an",
"BoolProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L252-L270 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_string_list | def __convert_string_list(node):
"""Converts a StringListProperty node to JSON format."""
converted = __convert_node(node)
# Determine flags for the string list
flags = vsflags(VSFlags.UserValue)
# Check for a separator to determine if it is semicolon appendable
# If not present assume the val... | python | def __convert_string_list(node):
"""Converts a StringListProperty node to JSON format."""
converted = __convert_node(node)
# Determine flags for the string list
flags = vsflags(VSFlags.UserValue)
# Check for a separator to determine if it is semicolon appendable
# If not present assume the val... | [
"def",
"__convert_string_list",
"(",
"node",
")",
":",
"converted",
"=",
"__convert_node",
"(",
"node",
")",
"# Determine flags for the string list",
"flags",
"=",
"vsflags",
"(",
"VSFlags",
".",
"UserValue",
")",
"# Check for a separator to determine if it is semicolon app... | Converts a StringListProperty node to JSON format. | [
"Converts",
"a",
"StringListProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L273-L289 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_string | def __convert_string(node):
"""Converts a StringProperty node to JSON format."""
converted = __convert_node(node, default_flags=vsflags(VSFlags.UserValue))
return __check_for_flag(converted) | python | def __convert_string(node):
"""Converts a StringProperty node to JSON format."""
converted = __convert_node(node, default_flags=vsflags(VSFlags.UserValue))
return __check_for_flag(converted) | [
"def",
"__convert_string",
"(",
"node",
")",
":",
"converted",
"=",
"__convert_node",
"(",
"node",
",",
"default_flags",
"=",
"vsflags",
"(",
"VSFlags",
".",
"UserValue",
")",
")",
"return",
"__check_for_flag",
"(",
"converted",
")"
] | Converts a StringProperty node to JSON format. | [
"Converts",
"a",
"StringProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L292-L296 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_node | def __convert_node(node, default_value='', default_flags=vsflags()):
"""Converts a XML node to a JSON equivalent."""
name = __get_attribute(node, 'Name')
logging.debug('Found %s named %s', node.tagName, name)
converted = {}
converted['name'] = name
converted['switch'] = __get_attribute(node, 'S... | python | def __convert_node(node, default_value='', default_flags=vsflags()):
"""Converts a XML node to a JSON equivalent."""
name = __get_attribute(node, 'Name')
logging.debug('Found %s named %s', node.tagName, name)
converted = {}
converted['name'] = name
converted['switch'] = __get_attribute(node, 'S... | [
"def",
"__convert_node",
"(",
"node",
",",
"default_value",
"=",
"''",
",",
"default_flags",
"=",
"vsflags",
"(",
")",
")",
":",
"name",
"=",
"__get_attribute",
"(",
"node",
",",
"'Name'",
")",
"logging",
".",
"debug",
"(",
"'Found %s named %s'",
",",
"nod... | Converts a XML node to a JSON equivalent. | [
"Converts",
"a",
"XML",
"node",
"to",
"a",
"JSON",
"equivalent",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L299-L320 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __with_argument | def __with_argument(node, value):
"""Modifies the flags in value if the node contains an Argument."""
arguments = node.getElementsByTagName('Argument')
if arguments:
logging.debug('Found argument within %s', value['name'])
value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue) | python | def __with_argument(node, value):
"""Modifies the flags in value if the node contains an Argument."""
arguments = node.getElementsByTagName('Argument')
if arguments:
logging.debug('Found argument within %s', value['name'])
value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue) | [
"def",
"__with_argument",
"(",
"node",
",",
"value",
")",
":",
"arguments",
"=",
"node",
".",
"getElementsByTagName",
"(",
"'Argument'",
")",
"if",
"arguments",
":",
"logging",
".",
"debug",
"(",
"'Found argument within %s'",
",",
"value",
"[",
"'name'",
"]",
... | Modifies the flags in value if the node contains an Argument. | [
"Modifies",
"the",
"flags",
"in",
"value",
"if",
"the",
"node",
"contains",
"an",
"Argument",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L336-L342 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __preprocess_arguments | def __preprocess_arguments(root):
"""Preprocesses occurrences of Argument within the root.
Argument XML values reference other values within the document by name. The
referenced value does not contain a switch. This function will add the
switch associated with the argument.
"""
# Set the flags ... | python | def __preprocess_arguments(root):
"""Preprocesses occurrences of Argument within the root.
Argument XML values reference other values within the document by name. The
referenced value does not contain a switch. This function will add the
switch associated with the argument.
"""
# Set the flags ... | [
"def",
"__preprocess_arguments",
"(",
"root",
")",
":",
"# Set the flags to require a value",
"flags",
"=",
"','",
".",
"join",
"(",
"vsflags",
"(",
"VSFlags",
".",
"UserValueRequired",
")",
")",
"# Search through the arguments",
"arguments",
"=",
"root",
".",
"getE... | Preprocesses occurrences of Argument within the root.
Argument XML values reference other values within the document by name. The
referenced value does not contain a switch. This function will add the
switch associated with the argument. | [
"Preprocesses",
"occurrences",
"of",
"Argument",
"within",
"the",
"root",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L345-L387 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __get_attribute | def __get_attribute(node, name, default_value=''):
"""Retrieves the attribute of the given name from the node.
If not present then the default_value is used.
"""
if node.hasAttribute(name):
return node.attributes[name].value.strip()
else:
return default_value | python | def __get_attribute(node, name, default_value=''):
"""Retrieves the attribute of the given name from the node.
If not present then the default_value is used.
"""
if node.hasAttribute(name):
return node.attributes[name].value.strip()
else:
return default_value | [
"def",
"__get_attribute",
"(",
"node",
",",
"name",
",",
"default_value",
"=",
"''",
")",
":",
"if",
"node",
".",
"hasAttribute",
"(",
"name",
")",
":",
"return",
"node",
".",
"attributes",
"[",
"name",
"]",
".",
"value",
".",
"strip",
"(",
")",
"els... | Retrieves the attribute of the given name from the node.
If not present then the default_value is used. | [
"Retrieves",
"the",
"attribute",
"of",
"the",
"given",
"name",
"from",
"the",
"node",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L390-L398 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __get_path | def __get_path(path):
"""Gets the path to the file."""
if not os.path.isabs(path):
path = os.path.join(os.getcwd(), path)
return os.path.normpath(path) | python | def __get_path(path):
"""Gets the path to the file."""
if not os.path.isabs(path):
path = os.path.join(os.getcwd(), path)
return os.path.normpath(path) | [
"def",
"__get_path",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getcwd",
"(",
")",
",",
"path",
")",
"return",
"os",
".",
"path",
"... | Gets the path to the file. | [
"Gets",
"the",
"path",
"to",
"the",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L403-L408 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __output_path | def __output_path(toolchain, rule, output_dir):
"""Gets the output path for a file given the toolchain, rule and output_dir"""
filename = '%s_%s.json' % (toolchain, rule)
return os.path.join(output_dir, filename) | python | def __output_path(toolchain, rule, output_dir):
"""Gets the output path for a file given the toolchain, rule and output_dir"""
filename = '%s_%s.json' % (toolchain, rule)
return os.path.join(output_dir, filename) | [
"def",
"__output_path",
"(",
"toolchain",
",",
"rule",
",",
"output_dir",
")",
":",
"filename",
"=",
"'%s_%s.json'",
"%",
"(",
"toolchain",
",",
"rule",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"filename",
")"
] | Gets the output path for a file given the toolchain, rule and output_dir | [
"Gets",
"the",
"output",
"path",
"for",
"a",
"file",
"given",
"the",
"toolchain",
"rule",
"and",
"output_dir"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L411-L414 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __write_json_file | def __write_json_file(path, values):
"""Writes a JSON file at the path with the values provided."""
# Sort the keys to ensure ordering
sort_order = ['name', 'switch', 'comment', 'value', 'flags']
sorted_values = [
OrderedDict(
sorted(
value.items(), key=lambda value: ... | python | def __write_json_file(path, values):
"""Writes a JSON file at the path with the values provided."""
# Sort the keys to ensure ordering
sort_order = ['name', 'switch', 'comment', 'value', 'flags']
sorted_values = [
OrderedDict(
sorted(
value.items(), key=lambda value: ... | [
"def",
"__write_json_file",
"(",
"path",
",",
"values",
")",
":",
"# Sort the keys to ensure ordering",
"sort_order",
"=",
"[",
"'name'",
",",
"'switch'",
",",
"'comment'",
",",
"'value'",
",",
"'flags'",
"]",
"sorted_values",
"=",
"[",
"OrderedDict",
"(",
"sort... | Writes a JSON file at the path with the values provided. | [
"Writes",
"a",
"JSON",
"file",
"at",
"the",
"path",
"with",
"the",
"values",
"provided",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L425-L437 | train |
apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __append_list | def __append_list(append_to, value):
"""Appends the value to the list."""
if value is not None:
if isinstance(value, list):
append_to.extend(value)
else:
append_to.append(value) | python | def __append_list(append_to, value):
"""Appends the value to the list."""
if value is not None:
if isinstance(value, list):
append_to.extend(value)
else:
append_to.append(value) | [
"def",
"__append_list",
"(",
"append_to",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"append_to",
".",
"extend",
"(",
"value",
")",
"else",
":",
"append_to",
".",
"append",
... | Appends the value to the list. | [
"Appends",
"the",
"value",
"to",
"the",
"list",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L442-L448 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/__init__.py | decompile_func | def decompile_func(func):
'''
Decompile a function into ast.FunctionDef node.
:param func: python function (can not be a built-in)
:return: ast.FunctionDef instance.
'''
code = func.__code__
# For python 3
# defaults = func.func_defaults if sys.version_info.major < 3 else func.... | python | def decompile_func(func):
'''
Decompile a function into ast.FunctionDef node.
:param func: python function (can not be a built-in)
:return: ast.FunctionDef instance.
'''
code = func.__code__
# For python 3
# defaults = func.func_defaults if sys.version_info.major < 3 else func.... | [
"def",
"decompile_func",
"(",
"func",
")",
":",
"code",
"=",
"func",
".",
"__code__",
"# For python 3",
"# defaults = func.func_defaults if sys.version_info.major < 3 else func.__defaults__",
"# if defaults:",
"# default_names = code.co_varnames[:code.co_argcount][-len(defau... | Decompile a function into ast.FunctionDef node.
:param func: python function (can not be a built-in)
:return: ast.FunctionDef instance. | [
"Decompile",
"a",
"function",
"into",
"ast",
".",
"FunctionDef",
"node",
".",
":",
"param",
"func",
":",
"python",
"function",
"(",
"can",
"not",
"be",
"a",
"built",
"-",
"in",
")",
":",
"return",
":",
"ast",
".",
"FunctionDef",
"instance",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/__init__.py#L25-L44 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/__init__.py | compile_func | def compile_func(ast_node, filename, globals, **defaults):
'''
Compile a function from an ast.FunctionDef instance.
:param ast_node: ast.FunctionDef instance
:param filename: path where function source can be found.
:param globals: will be used as func_globals
:return: A python functi... | python | def compile_func(ast_node, filename, globals, **defaults):
'''
Compile a function from an ast.FunctionDef instance.
:param ast_node: ast.FunctionDef instance
:param filename: path where function source can be found.
:param globals: will be used as func_globals
:return: A python functi... | [
"def",
"compile_func",
"(",
"ast_node",
",",
"filename",
",",
"globals",
",",
"*",
"*",
"defaults",
")",
":",
"function_name",
"=",
"ast_node",
".",
"name",
"module",
"=",
"_ast",
".",
"Module",
"(",
"body",
"=",
"[",
"ast_node",
"]",
")",
"ctx",
"=",
... | Compile a function from an ast.FunctionDef instance.
:param ast_node: ast.FunctionDef instance
:param filename: path where function source can be found.
:param globals: will be used as func_globals
:return: A python function object | [
"Compile",
"a",
"function",
"from",
"an",
"ast",
".",
"FunctionDef",
"instance",
".",
":",
"param",
"ast_node",
":",
"ast",
".",
"FunctionDef",
"instance",
":",
"param",
"filename",
":",
"path",
"where",
"function",
"source",
"can",
"be",
"found",
".",
":"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/__init__.py#L46-L68 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/__init__.py | decompile_pyc | def decompile_pyc(bin_pyc, output=sys.stdout):
'''
decompile apython pyc or pyo binary file.
:param bin_pyc: input file objects
:param output: output file objects
'''
from turicreate.meta.asttools import python_source
bin = bin_pyc.read()
code = marshal.loads(bin[8:])... | python | def decompile_pyc(bin_pyc, output=sys.stdout):
'''
decompile apython pyc or pyo binary file.
:param bin_pyc: input file objects
:param output: output file objects
'''
from turicreate.meta.asttools import python_source
bin = bin_pyc.read()
code = marshal.loads(bin[8:])... | [
"def",
"decompile_pyc",
"(",
"bin_pyc",
",",
"output",
"=",
"sys",
".",
"stdout",
")",
":",
"from",
"turicreate",
".",
"meta",
".",
"asttools",
"import",
"python_source",
"bin",
"=",
"bin_pyc",
".",
"read",
"(",
")",
"code",
"=",
"marshal",
".",
"loads",... | decompile apython pyc or pyo binary file.
:param bin_pyc: input file objects
:param output: output file objects | [
"decompile",
"apython",
"pyc",
"or",
"pyo",
"binary",
"file",
".",
":",
"param",
"bin_pyc",
":",
"input",
"file",
"objects",
":",
"param",
"output",
":",
"output",
"file",
"objects"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/__init__.py#L89-L105 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | MacroCollection.ParseInput | def ParseInput(self, a_file):
"""Consumes input extracting definitions.
Args:
a_file: The file like stream to parse.
Raises:
PDDMError if there are any issues.
"""
input_lines = a_file.read().splitlines()
self.ParseLines(input_lines) | python | def ParseInput(self, a_file):
"""Consumes input extracting definitions.
Args:
a_file: The file like stream to parse.
Raises:
PDDMError if there are any issues.
"""
input_lines = a_file.read().splitlines()
self.ParseLines(input_lines) | [
"def",
"ParseInput",
"(",
"self",
",",
"a_file",
")",
":",
"input_lines",
"=",
"a_file",
".",
"read",
"(",
")",
".",
"splitlines",
"(",
")",
"self",
".",
"ParseLines",
"(",
"input_lines",
")"
] | Consumes input extracting definitions.
Args:
a_file: The file like stream to parse.
Raises:
PDDMError if there are any issues. | [
"Consumes",
"input",
"extracting",
"definitions",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L182-L192 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | MacroCollection.ParseLines | def ParseLines(self, input_lines):
"""Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues.
"""
current_macro = None
for line in input_lines:
if line.startswith(... | python | def ParseLines(self, input_lines):
"""Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues.
"""
current_macro = None
for line in input_lines:
if line.startswith(... | [
"def",
"ParseLines",
"(",
"self",
",",
"input_lines",
")",
":",
"current_macro",
"=",
"None",
"for",
"line",
"in",
"input_lines",
":",
"if",
"line",
".",
"startswith",
"(",
"'PDDM-'",
")",
":",
"directive",
"=",
"line",
".",
"split",
"(",
"' '",
",",
"... | Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues. | [
"Parses",
"list",
"of",
"lines",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L194-L232 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | MacroCollection.Expand | def Expand(self, macro_ref_str):
"""Expands the macro reference.
Args:
macro_ref_str: String of a macro reference (i.e. foo(a, b)).
Returns:
The text from the expansion.
Raises:
PDDMError if there are any issues.
"""
match = _MACRO_RE.match(macro_ref_str)
if match is Non... | python | def Expand(self, macro_ref_str):
"""Expands the macro reference.
Args:
macro_ref_str: String of a macro reference (i.e. foo(a, b)).
Returns:
The text from the expansion.
Raises:
PDDMError if there are any issues.
"""
match = _MACRO_RE.match(macro_ref_str)
if match is Non... | [
"def",
"Expand",
"(",
"self",
",",
"macro_ref_str",
")",
":",
"match",
"=",
"_MACRO_RE",
".",
"match",
"(",
"macro_ref_str",
")",
"if",
"match",
"is",
"None",
"or",
"match",
".",
"group",
"(",
"0",
")",
"!=",
"macro_ref_str",
":",
"raise",
"PDDMError",
... | Expands the macro reference.
Args:
macro_ref_str: String of a macro reference (i.e. foo(a, b)).
Returns:
The text from the expansion.
Raises:
PDDMError if there are any issues. | [
"Expands",
"the",
"macro",
"reference",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L259-L276 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | SourceFile.ProcessContent | def ProcessContent(self, strip_expansion=False):
"""Processes the file contents."""
self._ParseFile()
if strip_expansion:
# Without a collection the expansions become blank, removing them.
collection = None
else:
collection = MacroCollection()
for section in self._sections:
s... | python | def ProcessContent(self, strip_expansion=False):
"""Processes the file contents."""
self._ParseFile()
if strip_expansion:
# Without a collection the expansions become blank, removing them.
collection = None
else:
collection = MacroCollection()
for section in self._sections:
s... | [
"def",
"ProcessContent",
"(",
"self",
",",
"strip_expansion",
"=",
"False",
")",
":",
"self",
".",
"_ParseFile",
"(",
")",
"if",
"strip_expansion",
":",
"# Without a collection the expansions become blank, removing them.",
"collection",
"=",
"None",
"else",
":",
"coll... | Processes the file contents. | [
"Processes",
"the",
"file",
"contents",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L601-L614 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_standard_scaler.py | convert | def convert(model, input_features, output_features):
"""Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Retur... | python | def convert(model, input_features, output_features):
"""Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Retur... | [
"def",
"convert",
"(",
"model",
",",
"input_features",
",",
"output_features",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"# Test the scikit-learn model",
"... | Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Returns
-------
model_spec: An object of type Model_pb.
... | [
"Convert",
"a",
"_imputer",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_standard_scaler.py#L24-L64 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | reset | def reset ():
""" Clear the module state. This is mainly for testing purposes.
"""
global __all_attributes, __all_features, __implicit_features, __composite_properties
global __subfeature_from_value, __all_top_features, __free_features
global __all_subfeatures
# sets the default value of False ... | python | def reset ():
""" Clear the module state. This is mainly for testing purposes.
"""
global __all_attributes, __all_features, __implicit_features, __composite_properties
global __subfeature_from_value, __all_top_features, __free_features
global __all_subfeatures
# sets the default value of False ... | [
"def",
"reset",
"(",
")",
":",
"global",
"__all_attributes",
",",
"__all_features",
",",
"__implicit_features",
",",
"__composite_properties",
"global",
"__subfeature_from_value",
",",
"__all_top_features",
",",
"__free_features",
"global",
"__all_subfeatures",
"# sets the ... | Clear the module state. This is mainly for testing purposes. | [
"Clear",
"the",
"module",
"state",
".",
"This",
"is",
"mainly",
"for",
"testing",
"purposes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L85-L116 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | feature | def feature (name, values, attributes = []):
""" Declares a new feature with the given name, values, and attributes.
name: the feature name
values: a sequence of the allowable values - may be extended later with feature.extend
attributes: a sequence of the feature's attributes (e.g. implicit... | python | def feature (name, values, attributes = []):
""" Declares a new feature with the given name, values, and attributes.
name: the feature name
values: a sequence of the allowable values - may be extended later with feature.extend
attributes: a sequence of the feature's attributes (e.g. implicit... | [
"def",
"feature",
"(",
"name",
",",
"values",
",",
"attributes",
"=",
"[",
"]",
")",
":",
"__validate_feature_attributes",
"(",
"name",
",",
"attributes",
")",
"feature",
"=",
"Feature",
"(",
"name",
",",
"[",
"]",
",",
"attributes",
")",
"__all_features",... | Declares a new feature with the given name, values, and attributes.
name: the feature name
values: a sequence of the allowable values - may be extended later with feature.extend
attributes: a sequence of the feature's attributes (e.g. implicit, free, propagated, ...) | [
"Declares",
"a",
"new",
"feature",
"with",
"the",
"given",
"name",
"values",
"and",
"attributes",
".",
"name",
":",
"the",
"feature",
"name",
"values",
":",
"a",
"sequence",
"of",
"the",
"allowable",
"values",
"-",
"may",
"be",
"extended",
"later",
"with",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L136-L162 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | set_default | def set_default (feature, value):
""" Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign
"""
f = __all_features[feature]
bad_attribute = None
if f.free:
bad_attribute = "free"
... | python | def set_default (feature, value):
""" Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign
"""
f = __all_features[feature]
bad_attribute = None
if f.free:
bad_attribute = "free"
... | [
"def",
"set_default",
"(",
"feature",
",",
"value",
")",
":",
"f",
"=",
"__all_features",
"[",
"feature",
"]",
"bad_attribute",
"=",
"None",
"if",
"f",
".",
"free",
":",
"bad_attribute",
"=",
"\"free\"",
"elif",
"f",
".",
"optional",
":",
"bad_attribute",
... | Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign | [
"Sets",
"the",
"default",
"value",
"of",
"the",
"given",
"feature",
"overriding",
"any",
"previous",
"default",
".",
"feature",
":",
"the",
"name",
"of",
"the",
"feature",
"value",
":",
"the",
"default",
"value",
"to",
"assign"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L165-L184 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | defaults | def defaults(features):
""" Returns the default property values for the given features.
"""
assert is_iterable_typed(features, Feature)
# FIXME: should merge feature and property modules.
from . import property
result = []
for f in features:
if not f.free and not f.optional and f.de... | python | def defaults(features):
""" Returns the default property values for the given features.
"""
assert is_iterable_typed(features, Feature)
# FIXME: should merge feature and property modules.
from . import property
result = []
for f in features:
if not f.free and not f.optional and f.de... | [
"def",
"defaults",
"(",
"features",
")",
":",
"assert",
"is_iterable_typed",
"(",
"features",
",",
"Feature",
")",
"# FIXME: should merge feature and property modules.",
"from",
".",
"import",
"property",
"result",
"=",
"[",
"]",
"for",
"f",
"in",
"features",
":",... | Returns the default property values for the given features. | [
"Returns",
"the",
"default",
"property",
"values",
"for",
"the",
"given",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L186-L198 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | valid | def valid (names):
""" Returns true iff all elements of names are valid features.
"""
if isinstance(names, str):
names = [names]
assert is_iterable_typed(names, basestring)
return all(name in __all_features for name in names) | python | def valid (names):
""" Returns true iff all elements of names are valid features.
"""
if isinstance(names, str):
names = [names]
assert is_iterable_typed(names, basestring)
return all(name in __all_features for name in names) | [
"def",
"valid",
"(",
"names",
")",
":",
"if",
"isinstance",
"(",
"names",
",",
"str",
")",
":",
"names",
"=",
"[",
"names",
"]",
"assert",
"is_iterable_typed",
"(",
"names",
",",
"basestring",
")",
"return",
"all",
"(",
"name",
"in",
"__all_features",
... | Returns true iff all elements of names are valid features. | [
"Returns",
"true",
"iff",
"all",
"elements",
"of",
"names",
"are",
"valid",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L200-L207 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | values | def values (feature):
""" Return the values of the given feature.
"""
assert isinstance(feature, basestring)
validate_feature (feature)
return __all_features[feature].values | python | def values (feature):
""" Return the values of the given feature.
"""
assert isinstance(feature, basestring)
validate_feature (feature)
return __all_features[feature].values | [
"def",
"values",
"(",
"feature",
")",
":",
"assert",
"isinstance",
"(",
"feature",
",",
"basestring",
")",
"validate_feature",
"(",
"feature",
")",
"return",
"__all_features",
"[",
"feature",
"]",
".",
"values"
] | Return the values of the given feature. | [
"Return",
"the",
"values",
"of",
"the",
"given",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L215-L220 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | is_implicit_value | def is_implicit_value (value_string):
""" Returns true iff 'value_string' is a value_string
of an implicit feature.
"""
assert isinstance(value_string, basestring)
if value_string in __implicit_features:
return __implicit_features[value_string]
v = value_string.split('-')
if v[0] n... | python | def is_implicit_value (value_string):
""" Returns true iff 'value_string' is a value_string
of an implicit feature.
"""
assert isinstance(value_string, basestring)
if value_string in __implicit_features:
return __implicit_features[value_string]
v = value_string.split('-')
if v[0] n... | [
"def",
"is_implicit_value",
"(",
"value_string",
")",
":",
"assert",
"isinstance",
"(",
"value_string",
",",
"basestring",
")",
"if",
"value_string",
"in",
"__implicit_features",
":",
"return",
"__implicit_features",
"[",
"value_string",
"]",
"v",
"=",
"value_string... | Returns true iff 'value_string' is a value_string
of an implicit feature. | [
"Returns",
"true",
"iff",
"value_string",
"is",
"a",
"value_string",
"of",
"an",
"implicit",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L222-L241 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.