partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _SampleTransformer._get_summary_struct | 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... | src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py | 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):
"""
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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_feature_engineering.py#L392-L415 | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"section",
"=",
"[",
"]",
"section_titles",
"=",
"[",
"'Attributes'",
"]",
"for",
"f",
"in",
"self",
".",
"_list_fields",
"(",
")",
":",
"section",
".",
"append",
"(",
"(",
"\"%s\"",
"%",
"f",
",",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TreeModelMixin.extract_features | 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... | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | 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'):
"""
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... | [
"For",
"each",
"example",
"in",
"the",
"dataset",
"extract",
"the",
"leaf",
"indices",
"of",
"each",
"tree",
"as",
"features",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L65-L120 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TreeModelMixin._extract_features_with_missing | 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 ... | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | 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 features along with all the missing features associated with
a dataset.
Parameters
----------
dataset: bool
Dataset on which to make predict... | [
"Extract",
"features",
"along",
"with",
"all",
"the",
"missing",
"features",
"associated",
"with",
"a",
"dataset",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L122-L189 | [
"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",
".",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TreeModelMixin._dump_to_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... | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | 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):
"""
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... | [
"Dump",
"the",
"models",
"into",
"a",
"list",
"of",
"strings",
".",
"Each",
"string",
"is",
"a",
"text",
"representation",
"of",
"a",
"tree",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L192-L208 | [
"def",
"_dump_to_text",
"(",
"self",
",",
"with_stats",
")",
":",
"return",
"tc",
".",
"extensions",
".",
"_xgboost_dump_model",
"(",
"self",
".",
"__proxy__",
",",
"with_stats",
"=",
"with_stats",
",",
"format",
"=",
"'text'",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TreeModelMixin._dump_to_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... | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | 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):
"""
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... | [
"Dump",
"the",
"models",
"into",
"a",
"list",
"of",
"strings",
".",
"Each",
"string",
"is",
"a",
"text",
"representation",
"of",
"a",
"tree",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L210-L247 | [
"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'",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TreeModelMixin._get_summary_struct | 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... | src/unity/python/turicreate/toolkits/_tree_model_mixin.py | 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):
"""
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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_tree_model_mixin.py#L279-L315 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | 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
-------
... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_regressor.py | 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):
"""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
... | [
"Convert",
"a",
"boosted",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_regressor.py#L19-L58 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _sort_topk_votes | Sort a dictionary of classes and corresponding vote totals according to the
votes, then truncate to the highest 'k' classes. | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
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] | [
"Sort",
"a",
"dictionary",
"of",
"classes",
"and",
"corresponding",
"vote",
"totals",
"according",
"to",
"the",
"votes",
"then",
"truncate",
"to",
"the",
"highest",
"k",
"classes",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L33-L39 | [
"def",
"_sort_topk_votes",
"(",
"x",
",",
"k",
")",
":",
"y",
"=",
"sorted",
"(",
"x",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
",",
"reverse",
"=",
"True",
")",
"[",
":",
"k",
"]",
"return",
"[",
"{"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _construct_auto_distance | 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... | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
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... | [
"Construct",
"a",
"composite",
"distance",
"function",
"for",
"a",
"set",
"of",
"features",
"based",
"on",
"the",
"types",
"of",
"those",
"features",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L42-L108 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | 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... | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
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... | [
"Create",
"a",
":",
"class",
":",
"~turicreate",
".",
"nearest_neighbor_classifier",
".",
"NearestNeighborClassifier",
"model",
".",
"This",
"model",
"predicts",
"the",
"class",
"of",
"a",
"query",
"instance",
"by",
"finding",
"the",
"most",
"common",
"class",
"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L115-L314 | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"features",
"=",
"None",
",",
"distance",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"## Set up",
"## ------",
"start_time",
"=",
"_time",
".",
"time",
"(",
")",
"## Validation and preprocessing",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborClassifier._load_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 writer. | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
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... | [
"A",
"function",
"to",
"load",
"a",
"previously",
"saved",
"NearestNeighborClassifier",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L353-L369 | [
"def",
"_load_version",
"(",
"cls",
",",
"state",
",",
"version",
")",
":",
"assert",
"(",
"version",
"==",
"cls",
".",
"_PYTHON_NN_CLASSIFIER_MODEL_VERSION",
")",
"knn_model",
"=",
"_tc",
".",
"nearest_neighbors",
".",
"NearestNeighborsModel",
"(",
"state",
"["... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborClassifier.classify | 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... | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
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
----------
... | [
"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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L421-L533 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborClassifier.predict | 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 ... | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
Return predicted class labels for instances in *dataset*. This model
makes predictions based on the closest neighbors stored in the nearest
neighbors classifier model.
... | [
"Return",
"predicted",
"class",
"labels",
"for",
"instances",
"in",
"*",
"dataset",
"*",
".",
"This",
"model",
"makes",
"predictions",
"based",
"on",
"the",
"closest",
"neighbors",
"stored",
"in",
"the",
"nearest",
"neighbors",
"classifier",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L535-L610 | [
"def",
"predict",
"(",
"self",
",",
"dataset",
",",
"max_neighbors",
"=",
"10",
",",
"radius",
"=",
"None",
",",
"output_type",
"=",
"'class'",
",",
"verbose",
"=",
"True",
")",
":",
"ystar",
"=",
"self",
".",
"classify",
"(",
"dataset",
"=",
"dataset"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborClassifier.predict_topk | 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... | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
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`.
... | [
"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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L612-L731 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborClassifier.evaluate | 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
... | src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py | 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):
"""
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... | [
"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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L734-L847 | [
"def",
"evaluate",
"(",
"self",
",",
"dataset",
",",
"metric",
"=",
"'auto'",
",",
"max_neighbors",
"=",
"10",
",",
"radius",
"=",
"None",
")",
":",
"## Validate the metric name",
"_raise_error_evaluation_metric_is_valid",
"(",
"metric",
",",
"[",
"'auto'",
",",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TransformerChain._compact_class_repr | A compact version of __repr__ for each of the steps. | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | 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):
""" 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_... | [
"A",
"compact",
"version",
"of",
"__repr__",
"for",
"each",
"of",
"the",
"steps",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L126-L165 | [
"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"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TransformerChain._preprocess | Internal function to perform fit_transform() on all but last step. | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | 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):
"""
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... | [
"Internal",
"function",
"to",
"perform",
"fit_transform",
"()",
"on",
"all",
"but",
"last",
"step",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L192-L203 | [
"def",
"_preprocess",
"(",
"self",
",",
"data",
")",
":",
"transformed_data",
"=",
"_copy",
"(",
"data",
")",
"for",
"name",
",",
"step",
"in",
"self",
".",
"_transformers",
"[",
":",
"-",
"1",
"]",
":",
"transformed_data",
"=",
"step",
".",
"fit_trans... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TransformerChain.fit | 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
-------... | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | 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):
"""
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... | [
"Fits",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L205-L233 | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_transformers",
":",
"return",
"transformed_data",
"=",
"self",
".",
"_preprocess",
"(",
"data",
")",
"final_step",
"=",
"self",
".",
"_transformers",
"[",
"-",
"1",
"]",
"fin... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TransformerChain.fit_transform | 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... | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | 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):
"""
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.
... | [
"First",
"fit",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"and",
"then",
"return",
"a",
"transformed",
"version",
"of",
"data",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L235-L271 | [
"def",
"fit_transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_transformers",
":",
"return",
"self",
".",
"_preprocess",
"(",
"data",
")",
"transformed_data",
"=",
"self",
".",
"_preprocess",
"(",
"data",
")",
"final_step",
"=",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TransformerChain.transform | 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
... | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | 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):
"""
Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
... | [
"Transform",
"the",
"SFrame",
"data",
"using",
"a",
"fitted",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L273-L308 | [
"def",
"transform",
"(",
"self",
",",
"data",
")",
":",
"transformed_data",
"=",
"_copy",
"(",
"data",
")",
"for",
"name",
",",
"step",
"in",
"self",
".",
"_transformers",
":",
"transformed_data",
"=",
"step",
".",
"transform",
"(",
"transformed_data",
")"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | TransformerChain._load_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. | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | 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):
"""
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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L348-L361 | [
"def",
"_load_version",
"(",
"cls",
",",
"unpickler",
",",
"version",
")",
":",
"obj",
"=",
"unpickler",
".",
"load",
"(",
")",
"return",
"TransformerChain",
"(",
"obj",
".",
"_state",
"[",
"\"steps\"",
"]",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | 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... | src/unity/python/turicreate/toolkits/graph_analytics/pagerank.py | 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):
"""
Compute the PageRank for each vertex in the graph. Return a model object
with total PageRank as well as the Pag... | [
"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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/pagerank.py#L105-L191 | [
"def",
"create",
"(",
"graph",
",",
"reset_probability",
"=",
"0.15",
",",
"threshold",
"=",
"1e-2",
",",
"max_iterations",
"=",
"20",
",",
"_single_precision",
"=",
"False",
",",
"_distributed",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
")",
":",
"from"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | init | 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... | deps/src/boost_1_68_0/tools/build/src/tools/gcc.py | 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):
"""
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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/gcc.py#L87-L203 | [
"def",
"init",
"(",
"version",
"=",
"None",
",",
"command",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"options",
"=",
"to_seq",
"(",
"options",
")",
"command",
"=",
"to_seq",
"(",
"command",
")",
"# Information about the gcc command...",
"# The c... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | init_link_flags | Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun. | deps/src/boost_1_68_0/tools/build/src/tools/gcc.py | 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):
"""
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
... | [
"Now",
"the",
"vendor",
"specific",
"flags",
".",
"The",
"parameter",
"linker",
"can",
"be",
"either",
"gnu",
"darwin",
"osf",
"hpux",
"or",
"sun",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/gcc.py#L494-L608 | [
"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 ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Engine.add_dependency | Adds a dependency from 'targets' to 'sources'
Both 'targets' and 'sources' can be either list
of target names, or a single target name. | deps/src/boost_1_68_0/tools/build/src/build/engine.py | 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):
"""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... | [
"Adds",
"a",
"dependency",
"from",
"targets",
"to",
"sources"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L76-L91 | [
"def",
"add_dependency",
"(",
"self",
",",
"targets",
",",
"sources",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",
"sources",
",",
"str",
")",
":",
"sources",
"=",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Engine.get_target_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 of `variable` set on `targets` (list)
Example:
... | deps/src/boost_1_68_0/tools/build/src/build/engine.py | 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):
"""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... | [
"Gets",
"the",
"value",
"of",
"variable",
"on",
"set",
"on",
"the",
"first",
"target",
"in",
"targets",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L93-L121 | [
"def",
"get_target_variable",
"(",
"self",
",",
"targets",
",",
"variable",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"assert",
"is_iterable",
"(",
"targets",
")",
"assert",
"isinstance",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Engine.set_target_variable | 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'. | deps/src/boost_1_68_0/tools/build/src/build/engine.py | 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):
""" 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... | [
"Sets",
"a",
"target",
"variable",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L123-L143 | [
"def",
"set_target_variable",
"(",
"self",
",",
"targets",
",",
"variable",
",",
"value",
",",
"append",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",
"value"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Engine.set_update_action | 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. | deps/src/boost_1_68_0/tools/build/src/build/engine.py | 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):
""" 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
... | [
"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",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L145-L164 | [
"def",
"set_update_action",
"(",
"self",
",",
"action_name",
",",
"targets",
",",
"sources",
",",
"properties",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Engine.register_action | 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... | deps/src/boost_1_68_0/tools/build/src/build/engine.py | 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):
"""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... | [
"Creates",
"a",
"new",
"build",
"engine",
"action",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L166-L199 | [
"def",
"register_action",
"(",
"self",
",",
"action_name",
",",
"command",
"=",
"''",
",",
"bound_list",
"=",
"[",
"]",
",",
"flags",
"=",
"[",
"]",
",",
"function",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"action_name",
",",
"basestring",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Engine.register_bjam_action | 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. | deps/src/boost_1_68_0/tools/build/src/build/engine.py | 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):
"""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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L201-L216 | [
"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",
"#... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Image.pixel_data | 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).
... | src/unity/python/turicreate/data_structures/image.py | 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):
"""
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
... | [
"Returns",
"the",
"pixel",
"data",
"stored",
"in",
"the",
"Image",
"object",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/image.py#L141-L167 | [
"def",
"pixel_data",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"as",
"_extensions",
"data",
"=",
"_np",
".",
"zeros",
"(",
"(",
"self",
".",
"height",
",",
"self",
".",
"width",
",",
"self",
".",
"channels",
")",
",",
"dtype",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Image.show | 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... | src/unity/python/turicreate/data_structures/image.py | 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):
"""
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
-------... | [
"Displays",
"the",
"image",
".",
"Requires",
"PIL",
"/",
"Pillow",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/image.py#L218-L256 | [
"def",
"show",
"(",
"self",
")",
":",
"from",
".",
".",
"visualization",
".",
"_plot",
"import",
"_target",
"try",
":",
"img",
"=",
"self",
".",
"_to_pil_image",
"(",
")",
"try",
":",
"# output into jupyter notebook if possible",
"if",
"_target",
"==",
"'aut... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MLModel.predict | 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
... | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | 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):
"""
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
... | [
"Return",
"predictions",
"for",
"the",
"model",
".",
"The",
"kwargs",
"gets",
"passed",
"into",
"the",
"model",
"as",
"a",
"dictionary",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L300-L347 | [
"def",
"predict",
"(",
"self",
",",
"data",
",",
"useCPUOnly",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"__proxy__",
":",
"return",
"self",
".",
"__proxy__",
".",
"predict",
"(",
"data",
",",
"useCPUOnly",
")",
"else",
":",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MLModel.visualize_spec | 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... | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | 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):
"""
Visualize the model.
Parameters
----------
port : int
if server is to be hosted on specific localhost port
input_shape_dict : dict
The shapes are calculat... | [
"Visualize",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L349-L478 | [
"def",
"visualize_spec",
"(",
"self",
",",
"port",
"=",
"None",
",",
"input_shape_dict",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"_spec",
"model_type",
"=",
"spec",
".",
"WhichOneof",
"(",
"'Type'",
")",
"model_description",
"=",
"spec",
".",
"d... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _construct_auto_distance | Construct composite distance parameters based on selected features and their
types. | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
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... | [
"Construct",
"composite",
"distance",
"parameters",
"based",
"on",
"selected",
"features",
"and",
"their",
"types",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L33-L71 | [
"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",
"(... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | 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... | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
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 ... | [
"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",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L74-L584 | [
"def",
"create",
"(",
"dataset",
",",
"label",
"=",
"None",
",",
"features",
"=",
"None",
",",
"distance",
"=",
"None",
",",
"method",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"## Validate the 'dataset' input",
"_tku... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborsModel._get_summary_struct | 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... | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L619-L664 | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"model_fields",
"=",
"[",
"(",
"\"Method\"",
",",
"'method'",
")",
",",
"(",
"\"Number of distance components\"",
",",
"'num_distance_components'",
")",
",",
"(",
"\"Number of examples\"",
",",
"'num_examples'",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborsModel._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. | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
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... | [
"List",
"the",
"fields",
"stored",
"in",
"the",
"model",
"including",
"data",
"model",
"and",
"training",
"options",
".",
"Each",
"field",
"can",
"be",
"queried",
"with",
"the",
"get",
"method",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L675-L688 | [
"def",
"_list_fields",
"(",
"self",
")",
":",
"opts",
"=",
"{",
"'model'",
":",
"self",
".",
"__proxy__",
",",
"'model_name'",
":",
"self",
".",
"__name__",
"}",
"response",
"=",
"_turicreate",
".",
"extensions",
".",
"_nearest_neighbors",
".",
"list_fields"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborsModel._get | 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... | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
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.
+-----------------------+----------------------... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L690-L739 | [
"def",
"_get",
"(",
"self",
",",
"field",
")",
":",
"opts",
"=",
"{",
"'model'",
":",
"self",
".",
"__proxy__",
",",
"'model_name'",
":",
"self",
".",
"__name__",
",",
"'field'",
":",
"field",
"}",
"response",
"=",
"_turicreate",
".",
"extensions",
"."... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborsModel._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 ... | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
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
... | [
"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",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L741-L775 | [
"def",
"_training_stats",
"(",
"self",
")",
":",
"opts",
"=",
"{",
"'model'",
":",
"self",
".",
"__proxy__",
",",
"'model_name'",
":",
"self",
".",
"__name__",
"}",
"return",
"_turicreate",
".",
"extensions",
".",
"_nearest_neighbors",
".",
"training_stats",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborsModel.query | 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 ... | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
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
... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L777-L935 | [
"def",
"query",
"(",
"self",
",",
"dataset",
",",
"label",
"=",
"None",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"## Validate the 'dataset' input",
"_tkutl",
".",
"_raise_error_if_not_sframe",
"(",
"dataset",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NearestNeighborsModel.similarity_graph | 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.
... | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | 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):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model. This is conceptually very similar to
running `query` wit... | [
"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",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L937-L1060 | [
"def",
"similarity_graph",
"(",
"self",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"include_self_edges",
"=",
"False",
",",
"output_type",
"=",
"'SGraph'",
",",
"verbose",
"=",
"True",
")",
":",
"## Validate inputs.",
"if",
"k",
"is",
"not",
"N... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | random_split_by_session | 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 ... | src/unity/python/turicreate/toolkits/activity_classifier/util.py | 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):
"""
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
... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/util.py#L20-L104 | [
"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'",
")",
"_... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | read_msbuild_xml | Reads the MS Build XML file at the path and returns its contents.
Keyword arguments:
values -- The map to append the contents to (default {}) | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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={}):
"""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:
... | [
"Reads",
"the",
"MS",
"Build",
"XML",
"file",
"at",
"the",
"path",
"and",
"returns",
"its",
"contents",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L38-L76 | [
"def",
"read_msbuild_xml",
"(",
"path",
",",
"values",
"=",
"{",
"}",
")",
":",
"# Attempt to read the file contents",
"try",
":",
"document",
"=",
"parse",
"(",
"path",
")",
"except",
"Exception",
"as",
"e",
":",
"logging",
".",
"exception",
"(",
"'Could no... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | read_msbuild_json | Reads the MS Build JSON file at the path and returns its contents.
Keyword arguments:
values -- The list to append the contents to (default []) | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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=[]):
"""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... | [
"Reads",
"the",
"MS",
"Build",
"JSON",
"file",
"at",
"the",
"path",
"and",
"returns",
"its",
"contents",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L79-L97 | [
"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",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | main | Script entrypoint. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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():
"""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... | [
"Script",
"entrypoint",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L100-L168 | [
"def",
"main",
"(",
")",
":",
"# Parse the arguments",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Convert MSBuild XML to JSON format'",
")",
"parser",
".",
"add_argument",
"(",
"'-t'",
",",
"'--toolchain'",
",",
"help",
"=",
"'The... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __merge_json_values | Merges the values between the current and previous run of the script. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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:
... | [
"Merges",
"the",
"values",
"between",
"the",
"current",
"and",
"previous",
"run",
"of",
"the",
"script",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L173-L198 | [
"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",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __find_and_remove_value | Finds the value in the list that corresponds with the value of compare. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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'] ==
... | [
"Finds",
"the",
"value",
"in",
"the",
"list",
"that",
"corresponds",
"with",
"the",
"value",
"of",
"compare",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L201-L213 | [
"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'",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __convert | Converts the tag type found in the root and converts them using the func
and appends them to the values. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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... | [
"Converts",
"the",
"tag",
"type",
"found",
"in",
"the",
"root",
"and",
"converts",
"them",
"using",
"the",
"func",
"and",
"appends",
"them",
"to",
"the",
"values",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L218-L228 | [
"def",
"__convert",
"(",
"root",
",",
"tag",
",",
"values",
",",
"func",
")",
":",
"elements",
"=",
"root",
".",
"getElementsByTagName",
"(",
"tag",
")",
"for",
"element",
"in",
"elements",
":",
"converted",
"=",
"func",
"(",
"element",
")",
"# Append to... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __convert_enum | Converts an EnumProperty node to JSON format. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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... | [
"Converts",
"an",
"EnumProperty",
"node",
"to",
"JSON",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L231-L249 | [
"def",
"__convert_enum",
"(",
"node",
")",
":",
"name",
"=",
"__get_attribute",
"(",
"node",
",",
"'Name'",
")",
"logging",
".",
"debug",
"(",
"'Found EnumProperty named %s'",
",",
"name",
")",
"converted_values",
"=",
"[",
"]",
"for",
"value",
"in",
"node",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __convert_bool | Converts an BoolProperty node to JSON format. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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... | [
"Converts",
"an",
"BoolProperty",
"node",
"to",
"JSON",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L252-L270 | [
"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'",
")... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __convert_string_list | Converts a StringListProperty node to JSON format. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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... | [
"Converts",
"a",
"StringListProperty",
"node",
"to",
"JSON",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L273-L289 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __convert_string | Converts a StringProperty node to JSON format. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""Converts a StringProperty node to JSON format."""
converted = __convert_node(node, default_flags=vsflags(VSFlags.UserValue))
return __check_for_flag(converted) | [
"Converts",
"a",
"StringProperty",
"node",
"to",
"JSON",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L292-L296 | [
"def",
"__convert_string",
"(",
"node",
")",
":",
"converted",
"=",
"__convert_node",
"(",
"node",
",",
"default_flags",
"=",
"vsflags",
"(",
"VSFlags",
".",
"UserValue",
")",
")",
"return",
"__check_for_flag",
"(",
"converted",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __convert_node | Converts a XML node to a JSON equivalent. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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()):
"""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... | [
"Converts",
"a",
"XML",
"node",
"to",
"a",
"JSON",
"equivalent",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L299-L320 | [
"def",
"__convert_node",
"(",
"node",
",",
"default_value",
"=",
"''",
",",
"default_flags",
"=",
"vsflags",
"(",
")",
")",
":",
"name",
"=",
"__get_attribute",
"(",
"node",
",",
"'Name'",
")",
"logging",
".",
"debug",
"(",
"'Found %s named %s'",
",",
"nod... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __with_argument | Modifies the flags in value if the node contains an Argument. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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) | [
"Modifies",
"the",
"flags",
"in",
"value",
"if",
"the",
"node",
"contains",
"an",
"Argument",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L336-L342 | [
"def",
"__with_argument",
"(",
"node",
",",
"value",
")",
":",
"arguments",
"=",
"node",
".",
"getElementsByTagName",
"(",
"'Argument'",
")",
"if",
"arguments",
":",
"logging",
".",
"debug",
"(",
"'Found argument within %s'",
",",
"value",
"[",
"'name'",
"]",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __preprocess_arguments | 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. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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 ... | [
"Preprocesses",
"occurrences",
"of",
"Argument",
"within",
"the",
"root",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L345-L387 | [
"def",
"__preprocess_arguments",
"(",
"root",
")",
":",
"# Set the flags to require a value",
"flags",
"=",
"','",
".",
"join",
"(",
"vsflags",
"(",
"VSFlags",
".",
"UserValueRequired",
")",
")",
"# Search through the arguments",
"arguments",
"=",
"root",
".",
"getE... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __get_attribute | Retrieves the attribute of the given name from the node.
If not present then the default_value is used. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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=''):
"""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 | [
"Retrieves",
"the",
"attribute",
"of",
"the",
"given",
"name",
"from",
"the",
"node",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L390-L398 | [
"def",
"__get_attribute",
"(",
"node",
",",
"name",
",",
"default_value",
"=",
"''",
")",
":",
"if",
"node",
".",
"hasAttribute",
"(",
"name",
")",
":",
"return",
"node",
".",
"attributes",
"[",
"name",
"]",
".",
"value",
".",
"strip",
"(",
")",
"els... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __get_path | Gets the path to the file. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""Gets the path to the file."""
if not os.path.isabs(path):
path = os.path.join(os.getcwd(), path)
return os.path.normpath(path) | [
"Gets",
"the",
"path",
"to",
"the",
"file",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L403-L408 | [
"def",
"__get_path",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getcwd",
"(",
")",
",",
"path",
")",
"return",
"os",
".",
"path",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __output_path | Gets the output path for a file given the toolchain, rule and output_dir | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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) | [
"Gets",
"the",
"output",
"path",
"for",
"a",
"file",
"given",
"the",
"toolchain",
"rule",
"and",
"output_dir"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L411-L414 | [
"def",
"__output_path",
"(",
"toolchain",
",",
"rule",
",",
"output_dir",
")",
":",
"filename",
"=",
"'%s_%s.json'",
"%",
"(",
"toolchain",
",",
"rule",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"filename",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __write_json_file | Writes a JSON file at the path with the values provided. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""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: ... | [
"Writes",
"a",
"JSON",
"file",
"at",
"the",
"path",
"with",
"the",
"values",
"provided",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L425-L437 | [
"def",
"__write_json_file",
"(",
"path",
",",
"values",
")",
":",
"# Sort the keys to ensure ordering",
"sort_order",
"=",
"[",
"'name'",
",",
"'switch'",
",",
"'comment'",
",",
"'value'",
",",
"'flags'",
"]",
"sorted_values",
"=",
"[",
"OrderedDict",
"(",
"sort... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __append_list | Appends the value to the list. | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | 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):
"""Appends the value to the list."""
if value is not None:
if isinstance(value, list):
append_to.extend(value)
else:
append_to.append(value) | [
"Appends",
"the",
"value",
"to",
"the",
"list",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L442-L448 | [
"def",
"__append_list",
"(",
"append_to",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"append_to",
".",
"extend",
"(",
"value",
")",
"else",
":",
"append_to",
".",
"append",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | decompile_func | Decompile a function into ast.FunctionDef node.
:param func: python function (can not be a built-in)
:return: ast.FunctionDef instance. | src/unity/python/turicreate/meta/decompiler/__init__.py | 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):
'''
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.... | [
"Decompile",
"a",
"function",
"into",
"ast",
".",
"FunctionDef",
"node",
".",
":",
"param",
"func",
":",
"python",
"function",
"(",
"can",
"not",
"be",
"a",
"built",
"-",
"in",
")",
":",
"return",
":",
"ast",
".",
"FunctionDef",
"instance",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/__init__.py#L25-L44 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | compile_func | 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 | src/unity/python/turicreate/meta/decompiler/__init__.py | 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):
'''
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... | [
"Compile",
"a",
"function",
"from",
"an",
"ast",
".",
"FunctionDef",
"instance",
".",
":",
"param",
"ast_node",
":",
"ast",
".",
"FunctionDef",
"instance",
":",
"param",
"filename",
":",
"path",
"where",
"function",
"source",
"can",
"be",
"found",
".",
":"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/__init__.py#L46-L68 | [
"def",
"compile_func",
"(",
"ast_node",
",",
"filename",
",",
"globals",
",",
"*",
"*",
"defaults",
")",
":",
"function_name",
"=",
"ast_node",
".",
"name",
"module",
"=",
"_ast",
".",
"Module",
"(",
"body",
"=",
"[",
"ast_node",
"]",
")",
"ctx",
"=",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | decompile_pyc | decompile apython pyc or pyo binary file.
:param bin_pyc: input file objects
:param output: output file objects | src/unity/python/turicreate/meta/decompiler/__init__.py | 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):
'''
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:])... | [
"decompile",
"apython",
"pyc",
"or",
"pyo",
"binary",
"file",
".",
":",
"param",
"bin_pyc",
":",
"input",
"file",
"objects",
":",
"param",
"output",
":",
"output",
"file",
"objects"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/__init__.py#L89-L105 | [
"def",
"decompile_pyc",
"(",
"bin_pyc",
",",
"output",
"=",
"sys",
".",
"stdout",
")",
":",
"from",
"turicreate",
".",
"meta",
".",
"asttools",
"import",
"python_source",
"bin",
"=",
"bin_pyc",
".",
"read",
"(",
")",
"code",
"=",
"marshal",
".",
"loads",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MacroCollection.ParseInput | Consumes input extracting definitions.
Args:
a_file: The file like stream to parse.
Raises:
PDDMError if there are any issues. | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | 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):
"""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) | [
"Consumes",
"input",
"extracting",
"definitions",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L182-L192 | [
"def",
"ParseInput",
"(",
"self",
",",
"a_file",
")",
":",
"input_lines",
"=",
"a_file",
".",
"read",
"(",
")",
".",
"splitlines",
"(",
")",
"self",
".",
"ParseLines",
"(",
"input_lines",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MacroCollection.ParseLines | 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. | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | 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):
"""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(... | [
"Parses",
"list",
"of",
"lines",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L194-L232 | [
"def",
"ParseLines",
"(",
"self",
",",
"input_lines",
")",
":",
"current_macro",
"=",
"None",
"for",
"line",
"in",
"input_lines",
":",
"if",
"line",
".",
"startswith",
"(",
"'PDDM-'",
")",
":",
"directive",
"=",
"line",
".",
"split",
"(",
"' '",
",",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MacroCollection.Expand | 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. | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | 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):
"""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... | [
"Expands",
"the",
"macro",
"reference",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L259-L276 | [
"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",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SourceFile.ProcessContent | Processes the file contents. | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | 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):
"""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... | [
"Processes",
"the",
"file",
"contents",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L601-L614 | [
"def",
"ProcessContent",
"(",
"self",
",",
"strip_expansion",
"=",
"False",
")",
":",
"self",
".",
"_ParseFile",
"(",
")",
"if",
"strip_expansion",
":",
"# Without a collection the expansions become blank, removing them.",
"collection",
"=",
"None",
"else",
":",
"coll... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | 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.
... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_standard_scaler.py | 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):
"""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... | [
"Convert",
"a",
"_imputer",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_standard_scaler.py#L24-L64 | [
"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",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | reset | Clear the module state. This is mainly for testing purposes. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | 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 ():
""" 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 ... | [
"Clear",
"the",
"module",
"state",
".",
"This",
"is",
"mainly",
"for",
"testing",
"purposes",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L85-L116 | [
"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 ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | feature | 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, ...) | deps/src/boost_1_68_0/tools/build/src/build/feature.py | 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 = []):
""" 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... | [
"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",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L136-L162 | [
"def",
"feature",
"(",
"name",
",",
"values",
",",
"attributes",
"=",
"[",
"]",
")",
":",
"__validate_feature_attributes",
"(",
"name",
",",
"attributes",
")",
"feature",
"=",
"Feature",
"(",
"name",
",",
"[",
"]",
",",
"attributes",
")",
"__all_features",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | set_default | Sets the default value of the given feature, overriding any previous default.
feature: the name of the feature
value: the default value to assign | deps/src/boost_1_68_0/tools/build/src/build/feature.py | 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):
""" 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"
... | [
"Sets",
"the",
"default",
"value",
"of",
"the",
"given",
"feature",
"overriding",
"any",
"previous",
"default",
".",
"feature",
":",
"the",
"name",
"of",
"the",
"feature",
"value",
":",
"the",
"default",
"value",
"to",
"assign"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L165-L184 | [
"def",
"set_default",
"(",
"feature",
",",
"value",
")",
":",
"f",
"=",
"__all_features",
"[",
"feature",
"]",
"bad_attribute",
"=",
"None",
"if",
"f",
".",
"free",
":",
"bad_attribute",
"=",
"\"free\"",
"elif",
"f",
".",
"optional",
":",
"bad_attribute",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | defaults | Returns the default property values for the given features. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | 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):
""" 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... | [
"Returns",
"the",
"default",
"property",
"values",
"for",
"the",
"given",
"features",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L186-L198 | [
"def",
"defaults",
"(",
"features",
")",
":",
"assert",
"is_iterable_typed",
"(",
"features",
",",
"Feature",
")",
"# FIXME: should merge feature and property modules.",
"from",
".",
"import",
"property",
"result",
"=",
"[",
"]",
"for",
"f",
"in",
"features",
":",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | valid | Returns true iff all elements of names are valid features. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | 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):
""" 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) | [
"Returns",
"true",
"iff",
"all",
"elements",
"of",
"names",
"are",
"valid",
"features",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L200-L207 | [
"def",
"valid",
"(",
"names",
")",
":",
"if",
"isinstance",
"(",
"names",
",",
"str",
")",
":",
"names",
"=",
"[",
"names",
"]",
"assert",
"is_iterable_typed",
"(",
"names",
",",
"basestring",
")",
"return",
"all",
"(",
"name",
"in",
"__all_features",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | values | Return the values of the given feature. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | 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):
""" Return the values of the given feature.
"""
assert isinstance(feature, basestring)
validate_feature (feature)
return __all_features[feature].values | [
"Return",
"the",
"values",
"of",
"the",
"given",
"feature",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L215-L220 | [
"def",
"values",
"(",
"feature",
")",
":",
"assert",
"isinstance",
"(",
"feature",
",",
"basestring",
")",
"validate_feature",
"(",
"feature",
")",
"return",
"__all_features",
"[",
"feature",
"]",
".",
"values"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | is_implicit_value | Returns true iff 'value_string' is a value_string
of an implicit feature. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | 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):
""" 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... | [
"Returns",
"true",
"iff",
"value_string",
"is",
"a",
"value_string",
"of",
"an",
"implicit",
"feature",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L222-L241 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | implied_feature | Returns the implicit feature associated with the given implicit value. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def implied_feature (implicit_value):
""" Returns the implicit feature associated with the given implicit value.
"""
assert isinstance(implicit_value, basestring)
components = implicit_value.split('-')
if components[0] not in __implicit_features:
raise InvalidValue ("'%s' is not a value of ... | def implied_feature (implicit_value):
""" Returns the implicit feature associated with the given implicit value.
"""
assert isinstance(implicit_value, basestring)
components = implicit_value.split('-')
if components[0] not in __implicit_features:
raise InvalidValue ("'%s' is not a value of ... | [
"Returns",
"the",
"implicit",
"feature",
"associated",
"with",
"the",
"given",
"implicit",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L243-L252 | [
"def",
"implied_feature",
"(",
"implicit_value",
")",
":",
"assert",
"isinstance",
"(",
"implicit_value",
",",
"basestring",
")",
"components",
"=",
"implicit_value",
".",
"split",
"(",
"'-'",
")",
"if",
"components",
"[",
"0",
"]",
"not",
"in",
"__implicit_fe... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | validate_feature | Checks if all name is a valid feature. Otherwise, raises an exception. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def validate_feature (name):
""" Checks if all name is a valid feature. Otherwise, raises an exception.
"""
assert isinstance(name, basestring)
if name not in __all_features:
raise InvalidFeature ("'%s' is not a valid feature name" % name)
else:
return __all_features[name] | def validate_feature (name):
""" Checks if all name is a valid feature. Otherwise, raises an exception.
"""
assert isinstance(name, basestring)
if name not in __all_features:
raise InvalidFeature ("'%s' is not a valid feature name" % name)
else:
return __all_features[name] | [
"Checks",
"if",
"all",
"name",
"is",
"a",
"valid",
"feature",
".",
"Otherwise",
"raises",
"an",
"exception",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L281-L288 | [
"def",
"validate_feature",
"(",
"name",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"if",
"name",
"not",
"in",
"__all_features",
":",
"raise",
"InvalidFeature",
"(",
"\"'%s' is not a valid feature name\"",
"%",
"name",
")",
"else",
":"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __expand_subfeatures_aux | Helper for expand_subfeatures.
Given a feature and value, or just a value corresponding to an
implicit feature, returns a property set consisting of all component
subfeatures and their values. For example:
expand_subfeatures <toolset>gcc-2.95.2-linux-x86
-> <toolset>gcc ... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def __expand_subfeatures_aux (property_, dont_validate = False):
""" Helper for expand_subfeatures.
Given a feature and value, or just a value corresponding to an
implicit feature, returns a property set consisting of all component
subfeatures and their values. For example:
expand... | def __expand_subfeatures_aux (property_, dont_validate = False):
""" Helper for expand_subfeatures.
Given a feature and value, or just a value corresponding to an
implicit feature, returns a property set consisting of all component
subfeatures and their values. For example:
expand... | [
"Helper",
"for",
"expand_subfeatures",
".",
"Given",
"a",
"feature",
"and",
"value",
"or",
"just",
"a",
"value",
"corresponding",
"to",
"an",
"implicit",
"feature",
"returns",
"a",
"property",
"set",
"consisting",
"of",
"all",
"component",
"subfeatures",
"and",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L292-L336 | [
"def",
"__expand_subfeatures_aux",
"(",
"property_",
",",
"dont_validate",
"=",
"False",
")",
":",
"from",
".",
"import",
"property",
"# no __debug__ since Property is used elsewhere",
"assert",
"isinstance",
"(",
"property_",
",",
"property",
".",
"Property",
")",
"a... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | expand_subfeatures | Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<toolset>gcc <toolset-version>2.95.2 <toolset-os>linux <toolset-cpu>x86
... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def expand_subfeatures(properties, dont_validate = False):
"""
Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<too... | def expand_subfeatures(properties, dont_validate = False):
"""
Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<too... | [
"Make",
"all",
"elements",
"of",
"properties",
"corresponding",
"to",
"implicit",
"features",
"explicit",
"and",
"express",
"all",
"subfeature",
"values",
"as",
"separate",
"properties",
"in",
"their",
"own",
"right",
".",
"For",
"example",
"the",
"property"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L338-L367 | [
"def",
"expand_subfeatures",
"(",
"properties",
",",
"dont_validate",
"=",
"False",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"isinstance",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | extend | Adds the given values to the given feature. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def extend (name, values):
""" Adds the given values to the given feature.
"""
assert isinstance(name, basestring)
assert is_iterable_typed(values, basestring)
name = add_grist (name)
__validate_feature (name)
feature = __all_features [name]
if feature.implicit:
for v in values:... | def extend (name, values):
""" Adds the given values to the given feature.
"""
assert isinstance(name, basestring)
assert is_iterable_typed(values, basestring)
name = add_grist (name)
__validate_feature (name)
feature = __all_features [name]
if feature.implicit:
for v in values:... | [
"Adds",
"the",
"given",
"values",
"to",
"the",
"given",
"feature",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L389-L410 | [
"def",
"extend",
"(",
"name",
",",
"values",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"values",
",",
"basestring",
")",
"name",
"=",
"add_grist",
"(",
"name",
")",
"__validate_feature",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | validate_value_string | Checks that value-string is a valid value-string for the given feature. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def validate_value_string (f, value_string):
""" Checks that value-string is a valid value-string for the given feature.
"""
assert isinstance(f, Feature)
assert isinstance(value_string, basestring)
if f.free or value_string in f.values:
return
values = [value_string]
if f.subfeatu... | def validate_value_string (f, value_string):
""" Checks that value-string is a valid value-string for the given feature.
"""
assert isinstance(f, Feature)
assert isinstance(value_string, basestring)
if f.free or value_string in f.values:
return
values = [value_string]
if f.subfeatu... | [
"Checks",
"that",
"value",
"-",
"string",
"is",
"a",
"valid",
"value",
"-",
"string",
"for",
"the",
"given",
"feature",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L412-L434 | [
"def",
"validate_value_string",
"(",
"f",
",",
"value_string",
")",
":",
"assert",
"isinstance",
"(",
"f",
",",
"Feature",
")",
"assert",
"isinstance",
"(",
"value_string",
",",
"basestring",
")",
"if",
"f",
".",
"free",
"or",
"value_string",
"in",
"f",
".... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | subfeature | Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is specific to,
if any.
subfeature: The name of the subfeature ... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def subfeature (feature_name, value_string, subfeature, subvalues, attributes = []):
""" Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is spe... | def subfeature (feature_name, value_string, subfeature, subvalues, attributes = []):
""" Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is spe... | [
"Declares",
"a",
"subfeature",
".",
"feature_name",
":",
"Root",
"feature",
"that",
"is",
"not",
"a",
"subfeature",
".",
"value_string",
":",
"An",
"optional",
"value",
"-",
"string",
"specifying",
"which",
"feature",
"or",
"subfeature",
"values",
"this",
"sub... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L482-L509 | [
"def",
"subfeature",
"(",
"feature_name",
",",
"value_string",
",",
"subfeature",
",",
"subvalues",
",",
"attributes",
"=",
"[",
"]",
")",
":",
"parent_feature",
"=",
"validate_feature",
"(",
"feature_name",
")",
"# Add grist to the subfeature name if a value-string was... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | compose | Sets the components of the given composite property.
All parameters are <feature>value strings | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def compose (composite_property_s, component_properties_s):
""" Sets the components of the given composite property.
All parameters are <feature>value strings
"""
from . import property
component_properties_s = to_seq (component_properties_s)
composite_property = property.create_from_string(co... | def compose (composite_property_s, component_properties_s):
""" Sets the components of the given composite property.
All parameters are <feature>value strings
"""
from . import property
component_properties_s = to_seq (component_properties_s)
composite_property = property.create_from_string(co... | [
"Sets",
"the",
"components",
"of",
"the",
"given",
"composite",
"property",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L513-L538 | [
"def",
"compose",
"(",
"composite_property_s",
",",
"component_properties_s",
")",
":",
"from",
".",
"import",
"property",
"component_properties_s",
"=",
"to_seq",
"(",
"component_properties_s",
")",
"composite_property",
"=",
"property",
".",
"create_from_string",
"(",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_values | Returns all values of the given feature specified by the given property set. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def get_values (feature, properties):
""" Returns all values of the given feature specified by the given property set.
"""
if feature[0] != '<':
feature = '<' + feature + '>'
result = []
for p in properties:
if get_grist (p) == feature:
result.append (replace_grist (p, ''))
... | def get_values (feature, properties):
""" Returns all values of the given feature specified by the given property set.
"""
if feature[0] != '<':
feature = '<' + feature + '>'
result = []
for p in properties:
if get_grist (p) == feature:
result.append (replace_grist (p, ''))
... | [
"Returns",
"all",
"values",
"of",
"the",
"given",
"feature",
"specified",
"by",
"the",
"given",
"property",
"set",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L552-L562 | [
"def",
"get_values",
"(",
"feature",
",",
"properties",
")",
":",
"if",
"feature",
"[",
"0",
"]",
"!=",
"'<'",
":",
"feature",
"=",
"'<'",
"+",
"feature",
"+",
"'>'",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"properties",
":",
"if",
"get_grist",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | expand_composites | Expand all composite properties in the set so that all components
are explicitly expressed. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def expand_composites (properties):
""" Expand all composite properties in the set so that all components
are explicitly expressed.
"""
if __debug__:
from .property import Property
assert is_iterable_typed(properties, Property)
explicit_features = set(p.feature for p in propertie... | def expand_composites (properties):
""" Expand all composite properties in the set so that all components
are explicitly expressed.
"""
if __debug__:
from .property import Property
assert is_iterable_typed(properties, Property)
explicit_features = set(p.feature for p in propertie... | [
"Expand",
"all",
"composite",
"properties",
"in",
"the",
"set",
"so",
"that",
"all",
"components",
"are",
"explicitly",
"expressed",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L569-L606 | [
"def",
"expand_composites",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"explicit_features",
"=",
"set",
"(",
"p",
".",
"feature",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | is_subfeature_of | Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def is_subfeature_of (parent_property, f):
""" Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value.
"""
if __debug__:
from .property import Property
asse... | def is_subfeature_of (parent_property, f):
""" Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value.
"""
if __debug__:
from .property import Property
asse... | [
"Return",
"true",
"iff",
"f",
"is",
"an",
"ordinary",
"subfeature",
"of",
"the",
"parent_property",
"s",
"feature",
"or",
"if",
"f",
"is",
"a",
"subfeature",
"of",
"the",
"parent_property",
"s",
"feature",
"specific",
"to",
"the",
"parent_property",
"s",
"va... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L609-L635 | [
"def",
"is_subfeature_of",
"(",
"parent_property",
",",
"f",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"f",
",",
"Feature"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __is_subproperty_of | As is_subfeature_of, for subproperties. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def __is_subproperty_of (parent_property, p):
""" As is_subfeature_of, for subproperties.
"""
if __debug__:
from .property import Property
assert isinstance(parent_property, Property)
assert isinstance(p, Property)
return is_subfeature_of (parent_property, p.feature) | def __is_subproperty_of (parent_property, p):
""" As is_subfeature_of, for subproperties.
"""
if __debug__:
from .property import Property
assert isinstance(parent_property, Property)
assert isinstance(p, Property)
return is_subfeature_of (parent_property, p.feature) | [
"As",
"is_subfeature_of",
"for",
"subproperties",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L637-L644 | [
"def",
"__is_subproperty_of",
"(",
"parent_property",
",",
"p",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"p",
",",
"Prope... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | expand | Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
components of composite properti... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def expand (properties):
""" Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
... | def expand (properties):
""" Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
... | [
"Given",
"a",
"property",
"set",
"which",
"may",
"consist",
"of",
"composite",
"and",
"implicit",
"properties",
"and",
"combined",
"subfeature",
"values",
"returns",
"an",
"expanded",
"normalized",
"property",
"set",
"with",
"all",
"implicit",
"features",
"express... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L664-L679 | [
"def",
"expand",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"expanded",
"=",
"expand_subfeatures",
"(",
"properties",
")",
"return",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | add_defaults | Given a set of properties, add default values for features not
represented in the set.
Note: if there's there's ordinary feature F1 and composite feature
F2, which includes some value for F1, and both feature have default values,
then the default value of F1 will be added, not the value ... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def add_defaults (properties):
""" Given a set of properties, add default values for features not
represented in the set.
Note: if there's there's ordinary feature F1 and composite feature
F2, which includes some value for F1, and both feature have default values,
then the default va... | def add_defaults (properties):
""" Given a set of properties, add default values for features not
represented in the set.
Note: if there's there's ordinary feature F1 and composite feature
F2, which includes some value for F1, and both feature have default values,
then the default va... | [
"Given",
"a",
"set",
"of",
"properties",
"add",
"default",
"values",
"for",
"features",
"not",
"represented",
"in",
"the",
"set",
".",
"Note",
":",
"if",
"there",
"s",
"there",
"s",
"ordinary",
"feature",
"F1",
"and",
"composite",
"feature",
"F2",
"which",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L682-L722 | [
"def",
"add_defaults",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"# create a copy since properties will be modified",
"result",
"=",
"list... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | minimize | Given an expanded property set, eliminate all redundancy: properties
which are elements of other (composite) properties in the set will
be eliminated. Non-symmetric properties equal to default values will be
eliminated, unless the override a value from some composite property.
Implicit p... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def minimize (properties):
""" Given an expanded property set, eliminate all redundancy: properties
which are elements of other (composite) properties in the set will
be eliminated. Non-symmetric properties equal to default values will be
eliminated, unless the override a value from some com... | def minimize (properties):
""" Given an expanded property set, eliminate all redundancy: properties
which are elements of other (composite) properties in the set will
be eliminated. Non-symmetric properties equal to default values will be
eliminated, unless the override a value from some com... | [
"Given",
"an",
"expanded",
"property",
"set",
"eliminate",
"all",
"redundancy",
":",
"properties",
"which",
"are",
"elements",
"of",
"other",
"(",
"composite",
")",
"properties",
"in",
"the",
"set",
"will",
"be",
"eliminated",
".",
"Non",
"-",
"symmetric",
"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L724-L783 | [
"def",
"minimize",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"# remove properties implied by composite features",
"components",
"=",
"[",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | split | Given a property-set of the form
v1/v2/...vN-1/<fN>vN/<fN+1>vN+1/...<fM>vM
Returns
v1 v2 ... vN-1 <fN>vN <fN+1>vN+1 ... <fM>vM
Note that vN...vM may contain slashes. This is resilient to the
substitution of backslashes for slashes, since Jam, unbidden,
sometimes swaps slash direction o... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def split (properties):
""" Given a property-set of the form
v1/v2/...vN-1/<fN>vN/<fN+1>vN+1/...<fM>vM
Returns
v1 v2 ... vN-1 <fN>vN <fN+1>vN+1 ... <fM>vM
Note that vN...vM may contain slashes. This is resilient to the
substitution of backslashes for slashes, since Jam, unbidden,
s... | def split (properties):
""" Given a property-set of the form
v1/v2/...vN-1/<fN>vN/<fN+1>vN+1/...<fM>vM
Returns
v1 v2 ... vN-1 <fN>vN <fN+1>vN+1 ... <fM>vM
Note that vN...vM may contain slashes. This is resilient to the
substitution of backslashes for slashes, since Jam, unbidden,
s... | [
"Given",
"a",
"property",
"-",
"set",
"of",
"the",
"form",
"v1",
"/",
"v2",
"/",
"...",
"vN",
"-",
"1",
"/",
"<fN",
">",
"vN",
"/",
"<fN",
"+",
"1",
">",
"vN",
"+",
"1",
"/",
"...",
"<fM",
">",
"vM"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L786-L816 | [
"def",
"split",
"(",
"properties",
")",
":",
"assert",
"isinstance",
"(",
"properties",
",",
"basestring",
")",
"def",
"split_one",
"(",
"properties",
")",
":",
"pieces",
"=",
"re",
".",
"split",
"(",
"__re_slash_or_backslash",
",",
"properties",
")",
"resul... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | compress_subproperties | Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is being abused for unintended
purposes and i... | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def compress_subproperties (properties):
""" Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is b... | def compress_subproperties (properties):
""" Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is b... | [
"Combine",
"all",
"subproperties",
"into",
"their",
"parent",
"properties"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L819-L856 | [
"def",
"compress_subproperties",
"(",
"properties",
")",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"result",
"=",
"[",
"]",
"matched_subs",
"=",
"set",
"(",
")",
"all_subs",
"=",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __select_subfeatures | Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value. | deps/src/boost_1_68_0/tools/build/src/build/feature.py | def __select_subfeatures (parent_property, features):
""" Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value.
"""
if __d... | def __select_subfeatures (parent_property, features):
""" Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value.
"""
if __d... | [
"Given",
"a",
"property",
"return",
"the",
"subset",
"of",
"features",
"consisting",
"of",
"all",
"ordinary",
"subfeatures",
"of",
"the",
"property",
"s",
"feature",
"and",
"all",
"specific",
"subfeatures",
"of",
"the",
"property",
"s",
"feature",
"which",
"ar... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L902-L912 | [
"def",
"__select_subfeatures",
"(",
"parent_property",
",",
"features",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"is_iterable_typed",
"(",
"feat... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_interpretation_function | Retrieves the interpretation function used. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def _get_interpretation_function(interpretation, dtype):
"""
Retrieves the interpretation function used.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
global _interpretations
if not hasattr(_interpretations, name):
raise ValueError("No transform ... | def _get_interpretation_function(interpretation, dtype):
"""
Retrieves the interpretation function used.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
global _interpretations
if not hasattr(_interpretations, name):
raise ValueError("No transform ... | [
"Retrieves",
"the",
"interpretation",
"function",
"used",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L380-L394 | [
"def",
"_get_interpretation_function",
"(",
"interpretation",
",",
"dtype",
")",
":",
"type_string",
"=",
"dtype",
".",
"__name__",
"name",
"=",
"\"%s__%s\"",
"%",
"(",
"interpretation",
",",
"type_string",
")",
"global",
"_interpretations",
"if",
"not",
"hasattr"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_interpretation_description_and_output_type | Returns the description and output type for a given interpretation. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def _get_interpretation_description_and_output_type(interpretation, dtype):
"""
Returns the description and output type for a given interpretation.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
if not hasattr(_interpretations_class, name):
raise Value... | def _get_interpretation_description_and_output_type(interpretation, dtype):
"""
Returns the description and output type for a given interpretation.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
if not hasattr(_interpretations_class, name):
raise Value... | [
"Returns",
"the",
"description",
"and",
"output",
"type",
"for",
"a",
"given",
"interpretation",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L396-L411 | [
"def",
"_get_interpretation_description_and_output_type",
"(",
"interpretation",
",",
"dtype",
")",
":",
"type_string",
"=",
"dtype",
".",
"__name__",
"name",
"=",
"\"%s__%s\"",
"%",
"(",
"interpretation",
",",
"type_string",
")",
"if",
"not",
"hasattr",
"(",
"_in... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_embeddable_interpretation_doc | Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def _get_embeddable_interpretation_doc(indent = 0):
"""
Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount.
"""
output_rows = []
# Pull out the doc string and put it in a table.
for name in sorted... | def _get_embeddable_interpretation_doc(indent = 0):
"""
Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount.
"""
output_rows = []
# Pull out the doc string and put it in a table.
for name in sorted... | [
"Returns",
"a",
"list",
"of",
"the",
"available",
"interpretations",
"and",
"what",
"they",
"do",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L413-L436 | [
"def",
"_get_embeddable_interpretation_doc",
"(",
"indent",
"=",
"0",
")",
":",
"output_rows",
"=",
"[",
"]",
"# Pull out the doc string and put it in a table.",
"for",
"name",
"in",
"sorted",
"(",
"dir",
"(",
"_interpretations",
")",
")",
":",
"if",
"name",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ColumnFunctionTransformation._load_version | A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def _load_version(cls, unpickler, version):
"""
A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer... | def _load_version(cls, unpickler, version):
"""
A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer... | [
"A",
"function",
"to",
"load",
"a",
"previously",
"saved",
"SentenceSplitter",
"instance",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L72-L95 | [
"def",
"_load_version",
"(",
"cls",
",",
"unpickler",
",",
"version",
")",
":",
"state",
",",
"_exclude",
",",
"_features",
"=",
"unpickler",
".",
"load",
"(",
")",
"features",
"=",
"state",
"[",
"'features'",
"]",
"excluded_features",
"=",
"state",
"[",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ColumnFunctionTransformation.fit | Fits the transformer using the given data. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def fit(self, data):
"""
Fits the transformer using the given data.
"""
_raise_error_if_not_sframe(data, "data")
fitted_state = {}
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
raise ... | def fit(self, data):
"""
Fits the transformer using the given data.
"""
_raise_error_if_not_sframe(data, "data")
fitted_state = {}
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
raise ... | [
"Fits",
"the",
"transformer",
"using",
"the",
"given",
"data",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L151-L169 | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"_raise_error_if_not_sframe",
"(",
"data",
",",
"\"data\"",
")",
"fitted_state",
"=",
"{",
"}",
"feature_columns",
"=",
"_internal_utils",
".",
"get_column_names",
"(",
"data",
",",
"self",
".",
"_exclude",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ColumnFunctionTransformation.transform | Transforms the data. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def transform(self, data):
"""
Transforms the data.
"""
if not self._get("fitted"):
raise RuntimeError("`transform` called before `fit` or `fit_transform`.")
data = data.copy()
output_column_prefix = self._get("output_column_prefix")
if output_colum... | def transform(self, data):
"""
Transforms the data.
"""
if not self._get("fitted"):
raise RuntimeError("`transform` called before `fit` or `fit_transform`.")
data = data.copy()
output_column_prefix = self._get("output_column_prefix")
if output_colum... | [
"Transforms",
"the",
"data",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L171-L195 | [
"def",
"transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_get",
"(",
"\"fitted\"",
")",
":",
"raise",
"RuntimeError",
"(",
"\"`transform` called before `fit` or `fit_transform`.\"",
")",
"data",
"=",
"data",
".",
"copy",
"(",
")",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.