id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
28,900
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildConsoleSummaryReport.print_action
def print_action(self, test_succeed, action): ''' Print the detailed info of failed or always print tests. ''' #self.info_print(">>> {0}",action.keys()) if not test_succeed or action['info']['always_show_run_output']: output = action['output'].strip() if o...
python
def print_action(self, test_succeed, action): ''' Print the detailed info of failed or always print tests. ''' #self.info_print(">>> {0}",action.keys()) if not test_succeed or action['info']['always_show_run_output']: output = action['output'].strip() if o...
[ "def", "print_action", "(", "self", ",", "test_succeed", ",", "action", ")", ":", "#self.info_print(\">>> {0}\",action.keys())", "if", "not", "test_succeed", "or", "action", "[", "'info'", "]", "[", "'always_show_run_output'", "]", ":", "output", "=", "action", "[...
Print the detailed info of failed or always print tests.
[ "Print", "the", "detailed", "info", "of", "failed", "or", "always", "print", "tests", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L363-L378
28,901
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py
_generate_base_svm_classifier_spec
def _generate_base_svm_classifier_spec(model): """ Takes an SVM classifier produces a starting spec using the parts. that are shared between all SVMs. """ if not(_HAS_SKLEARN): raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.') check_fitted(model, la...
python
def _generate_base_svm_classifier_spec(model): """ Takes an SVM classifier produces a starting spec using the parts. that are shared between all SVMs. """ if not(_HAS_SKLEARN): raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.') check_fitted(model, la...
[ "def", "_generate_base_svm_classifier_spec", "(", "model", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "check_fitted", "(", "model", ",", "lambda", "m", ":...
Takes an SVM classifier produces a starting spec using the parts. that are shared between all SVMs.
[ "Takes", "an", "SVM", "classifier", "produces", "a", "starting", "spec", "using", "the", "parts", ".", "that", "are", "shared", "between", "all", "SVMs", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py#L24-L56
28,902
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph._insert_layer_after
def _insert_layer_after(self, layer_idx, new_layer, new_keras_layer): """ Insert the new_layer after layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ # reminder: new_keras_layer is not part of the original Keras n...
python
def _insert_layer_after(self, layer_idx, new_layer, new_keras_layer): """ Insert the new_layer after layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ # reminder: new_keras_layer is not part of the original Keras n...
[ "def", "_insert_layer_after", "(", "self", ",", "layer_idx", ",", "new_layer", ",", "new_keras_layer", ")", ":", "# reminder: new_keras_layer is not part of the original Keras network,", "# so it's input / output blob information is missing. It serves only as", "# a parameter holder.", ...
Insert the new_layer after layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer
[ "Insert", "the", "new_layer", "after", "layer", "whose", "position", "is", "layer_idx", ".", "The", "new", "layer", "s", "parameter", "is", "stored", "in", "a", "Keras", "layer", "called", "new_keras_layer" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L361-L378
28,903
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph._insert_layer_between
def _insert_layer_between(self, src, snk, new_layer, new_keras_layer): """ Insert the new_layer before layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ if snk is None: insert_pos = self.layer_list.inde...
python
def _insert_layer_between(self, src, snk, new_layer, new_keras_layer): """ Insert the new_layer before layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ if snk is None: insert_pos = self.layer_list.inde...
[ "def", "_insert_layer_between", "(", "self", ",", "src", ",", "snk", ",", "new_layer", ",", "new_keras_layer", ")", ":", "if", "snk", "is", "None", ":", "insert_pos", "=", "self", ".", "layer_list", ".", "index", "(", "src", ")", "+", "1", "else", ":",...
Insert the new_layer before layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer
[ "Insert", "the", "new_layer", "before", "layer", "whose", "position", "is", "layer_idx", ".", "The", "new", "layer", "s", "parameter", "is", "stored", "in", "a", "Keras", "layer", "called", "new_keras_layer" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L380-L398
28,904
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph.insert_1d_permute_layers
def insert_1d_permute_layers(self): """ Insert permutation layers before a 1D start point or after 1D end point """ idx, nb_layers = 0, len(self.layer_list) in_edges, out_edges = self._get_1d_interface_edges() # Hacky Warning: (1) use a 4-D permute, which is not likely t...
python
def insert_1d_permute_layers(self): """ Insert permutation layers before a 1D start point or after 1D end point """ idx, nb_layers = 0, len(self.layer_list) in_edges, out_edges = self._get_1d_interface_edges() # Hacky Warning: (1) use a 4-D permute, which is not likely t...
[ "def", "insert_1d_permute_layers", "(", "self", ")", ":", "idx", ",", "nb_layers", "=", "0", ",", "len", "(", "self", ".", "layer_list", ")", "in_edges", ",", "out_edges", "=", "self", ".", "_get_1d_interface_edges", "(", ")", "# Hacky Warning: (1) use a 4-D per...
Insert permutation layers before a 1D start point or after 1D end point
[ "Insert", "permutation", "layers", "before", "a", "1D", "start", "point", "or", "after", "1D", "end", "point" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L492-L518
28,905
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/configure.py
log_component_configuration
def log_component_configuration(component, message): """Report something about component configuration that the user should better know.""" assert isinstance(component, basestring) assert isinstance(message, basestring) __component_logs.setdefault(component, []).append(message)
python
def log_component_configuration(component, message): """Report something about component configuration that the user should better know.""" assert isinstance(component, basestring) assert isinstance(message, basestring) __component_logs.setdefault(component, []).append(message)
[ "def", "log_component_configuration", "(", "component", ",", "message", ")", ":", "assert", "isinstance", "(", "component", ",", "basestring", ")", "assert", "isinstance", "(", "message", ",", "basestring", ")", "__component_logs", ".", "setdefault", "(", "compone...
Report something about component configuration that the user should better know.
[ "Report", "something", "about", "component", "configuration", "that", "the", "user", "should", "better", "know", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/configure.py#L52-L56
28,906
apple/turicreate
src/unity/python/turicreate/toolkits/_feature_engineering/__init__.py
create
def create(dataset, transformers): """ Create a Transformer object to transform data for feature engineering. Parameters ---------- dataset : SFrame The dataset to use for training the model. transformers: Transformer | list[Transformer] An Transformer or a list of Transformer...
python
def create(dataset, transformers): """ Create a Transformer object to transform data for feature engineering. Parameters ---------- dataset : SFrame The dataset to use for training the model. transformers: Transformer | list[Transformer] An Transformer or a list of Transformer...
[ "def", "create", "(", "dataset", ",", "transformers", ")", ":", "err_msg", "=", "\"The parameters 'transformers' must be a valid Transformer object.\"", "cls", "=", "transformers", ".", "__class__", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"dataset\"", ")", "#...
Create a Transformer object to transform data for feature engineering. Parameters ---------- dataset : SFrame The dataset to use for training the model. transformers: Transformer | list[Transformer] An Transformer or a list of Transformers. See Also -------- turicreate.to...
[ "Create", "a", "Transformer", "object", "to", "transform", "data", "for", "feature", "engineering", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/__init__.py#L47-L106
28,907
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
VGGishFeatureExtractor._preprocess_data
def _preprocess_data(audio_data, verbose=True): ''' Preprocess each example, breaking it up into frames. Returns two numpy arrays: preprocessed frame and their indexes ''' from .vggish_input import waveform_to_examples last_progress_update = _time.time() progres...
python
def _preprocess_data(audio_data, verbose=True): ''' Preprocess each example, breaking it up into frames. Returns two numpy arrays: preprocessed frame and their indexes ''' from .vggish_input import waveform_to_examples last_progress_update = _time.time() progres...
[ "def", "_preprocess_data", "(", "audio_data", ",", "verbose", "=", "True", ")", ":", "from", ".", "vggish_input", "import", "waveform_to_examples", "last_progress_update", "=", "_time", ".", "time", "(", ")", "progress_header_printed", "=", "False", "# Can't run as ...
Preprocess each example, breaking it up into frames. Returns two numpy arrays: preprocessed frame and their indexes
[ "Preprocess", "each", "example", "breaking", "it", "up", "into", "frames", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L40-L72
28,908
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
VGGishFeatureExtractor.get_deep_features
def get_deep_features(self, audio_data, verbose): ''' Performs both audio preprocessing and VGGish deep feature extraction. ''' preprocessed_data, row_ids = self._preprocess_data(audio_data, verbose) deep_features = self._extract_features(preprocessed_data, verbose) outp...
python
def get_deep_features(self, audio_data, verbose): ''' Performs both audio preprocessing and VGGish deep feature extraction. ''' preprocessed_data, row_ids = self._preprocess_data(audio_data, verbose) deep_features = self._extract_features(preprocessed_data, verbose) outp...
[ "def", "get_deep_features", "(", "self", ",", "audio_data", ",", "verbose", ")", ":", "preprocessed_data", ",", "row_ids", "=", "self", ".", "_preprocess_data", "(", "audio_data", ",", "verbose", ")", "deep_features", "=", "self", ".", "_extract_features", "(", ...
Performs both audio preprocessing and VGGish deep feature extraction.
[ "Performs", "both", "audio", "preprocessing", "and", "VGGish", "deep", "feature", "extraction", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L172-L190
28,909
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
VGGishFeatureExtractor.get_spec
def get_spec(self): """ Return the Core ML spec """ if _mac_ver() >= (10, 14): return self.vggish_model.get_spec() else: vggish_model_file = VGGish() coreml_model_path = vggish_model_file.get_model_path(format='coreml') return MLMod...
python
def get_spec(self): """ Return the Core ML spec """ if _mac_ver() >= (10, 14): return self.vggish_model.get_spec() else: vggish_model_file = VGGish() coreml_model_path = vggish_model_file.get_model_path(format='coreml') return MLMod...
[ "def", "get_spec", "(", "self", ")", ":", "if", "_mac_ver", "(", ")", ">=", "(", "10", ",", "14", ")", ":", "return", "self", ".", "vggish_model", ".", "get_spec", "(", ")", "else", ":", "vggish_model_file", "=", "VGGish", "(", ")", "coreml_model_path"...
Return the Core ML spec
[ "Return", "the", "Core", "ML", "spec" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L192-L201
28,910
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
value_to_jam
def value_to_jam(value, methods=False): """Makes a token to refer to a Python value inside Jam language code. The token is merely a string that can be passed around in Jam code and eventually passed back. For example, we might want to pass PropertySet instance to a tag function and it might eventually ...
python
def value_to_jam(value, methods=False): """Makes a token to refer to a Python value inside Jam language code. The token is merely a string that can be passed around in Jam code and eventually passed back. For example, we might want to pass PropertySet instance to a tag function and it might eventually ...
[ "def", "value_to_jam", "(", "value", ",", "methods", "=", "False", ")", ":", "global", "__value_id", "r", "=", "__python_to_jam", ".", "get", "(", "value", ",", "None", ")", "if", "r", ":", "return", "r", "exported_name", "=", "'###_'", "+", "str", "("...
Makes a token to refer to a Python value inside Jam language code. The token is merely a string that can be passed around in Jam code and eventually passed back. For example, we might want to pass PropertySet instance to a tag function and it might eventually call back to virtual_target.add_suffix_and_...
[ "Makes", "a", "token", "to", "refer", "to", "a", "Python", "value", "inside", "Jam", "language", "code", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L228-L261
28,911
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
abbreviate_dashed
def abbreviate_dashed(s): """Abbreviates each part of string that is delimited by a '-'.""" r = [] for part in s.split('-'): r.append(abbreviate(part)) return '-'.join(r)
python
def abbreviate_dashed(s): """Abbreviates each part of string that is delimited by a '-'.""" r = [] for part in s.split('-'): r.append(abbreviate(part)) return '-'.join(r)
[ "def", "abbreviate_dashed", "(", "s", ")", ":", "r", "=", "[", "]", "for", "part", "in", "s", ".", "split", "(", "'-'", ")", ":", "r", ".", "append", "(", "abbreviate", "(", "part", ")", ")", "return", "'-'", ".", "join", "(", "r", ")" ]
Abbreviates each part of string that is delimited by a '-'.
[ "Abbreviates", "each", "part", "of", "string", "that", "is", "delimited", "by", "a", "-", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L281-L286
28,912
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
abbreviate
def abbreviate(s): """Apply a set of standard transformations to string to produce an abbreviation no more than 4 characters long. """ if not s: return '' # check the cache if s in abbreviate.abbreviations: return abbreviate.abbreviations[s] # anything less than 4 characters ...
python
def abbreviate(s): """Apply a set of standard transformations to string to produce an abbreviation no more than 4 characters long. """ if not s: return '' # check the cache if s in abbreviate.abbreviations: return abbreviate.abbreviations[s] # anything less than 4 characters ...
[ "def", "abbreviate", "(", "s", ")", ":", "if", "not", "s", ":", "return", "''", "# check the cache", "if", "s", "in", "abbreviate", ".", "abbreviations", ":", "return", "abbreviate", ".", "abbreviations", "[", "s", "]", "# anything less than 4 characters doesn't...
Apply a set of standard transformations to string to produce an abbreviation no more than 4 characters long.
[ "Apply", "a", "set", "of", "standard", "transformations", "to", "string", "to", "produce", "an", "abbreviation", "no", "more", "than", "4", "characters", "long", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L289-L319
28,913
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
Node.get_decision
def get_decision(self, child, is_missing = False): """ Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node t...
python
def get_decision(self, child, is_missing = False): """ Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node t...
[ "def", "get_decision", "(", "self", ",", "child", ",", "is_missing", "=", "False", ")", ":", "# Child does exist and there is a path to the child.", "value", "=", "self", ".", "value", "feature", "=", "self", ".", "split_feature_column", "index", "=", "self", ".",...
Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node to the child node.
[ "Get", "the", "decision", "from", "this", "node", "to", "a", "child", "node", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L80-L123
28,914
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
Node.to_dict
def to_dict(self): """ Return the node as a dictionary. Returns ------- dict: All the attributes of this node as a dictionary (minus the left and right). """ out = {} for key in self.__dict__.keys(): if key not in ['left', 'right...
python
def to_dict(self): """ Return the node as a dictionary. Returns ------- dict: All the attributes of this node as a dictionary (minus the left and right). """ out = {} for key in self.__dict__.keys(): if key not in ['left', 'right...
[ "def", "to_dict", "(", "self", ")", ":", "out", "=", "{", "}", "for", "key", "in", "self", ".", "__dict__", ".", "keys", "(", ")", ":", "if", "key", "not", "in", "[", "'left'", ",", "'right'", ",", "'missing'", ",", "'parent'", "]", ":", "out", ...
Return the node as a dictionary. Returns ------- dict: All the attributes of this node as a dictionary (minus the left and right).
[ "Return", "the", "node", "as", "a", "dictionary", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L125-L138
28,915
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
DecisionTree.to_json
def to_json(self, root_id = 0, output = {}): """ Recursive function to dump this tree as a json blob. Parameters ---------- root_id: Root id of the sub-tree output: Carry over output from the previous sub-trees. Returns ------- dict: A tree in JS...
python
def to_json(self, root_id = 0, output = {}): """ Recursive function to dump this tree as a json blob. Parameters ---------- root_id: Root id of the sub-tree output: Carry over output from the previous sub-trees. Returns ------- dict: A tree in JS...
[ "def", "to_json", "(", "self", ",", "root_id", "=", "0", ",", "output", "=", "{", "}", ")", ":", "_raise_error_if_not_of_type", "(", "root_id", ",", "[", "int", ",", "long", "]", ",", "\"root_id\"", ")", "_numeric_param_check_range", "(", "\"root_id\"", ",...
Recursive function to dump this tree as a json blob. Parameters ---------- root_id: Root id of the sub-tree output: Carry over output from the previous sub-trees. Returns ------- dict: A tree in JSON format. Starts at the root node and recursively repres...
[ "Recursive", "function", "to", "dump", "this", "tree", "as", "a", "json", "blob", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L300-L371
28,916
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
DecisionTree.get_prediction_path
def get_prediction_path(self, node_id, missing_id = []): """ Return the prediction path from this node to the parent node. Parameters ---------- node_id : id of the node to get the prediction path. missing_id : Additional info that contains nodes with missing features...
python
def get_prediction_path(self, node_id, missing_id = []): """ Return the prediction path from this node to the parent node. Parameters ---------- node_id : id of the node to get the prediction path. missing_id : Additional info that contains nodes with missing features...
[ "def", "get_prediction_path", "(", "self", ",", "node_id", ",", "missing_id", "=", "[", "]", ")", ":", "_raise_error_if_not_of_type", "(", "node_id", ",", "[", "int", ",", "long", "]", ",", "\"node_id\"", ")", "_numeric_param_check_range", "(", "\"node_id\"", ...
Return the prediction path from this node to the parent node. Parameters ---------- node_id : id of the node to get the prediction path. missing_id : Additional info that contains nodes with missing features. Returns ------- list: The list of decisions (top t...
[ "Return", "the", "prediction", "path", "from", "this", "node", "to", "the", "parent", "node", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L403-L484
28,917
apple/turicreate
src/unity/python/turicreate/toolkits/graph_analytics/label_propagation.py
create
def create(graph, label_field, threshold=1e-3, weight_field='', self_weight=1.0, undirected=False, max_iterations=None, _single_precision=False, _distributed='auto', verbose=True): """ Given a weighted graph with observed cl...
python
def create(graph, label_field, threshold=1e-3, weight_field='', self_weight=1.0, undirected=False, max_iterations=None, _single_precision=False, _distributed='auto', verbose=True): """ Given a weighted graph with observed cl...
[ "def", "create", "(", "graph", ",", "label_field", ",", "threshold", "=", "1e-3", ",", "weight_field", "=", "''", ",", "self_weight", "=", "1.0", ",", "undirected", "=", "False", ",", "max_iterations", "=", "None", ",", "_single_precision", "=", "False", "...
Given a weighted graph with observed class labels of a subset of vertices, infer the label probability for the unobserved vertices using the "label propagation" algorithm. The algorithm iteratively updates the label probability of current vertex as a weighted sum of label probability of self and the ne...
[ "Given", "a", "weighted", "graph", "with", "observed", "class", "labels", "of", "a", "subset", "of", "vertices", "infer", "the", "label", "probability", "for", "the", "unobserved", "vertices", "using", "the", "label", "propagation", "algorithm", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/label_propagation.py#L131-L274
28,918
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_is_not_pickle_safe_gl_model_class
def _is_not_pickle_safe_gl_model_class(obj_class): """ Check if a Turi create model is pickle safe. The function does it by checking that _CustomModel is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the GLC class is a model a...
python
def _is_not_pickle_safe_gl_model_class(obj_class): """ Check if a Turi create model is pickle safe. The function does it by checking that _CustomModel is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the GLC class is a model a...
[ "def", "_is_not_pickle_safe_gl_model_class", "(", "obj_class", ")", ":", "if", "issubclass", "(", "obj_class", ",", "_toolkits", ".", "_model", ".", "CustomModel", ")", ":", "return", "not", "obj_class", ".", "_is_gl_pickle_safe", "(", ")", "return", "False" ]
Check if a Turi create model is pickle safe. The function does it by checking that _CustomModel is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the GLC class is a model and is pickle safe.
[ "Check", "if", "a", "Turi", "create", "model", "is", "pickle", "safe", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L33-L50
28,919
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_is_not_pickle_safe_gl_class
def _is_not_pickle_safe_gl_class(obj_class): """ Check if class is a Turi create model. The function does it by checking the method resolution order (MRO) of the class and verifies that _Model is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---...
python
def _is_not_pickle_safe_gl_class(obj_class): """ Check if class is a Turi create model. The function does it by checking the method resolution order (MRO) of the class and verifies that _Model is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---...
[ "def", "_is_not_pickle_safe_gl_class", "(", "obj_class", ")", ":", "gl_ds", "=", "[", "_SFrame", ",", "_SArray", ",", "_SGraph", "]", "# Object is GLC-DS or GLC-Model", "return", "(", "obj_class", "in", "gl_ds", ")", "or", "_is_not_pickle_safe_gl_model_class", "(", ...
Check if class is a Turi create model. The function does it by checking the method resolution order (MRO) of the class and verifies that _Model is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the class is a GLC Model.
[ "Check", "if", "class", "is", "a", "Turi", "create", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L52-L71
28,920
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_get_gl_class_type
def _get_gl_class_type(obj_class): """ Internal util to get the type of the GLC class. The pickle file stores this name so that it knows how to construct the object on unpickling. Parameters ---------- obj_class : Class which has to be categorized. Returns ---------- A class typ...
python
def _get_gl_class_type(obj_class): """ Internal util to get the type of the GLC class. The pickle file stores this name so that it knows how to construct the object on unpickling. Parameters ---------- obj_class : Class which has to be categorized. Returns ---------- A class typ...
[ "def", "_get_gl_class_type", "(", "obj_class", ")", ":", "if", "obj_class", "==", "_SFrame", ":", "return", "\"SFrame\"", "elif", "obj_class", "==", "_SGraph", ":", "return", "\"SGraph\"", "elif", "obj_class", "==", "_SArray", ":", "return", "\"SArray\"", "elif"...
Internal util to get the type of the GLC class. The pickle file stores this name so that it knows how to construct the object on unpickling. Parameters ---------- obj_class : Class which has to be categorized. Returns ---------- A class type for the pickle file to save.
[ "Internal", "util", "to", "get", "the", "type", "of", "the", "GLC", "class", ".", "The", "pickle", "file", "stores", "this", "name", "so", "that", "it", "knows", "how", "to", "construct", "the", "object", "on", "unpickling", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L73-L97
28,921
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_get_gl_object_from_persistent_id
def _get_gl_object_from_persistent_id(type_tag, gl_archive_abs_path): """ Internal util to get a GLC object from a persistent ID in the pickle file. Parameters ---------- type_tag : The name of the glc class as saved in the GLC pickler. gl_archive_abs_path: An absolute path to the GLC archive ...
python
def _get_gl_object_from_persistent_id(type_tag, gl_archive_abs_path): """ Internal util to get a GLC object from a persistent ID in the pickle file. Parameters ---------- type_tag : The name of the glc class as saved in the GLC pickler. gl_archive_abs_path: An absolute path to the GLC archive ...
[ "def", "_get_gl_object_from_persistent_id", "(", "type_tag", ",", "gl_archive_abs_path", ")", ":", "if", "type_tag", "==", "\"SFrame\"", ":", "obj", "=", "_SFrame", "(", "gl_archive_abs_path", ")", "elif", "type_tag", "==", "\"SGraph\"", ":", "obj", "=", "_load_gr...
Internal util to get a GLC object from a persistent ID in the pickle file. Parameters ---------- type_tag : The name of the glc class as saved in the GLC pickler. gl_archive_abs_path: An absolute path to the GLC archive where the object was saved. Returns ---------- ...
[ "Internal", "util", "to", "get", "a", "GLC", "object", "from", "a", "persistent", "ID", "in", "the", "pickle", "file", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L99-L127
28,922
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLPickler.persistent_id
def persistent_id(self, obj): """ Provide a persistent ID for "saving" GLC objects by reference. Return None for all non GLC objects. Parameters ---------- obj: Name of the object whose persistent ID is extracted. Returns -------- None if the ob...
python
def persistent_id(self, obj): """ Provide a persistent ID for "saving" GLC objects by reference. Return None for all non GLC objects. Parameters ---------- obj: Name of the object whose persistent ID is extracted. Returns -------- None if the ob...
[ "def", "persistent_id", "(", "self", ",", "obj", ")", ":", "# Get the class of the object (if it can be done)", "obj_class", "=", "None", "if", "not", "hasattr", "(", "obj", ",", "'__class__'", ")", "else", "obj", ".", "__class__", "if", "obj_class", "is", "None...
Provide a persistent ID for "saving" GLC objects by reference. Return None for all non GLC objects. Parameters ---------- obj: Name of the object whose persistent ID is extracted. Returns -------- None if the object is not a GLC object. (ClassName, relative pat...
[ "Provide", "a", "persistent", "ID", "for", "saving", "GLC", "objects", "by", "reference", ".", "Return", "None", "for", "all", "non", "GLC", "objects", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L287-L351
28,923
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLPickler.close
def close(self): """ Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler. """ if self.file is None: return # Close the pickle file. self.file.close() self.file = ...
python
def close(self): """ Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler. """ if self.file is None: return # Close the pickle file. self.file.close() self.file = ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "file", "is", "None", ":", "return", "# Close the pickle file.", "self", ".", "file", ".", "close", "(", ")", "self", ".", "file", "=", "None", "for", "f", "in", "self", ".", "mark_for_delete", ...
Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler.
[ "Close", "the", "pickle", "file", "and", "the", "zip", "archive", "file", ".", "The", "single", "zip", "archive", "file", "can", "now", "be", "shipped", "around", "to", "be", "loaded", "by", "the", "unpickler", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L353-L374
28,924
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLUnpickler.persistent_load
def persistent_load(self, pid): """ Reconstruct a GLC object using the persistent ID. This method should not be used externally. It is required by the unpickler super class. Parameters ---------- pid : The persistent ID used in pickle file to save the GLC object. ...
python
def persistent_load(self, pid): """ Reconstruct a GLC object using the persistent ID. This method should not be used externally. It is required by the unpickler super class. Parameters ---------- pid : The persistent ID used in pickle file to save the GLC object. ...
[ "def", "persistent_load", "(", "self", ",", "pid", ")", ":", "if", "len", "(", "pid", ")", "==", "2", ":", "# Pre GLC-1.3 release behavior, without memorization", "type_tag", ",", "filename", "=", "pid", "abs_path", "=", "_os", ".", "path", ".", "join", "(",...
Reconstruct a GLC object using the persistent ID. This method should not be used externally. It is required by the unpickler super class. Parameters ---------- pid : The persistent ID used in pickle file to save the GLC object. Returns ---------- The GLC o...
[ "Reconstruct", "a", "GLC", "object", "using", "the", "persistent", "ID", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L472-L500
28,925
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLUnpickler.close
def close(self): """ Clean up files that were created. """ if self.file: self.file.close() self.file = None # If temp_file is a folder, we do not remove it because we may # still need it after the unpickler is disposed if self.tmp_file and...
python
def close(self): """ Clean up files that were created. """ if self.file: self.file.close() self.file = None # If temp_file is a folder, we do not remove it because we may # still need it after the unpickler is disposed if self.tmp_file and...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "file", ":", "self", ".", "file", ".", "close", "(", ")", "self", ".", "file", "=", "None", "# If temp_file is a folder, we do not remove it because we may", "# still need it after the unpickler is disposed", ...
Clean up files that were created.
[ "Clean", "up", "files", "that", "were", "created", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L502-L514
28,926
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter.py
convert
def convert(sk_obj, input_features = None, output_feature_names = None): """ Convert scikit-learn pipeline, classifier, or regressor to Core ML format. Parameters ---------- sk_obj: model | [model] of scikit-learn format. Scikit learn model(s) to convert to a Core ML format. ...
python
def convert(sk_obj, input_features = None, output_feature_names = None): """ Convert scikit-learn pipeline, classifier, or regressor to Core ML format. Parameters ---------- sk_obj: model | [model] of scikit-learn format. Scikit learn model(s) to convert to a Core ML format. ...
[ "def", "convert", "(", "sk_obj", ",", "input_features", "=", "None", ",", "output_feature_names", "=", "None", ")", ":", "# This function is just a thin wrapper around the internal converter so", "# that sklearn isn't actually imported unless this function is called", "from", ".", ...
Convert scikit-learn pipeline, classifier, or regressor to Core ML format. Parameters ---------- sk_obj: model | [model] of scikit-learn format. Scikit learn model(s) to convert to a Core ML format. The input model may be a single scikit learn model, a scikit learn pipeline model, ...
[ "Convert", "scikit", "-", "learn", "pipeline", "classifier", "or", "regressor", "to", "Core", "ML", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter.py#L10-L148
28,927
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py
ParseMessage
def ParseMessage(descriptor, byte_str): """Generate a new Message instance from this Descriptor and a byte string. Args: descriptor: Protobuf Descriptor object byte_str: Serialized protocol buffer byte string Returns: Newly created protobuf Message object. """ result_class = MakeClass(descriptor...
python
def ParseMessage(descriptor, byte_str): """Generate a new Message instance from this Descriptor and a byte string. Args: descriptor: Protobuf Descriptor object byte_str: Serialized protocol buffer byte string Returns: Newly created protobuf Message object. """ result_class = MakeClass(descriptor...
[ "def", "ParseMessage", "(", "descriptor", ",", "byte_str", ")", ":", "result_class", "=", "MakeClass", "(", "descriptor", ")", "new_msg", "=", "result_class", "(", ")", "new_msg", ".", "ParseFromString", "(", "byte_str", ")", "return", "new_msg" ]
Generate a new Message instance from this Descriptor and a byte string. Args: descriptor: Protobuf Descriptor object byte_str: Serialized protocol buffer byte string Returns: Newly created protobuf Message object.
[ "Generate", "a", "new", "Message", "instance", "from", "this", "Descriptor", "and", "a", "byte", "string", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py#L67-L80
28,928
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py
MakeClass
def MakeClass(descriptor): """Construct a class object for a protobuf described by descriptor. Composite descriptors are handled by defining the new class as a member of the parent class, recursing as deep as necessary. This is the dynamic equivalent to: class Parent(message.Message): __metaclass__ = Ge...
python
def MakeClass(descriptor): """Construct a class object for a protobuf described by descriptor. Composite descriptors are handled by defining the new class as a member of the parent class, recursing as deep as necessary. This is the dynamic equivalent to: class Parent(message.Message): __metaclass__ = Ge...
[ "def", "MakeClass", "(", "descriptor", ")", ":", "if", "descriptor", "in", "MESSAGE_CLASS_CACHE", ":", "return", "MESSAGE_CLASS_CACHE", "[", "descriptor", "]", "attributes", "=", "{", "}", "for", "name", ",", "nested_type", "in", "descriptor", ".", "nested_types...
Construct a class object for a protobuf described by descriptor. Composite descriptors are handled by defining the new class as a member of the parent class, recursing as deep as necessary. This is the dynamic equivalent to: class Parent(message.Message): __metaclass__ = GeneratedProtocolMessageType D...
[ "Construct", "a", "class", "object", "for", "a", "protobuf", "described", "by", "descriptor", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py#L83-L121
28,929
apple/turicreate
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
load_images
def load_images(url, format='auto', with_path=True, recursive=True, ignore_failure=True, random_order=False): """ Loads images from a directory. JPEG and PNG images are supported. Parameters ---------- url : str The string of the path where all the images are stored. format : {'PNG' | ...
python
def load_images(url, format='auto', with_path=True, recursive=True, ignore_failure=True, random_order=False): """ Loads images from a directory. JPEG and PNG images are supported. Parameters ---------- url : str The string of the path where all the images are stored. format : {'PNG' | ...
[ "def", "load_images", "(", "url", ",", "format", "=", "'auto'", ",", "with_path", "=", "True", ",", "recursive", "=", "True", ",", "ignore_failure", "=", "True", ",", "random_order", "=", "False", ")", ":", "from", ".", ".", ".", "import", "extensions", ...
Loads images from a directory. JPEG and PNG images are supported. Parameters ---------- url : str The string of the path where all the images are stored. format : {'PNG' | 'JPG' | 'auto'}, optional The format of the images in the directory. The default 'auto' parameter value tr...
[ "Loads", "images", "from", "a", "directory", ".", "JPEG", "and", "PNG", "images", "are", "supported", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L12-L60
28,930
apple/turicreate
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
_decode
def _decode(image_data): """ Internal helper function for decoding a single Image or an SArray of Images """ from ...data_structures.sarray import SArray as _SArray from ... import extensions as _extensions if type(image_data) is _SArray: return _extensions.decode_image_sarray(image_data...
python
def _decode(image_data): """ Internal helper function for decoding a single Image or an SArray of Images """ from ...data_structures.sarray import SArray as _SArray from ... import extensions as _extensions if type(image_data) is _SArray: return _extensions.decode_image_sarray(image_data...
[ "def", "_decode", "(", "image_data", ")", ":", "from", ".", ".", ".", "data_structures", ".", "sarray", "import", "SArray", "as", "_SArray", "from", ".", ".", ".", "import", "extensions", "as", "_extensions", "if", "type", "(", "image_data", ")", "is", "...
Internal helper function for decoding a single Image or an SArray of Images
[ "Internal", "helper", "function", "for", "decoding", "a", "single", "Image", "or", "an", "SArray", "of", "Images" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L63-L72
28,931
apple/turicreate
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
resize
def resize(image, width, height, channels=None, decode=False, resample='nearest'): """ Resizes the image or SArray of Images to a specific width, height, and number of channels. Parameters ---------- image : turicreate.Image | SArray The image or SArray of images to be resiz...
python
def resize(image, width, height, channels=None, decode=False, resample='nearest'): """ Resizes the image or SArray of Images to a specific width, height, and number of channels. Parameters ---------- image : turicreate.Image | SArray The image or SArray of images to be resiz...
[ "def", "resize", "(", "image", ",", "width", ",", "height", ",", "channels", "=", "None", ",", "decode", "=", "False", ",", "resample", "=", "'nearest'", ")", ":", "if", "height", "<", "0", "or", "width", "<", "0", ":", "raise", "ValueError", "(", ...
Resizes the image or SArray of Images to a specific width, height, and number of channels. Parameters ---------- image : turicreate.Image | SArray The image or SArray of images to be resized. width : int The width the image is resized to. height : int The height the ima...
[ "Resizes", "the", "image", "or", "SArray", "of", "Images", "to", "a", "specific", "width", "height", "and", "number", "of", "channels", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L76-L161
28,932
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_convert_1bit_array_to_byte_array
def _convert_1bit_array_to_byte_array(arr): """ Convert bit array to byte array. :param arr: list Bits as a list where each element is an integer of 0 or 1 Returns ------- numpy.array 1D numpy array of type uint8 """ # Padding if necessary while len(arr) < 8 or len(...
python
def _convert_1bit_array_to_byte_array(arr): """ Convert bit array to byte array. :param arr: list Bits as a list where each element is an integer of 0 or 1 Returns ------- numpy.array 1D numpy array of type uint8 """ # Padding if necessary while len(arr) < 8 or len(...
[ "def", "_convert_1bit_array_to_byte_array", "(", "arr", ")", ":", "# Padding if necessary", "while", "len", "(", "arr", ")", "<", "8", "or", "len", "(", "arr", ")", "%", "8", ":", "arr", ".", "append", "(", "0", ")", "arr", "=", "_np", ".", "array", ...
Convert bit array to byte array. :param arr: list Bits as a list where each element is an integer of 0 or 1 Returns ------- numpy.array 1D numpy array of type uint8
[ "Convert", "bit", "array", "to", "byte", "array", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L34-L65
28,933
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_decompose_bytes_to_bit_arr
def _decompose_bytes_to_bit_arr(arr): """ Unpack bytes to bits :param arr: list Byte Stream, as a list of uint8 values Returns ------- bit_arr: list Decomposed bit stream as a list of 0/1s of length (len(arr) * 8) """ bit_arr = [] for idx in range(len(arr)): ...
python
def _decompose_bytes_to_bit_arr(arr): """ Unpack bytes to bits :param arr: list Byte Stream, as a list of uint8 values Returns ------- bit_arr: list Decomposed bit stream as a list of 0/1s of length (len(arr) * 8) """ bit_arr = [] for idx in range(len(arr)): ...
[ "def", "_decompose_bytes_to_bit_arr", "(", "arr", ")", ":", "bit_arr", "=", "[", "]", "for", "idx", "in", "range", "(", "len", "(", "arr", ")", ")", ":", "for", "i", "in", "reversed", "(", "range", "(", "8", ")", ")", ":", "bit_arr", ".", "append",...
Unpack bytes to bits :param arr: list Byte Stream, as a list of uint8 values Returns ------- bit_arr: list Decomposed bit stream as a list of 0/1s of length (len(arr) * 8)
[ "Unpack", "bytes", "to", "bits" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L77-L93
28,934
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_get_linear_lookup_table_and_weight
def _get_linear_lookup_table_and_weight(nbits, wp): """ Generate a linear lookup table. :param nbits: int Number of bits to represent a quantized weight value :param wp: numpy.array Weight blob to be quantized Returns ------- lookup_table: numpy.array Lookup table ...
python
def _get_linear_lookup_table_and_weight(nbits, wp): """ Generate a linear lookup table. :param nbits: int Number of bits to represent a quantized weight value :param wp: numpy.array Weight blob to be quantized Returns ------- lookup_table: numpy.array Lookup table ...
[ "def", "_get_linear_lookup_table_and_weight", "(", "nbits", ",", "wp", ")", ":", "w", "=", "wp", ".", "reshape", "(", "1", ",", "-", "1", ")", "qw", ",", "scales", ",", "biases", "=", "_quantize_channelwise_linear", "(", "w", ",", "nbits", ",", "axis", ...
Generate a linear lookup table. :param nbits: int Number of bits to represent a quantized weight value :param wp: numpy.array Weight blob to be quantized Returns ------- lookup_table: numpy.array Lookup table of shape (2^nbits, ) qw: numpy.array Decomposed bit ...
[ "Generate", "a", "linear", "lookup", "table", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L96-L117
28,935
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_get_kmeans_lookup_table_and_weight
def _get_kmeans_lookup_table_and_weight(nbits, w, init='k-means++', tol=1e-2, n_init=1, rand_seed=0): """ Generate K-Means lookup table given a weight parameter field :param nbits: Number of bits for quantization :param w: Weight as numpy array Returns ------- lut: numpy.a...
python
def _get_kmeans_lookup_table_and_weight(nbits, w, init='k-means++', tol=1e-2, n_init=1, rand_seed=0): """ Generate K-Means lookup table given a weight parameter field :param nbits: Number of bits for quantization :param w: Weight as numpy array Returns ------- lut: numpy.a...
[ "def", "_get_kmeans_lookup_table_and_weight", "(", "nbits", ",", "w", ",", "init", "=", "'k-means++'", ",", "tol", "=", "1e-2", ",", "n_init", "=", "1", ",", "rand_seed", "=", "0", ")", ":", "if", "_HAS_SKLEARN", ":", "from", "sklearn", ".", "cluster", "...
Generate K-Means lookup table given a weight parameter field :param nbits: Number of bits for quantization :param w: Weight as numpy array Returns ------- lut: numpy.array Lookup table, numpy array of shape (1 << nbits, ); wq: numpy.array Quantized weight of ty...
[ "Generate", "K", "-", "Means", "lookup", "table", "given", "a", "weight", "parameter", "field" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L120-L149
28,936
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_quantize_channelwise_linear
def _quantize_channelwise_linear(weight, nbits, axis=0): """ Linearly quantize weight blob. :param weight: numpy.array Weight to be quantized. :param nbits: int Number of bits per weight element :param axis: int Axis of the weight blob to compute channel-wise quantization,...
python
def _quantize_channelwise_linear(weight, nbits, axis=0): """ Linearly quantize weight blob. :param weight: numpy.array Weight to be quantized. :param nbits: int Number of bits per weight element :param axis: int Axis of the weight blob to compute channel-wise quantization,...
[ "def", "_quantize_channelwise_linear", "(", "weight", ",", "nbits", ",", "axis", "=", "0", ")", ":", "if", "len", "(", "weight", ".", "shape", ")", "==", "1", ":", "# vector situation, treat as 1 channel", "weight", "=", "weight", ".", "reshape", "(", "(", ...
Linearly quantize weight blob. :param weight: numpy.array Weight to be quantized. :param nbits: int Number of bits per weight element :param axis: int Axis of the weight blob to compute channel-wise quantization, can be 0 or 1 Returns ------- quantized_weight: numpy.a...
[ "Linearly", "quantize", "weight", "blob", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L151-L212
28,937
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_quantize_wp
def _quantize_wp(wp, nbits, qm, axis=0, **kwargs): """ Quantize the weight blob :param wp: numpy.array Weight parameters :param nbits: int Number of bits :param qm: Quantization mode :param lut_function: (``callable function``) Python callable representing a look...
python
def _quantize_wp(wp, nbits, qm, axis=0, **kwargs): """ Quantize the weight blob :param wp: numpy.array Weight parameters :param nbits: int Number of bits :param qm: Quantization mode :param lut_function: (``callable function``) Python callable representing a look...
[ "def", "_quantize_wp", "(", "wp", ",", "nbits", ",", "qm", ",", "axis", "=", "0", ",", "*", "*", "kwargs", ")", ":", "scale", "=", "bias", "=", "lut", "=", "None", "# Linear Quantization", "if", "qm", "==", "_QUANTIZATION_MODE_LINEAR_QUANTIZATION", ":", ...
Quantize the weight blob :param wp: numpy.array Weight parameters :param nbits: int Number of bits :param qm: Quantization mode :param lut_function: (``callable function``) Python callable representing a look-up table Returns ------- scale: numpy.array ...
[ "Quantize", "the", "weight", "blob" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L215-L266
28,938
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_quantize_wp_field
def _quantize_wp_field(wp, nbits, qm, shape, axis=0, **kwargs): """ Quantize WeightParam field in Neural Network Protobuf :param wp: MLModel.NeuralNetwork.WeightParam WeightParam field :param nbits: int Number of bits to be quantized :param qm: str Quantization mode :pa...
python
def _quantize_wp_field(wp, nbits, qm, shape, axis=0, **kwargs): """ Quantize WeightParam field in Neural Network Protobuf :param wp: MLModel.NeuralNetwork.WeightParam WeightParam field :param nbits: int Number of bits to be quantized :param qm: str Quantization mode :pa...
[ "def", "_quantize_wp_field", "(", "wp", ",", "nbits", ",", "qm", ",", "shape", ",", "axis", "=", "0", ",", "*", "*", "kwargs", ")", ":", "# De-quantization", "if", "qm", "==", "_QUANTIZATION_MODE_DEQUANTIZE", ":", "return", "_dequantize_wp", "(", "wp", ","...
Quantize WeightParam field in Neural Network Protobuf :param wp: MLModel.NeuralNetwork.WeightParam WeightParam field :param nbits: int Number of bits to be quantized :param qm: str Quantization mode :param shape: tuple Tensor shape held by wp :param axis: int ...
[ "Quantize", "WeightParam", "field", "in", "Neural", "Network", "Protobuf" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L269-L336
28,939
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
compare_models
def compare_models(full_precision_model, quantized_model, sample_data): """ Utility function to compare the performance of a full precision vs quantized model :param full_precision_model: MLModel The full precision model with float32 weights :param quantized_model...
python
def compare_models(full_precision_model, quantized_model, sample_data): """ Utility function to compare the performance of a full precision vs quantized model :param full_precision_model: MLModel The full precision model with float32 weights :param quantized_model...
[ "def", "compare_models", "(", "full_precision_model", ",", "quantized_model", ",", "sample_data", ")", ":", "emessage", "=", "(", "\"\"\"\n Invalid sample data provided. Only a list of dictionaries\n containing sample data or path to a folder containing images is\n supported\"\"\"...
Utility function to compare the performance of a full precision vs quantized model :param full_precision_model: MLModel The full precision model with float32 weights :param quantized_model: MLModel Quantized version of the model with quantized weights :param sample_data: str | [dict] ...
[ "Utility", "function", "to", "compare", "the", "performance", "of", "a", "full", "precision", "vs", "quantized", "model" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L829-L874
28,940
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/item_similarity_recommender.py
create
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, nearest_items=None, similarity_type='jaccard', threshold=0.001, only_top_k=64, verbose=True, target_memory_usage = 8*102...
python
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, nearest_items=None, similarity_type='jaccard', threshold=0.001, only_top_k=64, verbose=True, target_memory_usage = 8*102...
[ "def", "create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "nearest_items", "=", "None", ",", "similarity_type",...
Create a recommender that uses item-item similarities based on users in common. Parameters ---------- observation_data : SFrame The dataset to use for training the model. It must contain a column of user ids and a column of item ids. Each row represents an observed interaction b...
[ "Create", "a", "recommender", "that", "uses", "item", "-", "item", "similarities", "based", "on", "users", "in", "common", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/item_similarity_recommender.py#L17-L259
28,941
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_advanced_relu
def convert_advanced_relu(builder, layer, input_names, output_names, keras_layer): """ Convert an ReLU layer with maximum value from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. ...
python
def convert_advanced_relu(builder, layer, input_names, output_names, keras_layer): """ Convert an ReLU layer with maximum value from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. ...
[ "def", "convert_advanced_relu", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[",...
Convert an ReLU layer with maximum value from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "an", "ReLU", "layer", "with", "maximum", "value", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L269-L302
28,942
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_separable_convolution
def convert_separable_convolution(builder, layer, input_names, output_names, keras_layer): """ Convert separable convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object....
python
def convert_separable_convolution(builder, layer, input_names, output_names, keras_layer): """ Convert separable convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object....
[ "def", "convert_separable_convolution", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "inp...
Convert separable convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "separable", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L451-L529
28,943
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_batchnorm
def convert_batchnorm(builder, layer, input_names, output_names, keras_layer): """ Convert a Batch Normalization layer. Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output names i...
python
def convert_batchnorm(builder, layer, input_names, output_names, keras_layer): """ Convert a Batch Normalization layer. Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output names i...
[ "def", "convert_batchnorm", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "...
Convert a Batch Normalization layer. Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "a", "Batch", "Normalization", "layer", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L531-L581
28,944
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_merge
def convert_merge(builder, layer, input_names, output_names, keras_layer): """ Convert concat layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and ou...
python
def convert_merge(builder, layer, input_names, output_names, keras_layer): """ Convert concat layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and ou...
[ "def", "convert_merge", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "output_name", "=", "output_names", "[", "0", "]", "mode", "=", "_get_elementwise_name_from_keras_layer", "(", ...
Convert concat layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "concat", "layer", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L621-L638
28,945
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_pooling
def convert_pooling(builder, layer, input_names, output_names, keras_layer): """ Convert pooling layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check_data_for...
python
def convert_pooling(builder, layer, input_names, output_names, keras_layer): """ Convert pooling layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check_data_for...
[ "def", "convert_pooling", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "...
Convert pooling layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "pooling", "layer", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L640-L729
28,946
apple/turicreate
src/external/xgboost/subtree/rabit/wrapper/rabit.py
_loadlib
def _loadlib(lib='standard'): """Load rabit library.""" global _LIB if _LIB is not None: warnings.warn('rabit.int call was ignored because it has'\ ' already been initialized', level=2) return if lib == 'standard': _LIB = ctypes.cdll.LoadLibrary(WRAPPER_...
python
def _loadlib(lib='standard'): """Load rabit library.""" global _LIB if _LIB is not None: warnings.warn('rabit.int call was ignored because it has'\ ' already been initialized', level=2) return if lib == 'standard': _LIB = ctypes.cdll.LoadLibrary(WRAPPER_...
[ "def", "_loadlib", "(", "lib", "=", "'standard'", ")", ":", "global", "_LIB", "if", "_LIB", "is", "not", "None", ":", "warnings", ".", "warn", "(", "'rabit.int call was ignored because it has'", "' already been initialized'", ",", "level", "=", "2", ")", "return...
Load rabit library.
[ "Load", "rabit", "library", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L25-L42
28,947
apple/turicreate
src/external/xgboost/subtree/rabit/wrapper/rabit.py
init
def init(args=None, lib='standard'): """Intialize the rabit module, call this once before using anything. Parameters ---------- args: list of str, optional The list of arguments used to initialized the rabit usually you need to pass in sys.argv. Defaults to sys.argv when it is N...
python
def init(args=None, lib='standard'): """Intialize the rabit module, call this once before using anything. Parameters ---------- args: list of str, optional The list of arguments used to initialized the rabit usually you need to pass in sys.argv. Defaults to sys.argv when it is N...
[ "def", "init", "(", "args", "=", "None", ",", "lib", "=", "'standard'", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "_loadlib", "(", "lib", ")", "arr", "=", "(", "ctypes", ".", "c_char_p", "*", "len", "(", "args", ...
Intialize the rabit module, call this once before using anything. Parameters ---------- args: list of str, optional The list of arguments used to initialized the rabit usually you need to pass in sys.argv. Defaults to sys.argv when it is None. lib: {'standard', 'mock', 'mpi'} ...
[ "Intialize", "the", "rabit", "module", "call", "this", "once", "before", "using", "anything", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L56-L73
28,948
apple/turicreate
src/external/xgboost/subtree/rabit/wrapper/rabit.py
allreduce
def allreduce(data, op, prepare_fun=None): """Perform allreduce, return the result. Parameters ---------- data: numpy array Input data. op: int Reduction operators, can be MIN, MAX, SUM, BITOR prepare_fun: function Lazy preprocessing function, if it is not None, prepare_...
python
def allreduce(data, op, prepare_fun=None): """Perform allreduce, return the result. Parameters ---------- data: numpy array Input data. op: int Reduction operators, can be MIN, MAX, SUM, BITOR prepare_fun: function Lazy preprocessing function, if it is not None, prepare_...
[ "def", "allreduce", "(", "data", ",", "op", ",", "prepare_fun", "=", "None", ")", ":", "if", "not", "isinstance", "(", "data", ",", "np", ".", "ndarray", ")", ":", "raise", "Exception", "(", "'allreduce only takes in numpy.ndarray'", ")", "buf", "=", "data...
Perform allreduce, return the result. Parameters ---------- data: numpy array Input data. op: int Reduction operators, can be MIN, MAX, SUM, BITOR prepare_fun: function Lazy preprocessing function, if it is not None, prepare_fun(data) will be called by the function b...
[ "Perform", "allreduce", "return", "the", "result", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L183-L226
28,949
apple/turicreate
src/external/xgboost/subtree/rabit/wrapper/rabit.py
load_checkpoint
def load_checkpoint(with_local=False): """Load latest check point. Parameters ---------- with_local: bool, optional whether the checkpoint contains local model Returns ------- tuple : tuple if with_local: return (version, gobal_model, local_model) else return (versi...
python
def load_checkpoint(with_local=False): """Load latest check point. Parameters ---------- with_local: bool, optional whether the checkpoint contains local model Returns ------- tuple : tuple if with_local: return (version, gobal_model, local_model) else return (versi...
[ "def", "load_checkpoint", "(", "with_local", "=", "False", ")", ":", "gptr", "=", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_char", ")", "(", ")", "global_len", "=", "ctypes", ".", "c_ulong", "(", ")", "if", "with_local", ":", "lptr", "=", "ctype...
Load latest check point. Parameters ---------- with_local: bool, optional whether the checkpoint contains local model Returns ------- tuple : tuple if with_local: return (version, gobal_model, local_model) else return (version, gobal_model) if returned version =...
[ "Load", "latest", "check", "point", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L242-L281
28,950
apple/turicreate
src/external/xgboost/subtree/rabit/wrapper/rabit.py
checkpoint
def checkpoint(global_model, local_model=None): """Checkpoint the model. This means we finished a stage of execution. Every time we call check point, there is a version number which will increase by one. Parameters ---------- global_model: anytype that can be pickled globally shared mo...
python
def checkpoint(global_model, local_model=None): """Checkpoint the model. This means we finished a stage of execution. Every time we call check point, there is a version number which will increase by one. Parameters ---------- global_model: anytype that can be pickled globally shared mo...
[ "def", "checkpoint", "(", "global_model", ",", "local_model", "=", "None", ")", ":", "sglobal", "=", "pickle", ".", "dumps", "(", "global_model", ")", "if", "local_model", "is", "None", ":", "_LIB", ".", "RabitCheckPoint", "(", "sglobal", ",", "len", "(", ...
Checkpoint the model. This means we finished a stage of execution. Every time we call check point, there is a version number which will increase by one. Parameters ---------- global_model: anytype that can be pickled globally shared model/state when calling this function, the calle...
[ "Checkpoint", "the", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L283-L314
28,951
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/ranking_factorization_recommender.py
create
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, num_factors=32, regularization=1e-9, linear_regularization=1e-9, side_data_factorization=True, ranking_regularization=0.25, ...
python
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, num_factors=32, regularization=1e-9, linear_regularization=1e-9, side_data_factorization=True, ranking_regularization=0.25, ...
[ "def", "create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "num_factors", "=", "32", ",", "regularization", "=...
Create a RankingFactorizationRecommender that learns latent factors for each user and item and uses them to make rating predictions. Parameters ---------- observation_data : SFrame The dataset to use for training the model. It must contain a column of user ids and a column of item ids. ...
[ "Create", "a", "RankingFactorizationRecommender", "that", "learns", "latent", "factors", "for", "each", "user", "and", "item", "and", "uses", "them", "to", "make", "rating", "predictions", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/ranking_factorization_recommender.py#L19-L270
28,952
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py
_get_converter_module
def _get_converter_module(sk_obj): """ Returns the module holding the conversion functions for a particular model). """ try: cv_idx = _converter_lookup[sk_obj.__class__] except KeyError: raise ValueError( "Transformer '%s' not supported; supported transformers are...
python
def _get_converter_module(sk_obj): """ Returns the module holding the conversion functions for a particular model). """ try: cv_idx = _converter_lookup[sk_obj.__class__] except KeyError: raise ValueError( "Transformer '%s' not supported; supported transformers are...
[ "def", "_get_converter_module", "(", "sk_obj", ")", ":", "try", ":", "cv_idx", "=", "_converter_lookup", "[", "sk_obj", ".", "__class__", "]", "except", "KeyError", ":", "raise", "ValueError", "(", "\"Transformer '%s' not supported; supported transformers are %s.\"", "%...
Returns the module holding the conversion functions for a particular model).
[ "Returns", "the", "module", "holding", "the", "conversion", "functions", "for", "a", "particular", "model", ")", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py#L87-L100
28,953
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py
TreeEnsembleBase.set_post_evaluation_transform
def set_post_evaluation_transform(self, value): r""" Set the post processing transform applied after the prediction value from the tree ensemble. Parameters ---------- value: str A value denoting the transform applied. Possible values are: - "...
python
def set_post_evaluation_transform(self, value): r""" Set the post processing transform applied after the prediction value from the tree ensemble. Parameters ---------- value: str A value denoting the transform applied. Possible values are: - "...
[ "def", "set_post_evaluation_transform", "(", "self", ",", "value", ")", ":", "self", ".", "tree_spec", ".", "postEvaluationTransform", "=", "_TreeEnsemble_pb2", ".", "TreeEnsemblePostEvaluationTransform", ".", "Value", "(", "value", ")" ]
r""" Set the post processing transform applied after the prediction value from the tree ensemble. Parameters ---------- value: str A value denoting the transform applied. Possible values are: - "NoTransform" (default). Do not apply a transform. ...
[ "r", "Set", "the", "post", "processing", "transform", "applied", "after", "the", "prediction", "value", "from", "the", "tree", "ensemble", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L57-L97
28,954
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py
TreeEnsembleBase.add_branch_node
def add_branch_node(self, tree_id, node_id, feature_index, feature_value, branch_mode, true_child_id, false_child_id, relative_hit_rate = None, missing_value_tracks_true_child = False): """ Add a branch node to the tree ensemble. Parameters ---------- tre...
python
def add_branch_node(self, tree_id, node_id, feature_index, feature_value, branch_mode, true_child_id, false_child_id, relative_hit_rate = None, missing_value_tracks_true_child = False): """ Add a branch node to the tree ensemble. Parameters ---------- tre...
[ "def", "add_branch_node", "(", "self", ",", "tree_id", ",", "node_id", ",", "feature_index", ",", "feature_value", ",", "branch_mode", ",", "true_child_id", ",", "false_child_id", ",", "relative_hit_rate", "=", "None", ",", "missing_value_tracks_true_child", "=", "F...
Add a branch node to the tree ensemble. Parameters ---------- tree_id: int ID of the tree to add the node to. node_id: int ID of the node within the tree. feature_index: int Index of the feature in the input being split on. feature_...
[ "Add", "a", "branch", "node", "to", "the", "tree", "ensemble", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L99-L186
28,955
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py
TreeEnsembleBase.add_leaf_node
def add_leaf_node(self, tree_id, node_id, values, relative_hit_rate = None): """ Add a leaf node to the tree ensemble. Parameters ---------- tree_id: int ID of the tree to add the node to. node_id: int ID of the node within the tree. val...
python
def add_leaf_node(self, tree_id, node_id, values, relative_hit_rate = None): """ Add a leaf node to the tree ensemble. Parameters ---------- tree_id: int ID of the tree to add the node to. node_id: int ID of the node within the tree. val...
[ "def", "add_leaf_node", "(", "self", ",", "tree_id", ",", "node_id", ",", "values", ",", "relative_hit_rate", "=", "None", ")", ":", "spec_node", "=", "self", ".", "tree_parameters", ".", "nodes", ".", "add", "(", ")", "spec_node", ".", "treeId", "=", "t...
Add a leaf node to the tree ensemble. Parameters ---------- tree_id: int ID of the tree to add the node to. node_id: int ID of the node within the tree. values: [float | int | list | dict] Value(s) at the leaf node to add to the prediction w...
[ "Add", "a", "leaf", "node", "to", "the", "tree", "ensemble", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L188-L235
28,956
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
create
def create (raw_properties = []): """ Creates a new 'PropertySet' instance for the given raw properties, or returns an already existing one. """ assert (is_iterable_typed(raw_properties, property.Property) or is_iterable_typed(raw_properties, basestring)) # FIXME: propagate to caller...
python
def create (raw_properties = []): """ Creates a new 'PropertySet' instance for the given raw properties, or returns an already existing one. """ assert (is_iterable_typed(raw_properties, property.Property) or is_iterable_typed(raw_properties, basestring)) # FIXME: propagate to caller...
[ "def", "create", "(", "raw_properties", "=", "[", "]", ")", ":", "assert", "(", "is_iterable_typed", "(", "raw_properties", ",", "property", ".", "Property", ")", "or", "is_iterable_typed", "(", "raw_properties", ",", "basestring", ")", ")", "# FIXME: propagate ...
Creates a new 'PropertySet' instance for the given raw properties, or returns an already existing one.
[ "Creates", "a", "new", "PropertySet", "instance", "for", "the", "given", "raw", "properties", "or", "returns", "an", "already", "existing", "one", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L36-L61
28,957
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
create_with_validation
def create_with_validation (raw_properties): """ Creates new 'PropertySet' instances after checking that all properties are valid and converting implicit properties into gristed form. """ assert is_iterable_typed(raw_properties, basestring) properties = [property.create_from_string(s) fo...
python
def create_with_validation (raw_properties): """ Creates new 'PropertySet' instances after checking that all properties are valid and converting implicit properties into gristed form. """ assert is_iterable_typed(raw_properties, basestring) properties = [property.create_from_string(s) fo...
[ "def", "create_with_validation", "(", "raw_properties", ")", ":", "assert", "is_iterable_typed", "(", "raw_properties", ",", "basestring", ")", "properties", "=", "[", "property", ".", "create_from_string", "(", "s", ")", "for", "s", "in", "raw_properties", "]", ...
Creates new 'PropertySet' instances after checking that all properties are valid and converting implicit properties into gristed form.
[ "Creates", "new", "PropertySet", "instances", "after", "checking", "that", "all", "properties", "are", "valid", "and", "converting", "implicit", "properties", "into", "gristed", "form", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L63-L72
28,958
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
create_from_user_input
def create_from_user_input(raw_properties, jamfile_module, location): """Creates a property-set from the input given by the user, in the context of 'jamfile-module' at 'location'""" assert is_iterable_typed(raw_properties, basestring) assert isinstance(jamfile_module, basestring) assert isinstance(l...
python
def create_from_user_input(raw_properties, jamfile_module, location): """Creates a property-set from the input given by the user, in the context of 'jamfile-module' at 'location'""" assert is_iterable_typed(raw_properties, basestring) assert isinstance(jamfile_module, basestring) assert isinstance(l...
[ "def", "create_from_user_input", "(", "raw_properties", ",", "jamfile_module", ",", "location", ")", ":", "assert", "is_iterable_typed", "(", "raw_properties", ",", "basestring", ")", "assert", "isinstance", "(", "jamfile_module", ",", "basestring", ")", "assert", "...
Creates a property-set from the input given by the user, in the context of 'jamfile-module' at 'location
[ "Creates", "a", "property", "-", "set", "from", "the", "input", "given", "by", "the", "user", "in", "the", "context", "of", "jamfile", "-", "module", "at", "location" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L79-L94
28,959
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.base
def base (self): """ Returns properties that are neither incidental nor free. """ result = [p for p in self.lazy_properties if not(p.feature.incidental or p.feature.free)] result.extend(self.base_) return result
python
def base (self): """ Returns properties that are neither incidental nor free. """ result = [p for p in self.lazy_properties if not(p.feature.incidental or p.feature.free)] result.extend(self.base_) return result
[ "def", "base", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "not", "(", "p", ".", "feature", ".", "incidental", "or", "p", ".", "feature", ".", "free", ")", "]", "result", ".", "extend", ...
Returns properties that are neither incidental nor free.
[ "Returns", "properties", "that", "are", "neither", "incidental", "nor", "free", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L264-L270
28,960
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.free
def free (self): """ Returns free properties which are not dependency properties. """ result = [p for p in self.lazy_properties if not p.feature.incidental and p.feature.free] result.extend(self.free_) return result
python
def free (self): """ Returns free properties which are not dependency properties. """ result = [p for p in self.lazy_properties if not p.feature.incidental and p.feature.free] result.extend(self.free_) return result
[ "def", "free", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "not", "p", ".", "feature", ".", "incidental", "and", "p", ".", "feature", ".", "free", "]", "result", ".", "extend", "(", "self"...
Returns free properties which are not dependency properties.
[ "Returns", "free", "properties", "which", "are", "not", "dependency", "properties", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L272-L278
28,961
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.dependency
def dependency (self): """ Returns dependency properties. """ result = [p for p in self.lazy_properties if p.feature.dependency] result.extend(self.dependency_) return self.dependency_
python
def dependency (self): """ Returns dependency properties. """ result = [p for p in self.lazy_properties if p.feature.dependency] result.extend(self.dependency_) return self.dependency_
[ "def", "dependency", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "p", ".", "feature", ".", "dependency", "]", "result", ".", "extend", "(", "self", ".", "dependency_", ")", "return", "self", ...
Returns dependency properties.
[ "Returns", "dependency", "properties", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L283-L288
28,962
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.non_dependency
def non_dependency (self): """ Returns properties that are not dependencies. """ result = [p for p in self.lazy_properties if not p.feature.dependency] result.extend(self.non_dependency_) return result
python
def non_dependency (self): """ Returns properties that are not dependencies. """ result = [p for p in self.lazy_properties if not p.feature.dependency] result.extend(self.non_dependency_) return result
[ "def", "non_dependency", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "not", "p", ".", "feature", ".", "dependency", "]", "result", ".", "extend", "(", "self", ".", "non_dependency_", ")", "ret...
Returns properties that are not dependencies.
[ "Returns", "properties", "that", "are", "not", "dependencies", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L290-L295
28,963
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.incidental
def incidental (self): """ Returns incidental properties. """ result = [p for p in self.lazy_properties if p.feature.incidental] result.extend(self.incidental_) return result
python
def incidental (self): """ Returns incidental properties. """ result = [p for p in self.lazy_properties if p.feature.incidental] result.extend(self.incidental_) return result
[ "def", "incidental", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "p", ".", "feature", ".", "incidental", "]", "result", ".", "extend", "(", "self", ".", "incidental_", ")", "return", "result" ...
Returns incidental properties.
[ "Returns", "incidental", "properties", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L307-L312
28,964
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.refine
def refine (self, requirements): """ Refines this set's properties using the requirements passed as an argument. """ assert isinstance(requirements, PropertySet) if requirements not in self.refined_: r = property.refine(self.all_, requirements.all_) self.refined_...
python
def refine (self, requirements): """ Refines this set's properties using the requirements passed as an argument. """ assert isinstance(requirements, PropertySet) if requirements not in self.refined_: r = property.refine(self.all_, requirements.all_) self.refined_...
[ "def", "refine", "(", "self", ",", "requirements", ")", ":", "assert", "isinstance", "(", "requirements", ",", "PropertySet", ")", "if", "requirements", "not", "in", "self", ".", "refined_", ":", "r", "=", "property", ".", "refine", "(", "self", ".", "al...
Refines this set's properties using the requirements passed as an argument.
[ "Refines", "this", "set", "s", "properties", "using", "the", "requirements", "passed", "as", "an", "argument", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L314-L323
28,965
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.target_path
def target_path (self): """ Computes the target path that should be used for target with these properties. Returns a tuple of - the computed path - if the path is relative to build directory, a value of 'true'. """ if not self.t...
python
def target_path (self): """ Computes the target path that should be used for target with these properties. Returns a tuple of - the computed path - if the path is relative to build directory, a value of 'true'. """ if not self.t...
[ "def", "target_path", "(", "self", ")", ":", "if", "not", "self", ".", "target_path_", ":", "# The <location> feature can be used to explicitly", "# change the location of generated targets", "l", "=", "self", ".", "get", "(", "'<location>'", ")", "if", "l", ":", "c...
Computes the target path that should be used for target with these properties. Returns a tuple of - the computed path - if the path is relative to build directory, a value of 'true'.
[ "Computes", "the", "target", "path", "that", "should", "be", "used", "for", "target", "with", "these", "properties", ".", "Returns", "a", "tuple", "of", "-", "the", "computed", "path", "-", "if", "the", "path", "is", "relative", "to", "build", "directory",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L395-L439
28,966
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.add
def add (self, ps): """ Creates a new property set containing the properties in this one, plus the ones of the property set passed as argument. """ assert isinstance(ps, PropertySet) if ps not in self.added_: self.added_[ps] = create(self.all_ + ps.all()) ...
python
def add (self, ps): """ Creates a new property set containing the properties in this one, plus the ones of the property set passed as argument. """ assert isinstance(ps, PropertySet) if ps not in self.added_: self.added_[ps] = create(self.all_ + ps.all()) ...
[ "def", "add", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "PropertySet", ")", "if", "ps", "not", "in", "self", ".", "added_", ":", "self", ".", "added_", "[", "ps", "]", "=", "create", "(", "self", ".", "all_", "+", ...
Creates a new property set containing the properties in this one, plus the ones of the property set passed as argument.
[ "Creates", "a", "new", "property", "set", "containing", "the", "properties", "in", "this", "one", "plus", "the", "ones", "of", "the", "property", "set", "passed", "as", "argument", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L441-L448
28,967
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.get
def get (self, feature): """ Returns all values of 'feature'. """ if type(feature) == type([]): feature = feature[0] if not isinstance(feature, b2.build.feature.Feature): feature = b2.build.feature.get(feature) assert isinstance(feature, b2.build.feature.F...
python
def get (self, feature): """ Returns all values of 'feature'. """ if type(feature) == type([]): feature = feature[0] if not isinstance(feature, b2.build.feature.Feature): feature = b2.build.feature.get(feature) assert isinstance(feature, b2.build.feature.F...
[ "def", "get", "(", "self", ",", "feature", ")", ":", "if", "type", "(", "feature", ")", "==", "type", "(", "[", "]", ")", ":", "feature", "=", "feature", "[", "0", "]", "if", "not", "isinstance", "(", "feature", ",", "b2", ".", "build", ".", "f...
Returns all values of 'feature'.
[ "Returns", "all", "values", "of", "feature", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L457-L474
28,968
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
PropertySet.get_properties
def get_properties(self, feature): """Returns all contained properties associated with 'feature'""" if not isinstance(feature, b2.build.feature.Feature): feature = b2.build.feature.get(feature) assert isinstance(feature, b2.build.feature.Feature) result = [] for p in...
python
def get_properties(self, feature): """Returns all contained properties associated with 'feature'""" if not isinstance(feature, b2.build.feature.Feature): feature = b2.build.feature.get(feature) assert isinstance(feature, b2.build.feature.Feature) result = [] for p in...
[ "def", "get_properties", "(", "self", ",", "feature", ")", ":", "if", "not", "isinstance", "(", "feature", ",", "b2", ".", "build", ".", "feature", ".", "Feature", ")", ":", "feature", "=", "b2", ".", "build", ".", "feature", ".", "get", "(", "featur...
Returns all contained properties associated with 'feature
[ "Returns", "all", "contained", "properties", "associated", "with", "feature" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L477-L487
28,969
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_create
def _create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, ranking=True, verbose=True): """ A unified interface for training recommender models. Based on simple characteristics of the data, a type of model is s...
python
def _create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, ranking=True, verbose=True): """ A unified interface for training recommender models. Based on simple characteristics of the data, a type of model is s...
[ "def", "_create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "ranking", "=", "True", ",", "verbose", "=", "Tr...
A unified interface for training recommender models. Based on simple characteristics of the data, a type of model is selected and trained. The trained model can be used to predict ratings and make recommendations. To use specific options of a desired model, use the ``create`` function of the correspond...
[ "A", "unified", "interface", "for", "training", "recommender", "models", ".", "Based", "on", "simple", "characteristics", "of", "the", "data", "a", "type", "of", "model", "is", "selected", "and", "trained", ".", "The", "trained", "model", "can", "be", "used"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L24-L175
28,970
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
compare_models
def compare_models(dataset, models, model_names=None, user_sample=1.0, metric='auto', target=None, exclude_known_for_precision_recall=True, make_plot=False, verbose=True, **kwargs): """ Compare the ...
python
def compare_models(dataset, models, model_names=None, user_sample=1.0, metric='auto', target=None, exclude_known_for_precision_recall=True, make_plot=False, verbose=True, **kwargs): """ Compare the ...
[ "def", "compare_models", "(", "dataset", ",", "models", ",", "model_names", "=", "None", ",", "user_sample", "=", "1.0", ",", "metric", "=", "'auto'", ",", "target", "=", "None", ",", "exclude_known_for_precision_recall", "=", "True", ",", "make_plot", "=", ...
Compare the prediction or recommendation performance of recommender models on a common test dataset. Models that are trained to predict ratings are compared separately from models that are trained without target ratings. The ratings prediction models are compared on root-mean-squared error, and the re...
[ "Compare", "the", "prediction", "or", "recommendation", "performance", "of", "recommender", "models", "on", "a", "common", "test", "dataset", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L177-L328
28,971
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
precision_recall_by_user
def precision_recall_by_user(observed_user_items, recommendations, cutoffs=[10]): """ Compute precision and recall at a given cutoff for each user. In information retrieval terms, precision represents the ratio of relevant, retrieved items to the...
python
def precision_recall_by_user(observed_user_items, recommendations, cutoffs=[10]): """ Compute precision and recall at a given cutoff for each user. In information retrieval terms, precision represents the ratio of relevant, retrieved items to the...
[ "def", "precision_recall_by_user", "(", "observed_user_items", ",", "recommendations", ",", "cutoffs", "=", "[", "10", "]", ")", ":", "assert", "type", "(", "observed_user_items", ")", "==", "_SFrame", "assert", "type", "(", "recommendations", ")", "==", "_SFram...
Compute precision and recall at a given cutoff for each user. In information retrieval terms, precision represents the ratio of relevant, retrieved items to the number of relevant items. Recall represents the ratio of relevant, retrieved items to the number of relevant items. Let :math:`p_k` be a vecto...
[ "Compute", "precision", "and", "recall", "at", "a", "given", "cutoff", "for", "each", "user", ".", "In", "information", "retrieval", "terms", "precision", "represents", "the", "ratio", "of", "relevant", "retrieved", "items", "to", "the", "number", "of", "relev...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L331-L427
28,972
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
random_split_by_user
def random_split_by_user(dataset, user_id='user_id', item_id='item_id', max_num_users=1000, item_test_proportion=.2, random_seed=0): """Create a recommender-friendly train-test split of the p...
python
def random_split_by_user(dataset, user_id='user_id', item_id='item_id', max_num_users=1000, item_test_proportion=.2, random_seed=0): """Create a recommender-friendly train-test split of the p...
[ "def", "random_split_by_user", "(", "dataset", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "max_num_users", "=", "1000", ",", "item_test_proportion", "=", ".2", ",", "random_seed", "=", "0", ")", ":", "assert", "user_id", "in", "...
Create a recommender-friendly train-test split of the provided data set. The test dataset is generated by first choosing `max_num_users` out of the total number of users in `dataset`. Then, for each of the chosen test users, a portion of the user's items (determined by `item_test_proportion`) is random...
[ "Create", "a", "recommender", "-", "friendly", "train", "-", "test", "split", "of", "the", "provided", "data", "set", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L430-L508
28,973
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender._list_fields
def _list_fields(self): """ Get the current settings of the model. The keys depend on the type of model. Returns ------- out : list A list of fields that can be queried using the ``get`` method. """ response = self.__proxy__.list_fields() ...
python
def _list_fields(self): """ Get the current settings of the model. The keys depend on the type of model. Returns ------- out : list A list of fields that can be queried using the ``get`` method. """ response = self.__proxy__.list_fields() ...
[ "def", "_list_fields", "(", "self", ")", ":", "response", "=", "self", ".", "__proxy__", ".", "list_fields", "(", ")", "return", "[", "s", "for", "s", "in", "response", "[", "'value'", "]", "if", "not", "s", ".", "startswith", "(", "\"_\"", ")", "]" ...
Get the current settings of the model. The keys depend on the type of model. Returns ------- out : list A list of fields that can be queried using the ``get`` method.
[ "Get", "the", "current", "settings", "of", "the", "model", ".", "The", "keys", "depend", "on", "the", "type", "of", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L543-L555
28,974
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender._set_current_options
def _set_current_options(self, options): """ Set current options for a model. Parameters ---------- options : dict A dictionary of the desired option settings. The key should be the name of the option and each value is the desired value of the option. ...
python
def _set_current_options(self, options): """ Set current options for a model. Parameters ---------- options : dict A dictionary of the desired option settings. The key should be the name of the option and each value is the desired value of the option. ...
[ "def", "_set_current_options", "(", "self", ",", "options", ")", ":", "opts", "=", "self", ".", "_get_current_options", "(", ")", "opts", ".", "update", "(", "options", ")", "response", "=", "self", ".", "__proxy__", ".", "set_current_options", "(", "opts", ...
Set current options for a model. Parameters ---------- options : dict A dictionary of the desired option settings. The key should be the name of the option and each value is the desired value of the option.
[ "Set", "current", "options", "for", "a", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L804-L818
28,975
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.__prepare_dataset_parameter
def __prepare_dataset_parameter(self, dataset): """ Processes the dataset parameter for type correctness. Returns it as an SFrame. """ # Translate the dataset argument into the proper type if not isinstance(dataset, _SFrame): def raise_dataset_type_exception(...
python
def __prepare_dataset_parameter(self, dataset): """ Processes the dataset parameter for type correctness. Returns it as an SFrame. """ # Translate the dataset argument into the proper type if not isinstance(dataset, _SFrame): def raise_dataset_type_exception(...
[ "def", "__prepare_dataset_parameter", "(", "self", ",", "dataset", ")", ":", "# Translate the dataset argument into the proper type", "if", "not", "isinstance", "(", "dataset", ",", "_SFrame", ")", ":", "def", "raise_dataset_type_exception", "(", ")", ":", "raise", "T...
Processes the dataset parameter for type correctness. Returns it as an SFrame.
[ "Processes", "the", "dataset", "parameter", "for", "type", "correctness", ".", "Returns", "it", "as", "an", "SFrame", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L820-L843
28,976
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.predict
def predict(self, dataset, new_observation_data=None, new_user_data=None, new_item_data=None): """ Return a score prediction for the user ids and item ids in the provided data set. Parameters ---------- dataset : SFrame Dataset in the same for...
python
def predict(self, dataset, new_observation_data=None, new_user_data=None, new_item_data=None): """ Return a score prediction for the user ids and item ids in the provided data set. Parameters ---------- dataset : SFrame Dataset in the same for...
[ "def", "predict", "(", "self", ",", "dataset", ",", "new_observation_data", "=", "None", ",", "new_user_data", "=", "None", ",", "new_item_data", "=", "None", ")", ":", "if", "new_observation_data", "is", "None", ":", "new_observation_data", "=", "_SFrame", "(...
Return a score prediction for the user ids and item ids in the provided data set. Parameters ---------- dataset : SFrame Dataset in the same form used for training. new_observation_data : SFrame, optional ``new_observation_data`` gives additional observa...
[ "Return", "a", "score", "prediction", "for", "the", "user", "ids", "and", "item", "ids", "in", "the", "provided", "data", "set", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L859-L925
28,977
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.get_similar_items
def get_similar_items(self, items=None, k=10, verbose=False): """ Get the k most similar items for each item in items. Each type of recommender has its own model for the similarity between items. For example, the item_similarity_recommender will return the most similar items acc...
python
def get_similar_items(self, items=None, k=10, verbose=False): """ Get the k most similar items for each item in items. Each type of recommender has its own model for the similarity between items. For example, the item_similarity_recommender will return the most similar items acc...
[ "def", "get_similar_items", "(", "self", ",", "items", "=", "None", ",", "k", "=", "10", ",", "verbose", "=", "False", ")", ":", "if", "items", "is", "None", ":", "get_all_items", "=", "True", "items", "=", "_SArray", "(", ")", "else", ":", "get_all_...
Get the k most similar items for each item in items. Each type of recommender has its own model for the similarity between items. For example, the item_similarity_recommender will return the most similar items according to the user-chosen similarity; the factorization_recommender will r...
[ "Get", "the", "k", "most", "similar", "items", "for", "each", "item", "in", "items", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L927-L988
28,978
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.get_similar_users
def get_similar_users(self, users=None, k=10): """Get the k most similar users for each entry in `users`. Each type of recommender has its own model for the similarity between users. For example, the factorization_recommender will return the nearest users based on the cosine similarity ...
python
def get_similar_users(self, users=None, k=10): """Get the k most similar users for each entry in `users`. Each type of recommender has its own model for the similarity between users. For example, the factorization_recommender will return the nearest users based on the cosine similarity ...
[ "def", "get_similar_users", "(", "self", ",", "users", "=", "None", ",", "k", "=", "10", ")", ":", "if", "users", "is", "None", ":", "get_all_users", "=", "True", "users", "=", "_SArray", "(", ")", "else", ":", "get_all_users", "=", "False", "if", "i...
Get the k most similar users for each entry in `users`. Each type of recommender has its own model for the similarity between users. For example, the factorization_recommender will return the nearest users based on the cosine similarity between latent user factors. (This method is not ...
[ "Get", "the", "k", "most", "similar", "users", "for", "each", "entry", "in", "users", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L990-L1053
28,979
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.recommend_from_interactions
def recommend_from_interactions( self, observed_items, k=10, exclude=None, items=None, new_user_data=None, new_item_data=None, exclude_known=True, diversity=0, random_seed=None, verbose=True): """ Recommend the ``k`` highest scored items based on the ...
python
def recommend_from_interactions( self, observed_items, k=10, exclude=None, items=None, new_user_data=None, new_item_data=None, exclude_known=True, diversity=0, random_seed=None, verbose=True): """ Recommend the ``k`` highest scored items based on the ...
[ "def", "recommend_from_interactions", "(", "self", ",", "observed_items", ",", "k", "=", "10", ",", "exclude", "=", "None", ",", "items", "=", "None", ",", "new_user_data", "=", "None", ",", "new_item_data", "=", "None", ",", "exclude_known", "=", "True", ...
Recommend the ``k`` highest scored items based on the interactions given in `observed_items.` Parameters ---------- observed_items : SArray, SFrame, or list A list/SArray of items to use to make recommendations, or an SFrame of items and optionally ratings and/or...
[ "Recommend", "the", "k", "highest", "scored", "items", "based", "on", "the", "interactions", "given", "in", "observed_items", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1310-L1470
28,980
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.evaluate_precision_recall
def evaluate_precision_recall(self, dataset, cutoffs=list(range(1,11,1))+list(range(11,50,5)), skip_set=None, exclude_known=True, verbose=True, **kwargs): """ Compute a model's precision and recall scores for a particular dataset. ...
python
def evaluate_precision_recall(self, dataset, cutoffs=list(range(1,11,1))+list(range(11,50,5)), skip_set=None, exclude_known=True, verbose=True, **kwargs): """ Compute a model's precision and recall scores for a particular dataset. ...
[ "def", "evaluate_precision_recall", "(", "self", ",", "dataset", ",", "cutoffs", "=", "list", "(", "range", "(", "1", ",", "11", ",", "1", ")", ")", "+", "list", "(", "range", "(", "11", ",", "50", ",", "5", ")", ")", ",", "skip_set", "=", "None"...
Compute a model's precision and recall scores for a particular dataset. Parameters ---------- dataset : SFrame An SFrame in the same format as the one used during training. This will be compared to the model's recommendations, which exclude the (user, item) p...
[ "Compute", "a", "model", "s", "precision", "and", "recall", "scores", "for", "a", "particular", "dataset", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1492-L1574
28,981
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.evaluate_rmse
def evaluate_rmse(self, dataset, target): """ Evaluate the prediction error for each user-item pair in the given data set. Parameters ---------- dataset : SFrame An SFrame in the same format as the one used during training. target : str T...
python
def evaluate_rmse(self, dataset, target): """ Evaluate the prediction error for each user-item pair in the given data set. Parameters ---------- dataset : SFrame An SFrame in the same format as the one used during training. target : str T...
[ "def", "evaluate_rmse", "(", "self", ",", "dataset", ",", "target", ")", ":", "assert", "target", "in", "dataset", ".", "column_names", "(", ")", ",", "'Provided dataset must contain a target column with the same \\\n name as the target used during training.'", ...
Evaluate the prediction error for each user-item pair in the given data set. Parameters ---------- dataset : SFrame An SFrame in the same format as the one used during training. target : str The name of the target rating column in `dataset`. Ret...
[ "Evaluate", "the", "prediction", "error", "for", "each", "user", "-", "item", "pair", "in", "the", "given", "data", "set", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1576-L1635
28,982
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender.evaluate
def evaluate(self, dataset, metric='auto', exclude_known_for_precision_recall=True, target=None, verbose=True, **kwargs): r""" Evaluate the model's ability to make rating predictions or recommendations. If the model is trained to predic...
python
def evaluate(self, dataset, metric='auto', exclude_known_for_precision_recall=True, target=None, verbose=True, **kwargs): r""" Evaluate the model's ability to make rating predictions or recommendations. If the model is trained to predic...
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "exclude_known_for_precision_recall", "=", "True", ",", "target", "=", "None", ",", "verbose", "=", "True", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "}", "dat...
r""" Evaluate the model's ability to make rating predictions or recommendations. If the model is trained to predict a particular target, the default metric used for model comparison is root-mean-squared error (RMSE). Suppose :math:`y` and :math:`\widehat{y}` are vectors of lengt...
[ "r", "Evaluate", "the", "model", "s", "ability", "to", "make", "rating", "predictions", "or", "recommendations", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1637-L1761
28,983
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender._get_popularity_baseline
def _get_popularity_baseline(self): """ Returns a new popularity model matching the data set this model was trained with. Can be used for comparison purposes. """ response = self.__proxy__.get_popularity_baseline() from .popularity_recommender import PopularityRecommen...
python
def _get_popularity_baseline(self): """ Returns a new popularity model matching the data set this model was trained with. Can be used for comparison purposes. """ response = self.__proxy__.get_popularity_baseline() from .popularity_recommender import PopularityRecommen...
[ "def", "_get_popularity_baseline", "(", "self", ")", ":", "response", "=", "self", ".", "__proxy__", ".", "get_popularity_baseline", "(", ")", "from", ".", "popularity_recommender", "import", "PopularityRecommender", "return", "PopularityRecommender", "(", "response", ...
Returns a new popularity model matching the data set this model was trained with. Can be used for comparison purposes.
[ "Returns", "a", "new", "popularity", "model", "matching", "the", "data", "set", "this", "model", "was", "trained", "with", ".", "Can", "be", "used", "for", "comparison", "purposes", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1763-L1772
28,984
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender._get_item_intersection_info
def _get_item_intersection_info(self, item_pairs): """ For a collection of item -> item pairs, returns information about the users in that intersection. Parameters ---------- item_pairs : 2-column SFrame of two item columns, or a list of (item_1, item_2) tupl...
python
def _get_item_intersection_info(self, item_pairs): """ For a collection of item -> item pairs, returns information about the users in that intersection. Parameters ---------- item_pairs : 2-column SFrame of two item columns, or a list of (item_1, item_2) tupl...
[ "def", "_get_item_intersection_info", "(", "self", ",", "item_pairs", ")", ":", "if", "type", "(", "item_pairs", ")", "is", "list", ":", "if", "not", "all", "(", "type", "(", "t", ")", "in", "[", "list", ",", "tuple", "]", "and", "len", "(", "t", "...
For a collection of item -> item pairs, returns information about the users in that intersection. Parameters ---------- item_pairs : 2-column SFrame of two item columns, or a list of (item_1, item_2) tuples. Returns ------- out : SFrame A ...
[ "For", "a", "collection", "of", "item", "-", ">", "item", "pairs", "returns", "information", "about", "the", "users", "in", "that", "intersection", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1774-L1809
28,985
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/common.py
utils.query_boost_version
def query_boost_version(boost_root): ''' Read in the Boost version from a given boost_root. ''' boost_version = None if os.path.exists(os.path.join(boost_root,'Jamroot')): with codecs.open(os.path.join(boost_root,'Jamroot'), 'r', 'utf-8') as f: for lin...
python
def query_boost_version(boost_root): ''' Read in the Boost version from a given boost_root. ''' boost_version = None if os.path.exists(os.path.join(boost_root,'Jamroot')): with codecs.open(os.path.join(boost_root,'Jamroot'), 'r', 'utf-8') as f: for lin...
[ "def", "query_boost_version", "(", "boost_root", ")", ":", "boost_version", "=", "None", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "boost_root", ",", "'Jamroot'", ")", ")", ":", "with", "codecs", ".", "open", "("...
Read in the Boost version from a given boost_root.
[ "Read", "in", "the", "Boost", "version", "from", "a", "given", "boost_root", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L421-L435
28,986
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/common.py
utils.git_clone
def git_clone(sub_repo, branch, commit = None, cwd = None, no_submodules = False): ''' This clone mimicks the way Travis-CI clones a project's repo. So far Travis-CI is the most limiting in the sense of only fetching partial history of the repo. ''' if not cwd: ...
python
def git_clone(sub_repo, branch, commit = None, cwd = None, no_submodules = False): ''' This clone mimicks the way Travis-CI clones a project's repo. So far Travis-CI is the most limiting in the sense of only fetching partial history of the repo. ''' if not cwd: ...
[ "def", "git_clone", "(", "sub_repo", ",", "branch", ",", "commit", "=", "None", ",", "cwd", "=", "None", ",", "no_submodules", "=", "False", ")", ":", "if", "not", "cwd", ":", "cwd", "=", "cwd", "=", "os", ".", "getcwd", "(", ")", "root_dir", "=", ...
This clone mimicks the way Travis-CI clones a project's repo. So far Travis-CI is the most limiting in the sense of only fetching partial history of the repo.
[ "This", "clone", "mimicks", "the", "way", "Travis", "-", "CI", "clones", "a", "project", "s", "repo", ".", "So", "far", "Travis", "-", "CI", "is", "the", "most", "limiting", "in", "the", "sense", "of", "only", "fetching", "partial", "history", "of", "t...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L438-L471
28,987
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/common.py
ci_travis.install_toolset
def install_toolset(self, toolset): ''' Installs specific toolset on CI system. ''' info = toolset_info[toolset] if sys.platform.startswith('linux'): os.chdir(self.work_dir) if 'ppa' in info: for ppa in info['ppa']: util...
python
def install_toolset(self, toolset): ''' Installs specific toolset on CI system. ''' info = toolset_info[toolset] if sys.platform.startswith('linux'): os.chdir(self.work_dir) if 'ppa' in info: for ppa in info['ppa']: util...
[ "def", "install_toolset", "(", "self", ",", "toolset", ")", ":", "info", "=", "toolset_info", "[", "toolset", "]", "if", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", ":", "os", ".", "chdir", "(", "self", ".", "work_dir", ")", "if", ...
Installs specific toolset on CI system.
[ "Installs", "specific", "toolset", "on", "CI", "system", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L683-L709
28,988
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py
_load_keras_model
def _load_keras_model(model_network_path, model_weight_path, custom_objects=None): """Load a keras model from disk Parameters ---------- model_network_path: str Path where the model network path is (json file) model_weight_path: str Path where the model network weights are (hd5 fil...
python
def _load_keras_model(model_network_path, model_weight_path, custom_objects=None): """Load a keras model from disk Parameters ---------- model_network_path: str Path where the model network path is (json file) model_weight_path: str Path where the model network weights are (hd5 fil...
[ "def", "_load_keras_model", "(", "model_network_path", ",", "model_weight_path", ",", "custom_objects", "=", "None", ")", ":", "from", "keras", ".", "models", "import", "model_from_json", "import", "json", "# Load the model network", "json_file", "=", "open", "(", "...
Load a keras model from disk Parameters ---------- model_network_path: str Path where the model network path is (json file) model_weight_path: str Path where the model network weights are (hd5 file) custom_objects: A dictionary of layers or other custom classes or ...
[ "Load", "a", "keras", "model", "from", "disk" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py#L134-L168
28,989
apple/turicreate
src/unity/python/turicreate/visualization/_plot.py
Plot.show
def show(self): """ A method for displaying the Plot object Notes ----- - The plot will render either inline in a Jupyter Notebook, or in a native GUI window, depending on the value provided in `turicreate.visualization.set_target` (defaults to 'auto'). ...
python
def show(self): """ A method for displaying the Plot object Notes ----- - The plot will render either inline in a Jupyter Notebook, or in a native GUI window, depending on the value provided in `turicreate.visualization.set_target` (defaults to 'auto'). ...
[ "def", "show", "(", "self", ")", ":", "global", "_target", "display", "=", "False", "try", ":", "if", "_target", "==", "'auto'", "and", "get_ipython", "(", ")", ".", "__class__", ".", "__name__", "==", "\"ZMQInteractiveShell\"", ":", "self", ".", "_repr_ja...
A method for displaying the Plot object Notes ----- - The plot will render either inline in a Jupyter Notebook, or in a native GUI window, depending on the value provided in `turicreate.visualization.set_target` (defaults to 'auto'). Examples -------- ...
[ "A", "method", "for", "displaying", "the", "Plot", "object" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/_plot.py#L104-L142
28,990
apple/turicreate
src/unity/python/turicreate/visualization/_plot.py
Plot.save
def save(self, filepath): """ A method for saving the Plot object in a vega representation Parameters ---------- filepath: string The destination filepath where the plot object must be saved as. The extension of this filepath determines what format the pl...
python
def save(self, filepath): """ A method for saving the Plot object in a vega representation Parameters ---------- filepath: string The destination filepath where the plot object must be saved as. The extension of this filepath determines what format the pl...
[ "def", "save", "(", "self", ",", "filepath", ")", ":", "if", "type", "(", "filepath", ")", "!=", "str", ":", "raise", "ValueError", "(", "\"filepath provided is not a string\"", ")", "if", "filepath", ".", "endswith", "(", "\".json\"", ")", ":", "# save as v...
A method for saving the Plot object in a vega representation Parameters ---------- filepath: string The destination filepath where the plot object must be saved as. The extension of this filepath determines what format the plot will be saved as. Currently sup...
[ "A", "method", "for", "saving", "the", "Plot", "object", "in", "a", "vega", "representation" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/_plot.py#L144-L248
28,991
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py
_get_value
def _get_value(scikit_value, mode = 'regressor', scaling = 1.0, n_classes = 2, tree_index = 0): """ Get the right value from the scikit-tree """ # Regression if mode == 'regressor': return scikit_value[0] * scaling # Binary classification if n_classes == 2: # Decision tree ...
python
def _get_value(scikit_value, mode = 'regressor', scaling = 1.0, n_classes = 2, tree_index = 0): """ Get the right value from the scikit-tree """ # Regression if mode == 'regressor': return scikit_value[0] * scaling # Binary classification if n_classes == 2: # Decision tree ...
[ "def", "_get_value", "(", "scikit_value", ",", "mode", "=", "'regressor'", ",", "scaling", "=", "1.0", ",", "n_classes", "=", "2", ",", "tree_index", "=", "0", ")", ":", "# Regression", "if", "mode", "==", "'regressor'", ":", "return", "scikit_value", "[",...
Get the right value from the scikit-tree
[ "Get", "the", "right", "value", "from", "the", "scikit", "-", "tree" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L16-L42
28,992
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py
convert_tree_ensemble
def convert_tree_ensemble(model, input_features, output_features = ('predicted_class', float), mode = 'regressor', base_prediction = None, class_labels = None, post_evaluation_transform = No...
python
def convert_tree_ensemble(model, input_features, output_features = ('predicted_class', float), mode = 'regressor', base_prediction = None, class_labels = None, post_evaluation_transform = No...
[ "def", "convert_tree_ensemble", "(", "model", ",", "input_features", ",", "output_features", "=", "(", "'predicted_class'", ",", "float", ")", ",", "mode", "=", "'regressor'", ",", "base_prediction", "=", "None", ",", "class_labels", "=", "None", ",", "post_eval...
Convert a generic tree regressor model to the protobuf spec. This currently supports: * Decision tree regression * Gradient boosted tree regression * Random forest regression * Decision tree classifier. * Gradient boosted tree classifier. * Random forest classifier. -------...
[ "Convert", "a", "generic", "tree", "regressor", "model", "to", "the", "protobuf", "spec", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L97-L199
28,993
apple/turicreate
src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py
StyleTransfer.get_styles
def get_styles(self, style=None): """ Returns SFrame of style images used for training the model Parameters ---------- style: int or list, optional The selected style or list of styles to return. If `None`, all styles will be returned See Also ...
python
def get_styles(self, style=None): """ Returns SFrame of style images used for training the model Parameters ---------- style: int or list, optional The selected style or list of styles to return. If `None`, all styles will be returned See Also ...
[ "def", "get_styles", "(", "self", ",", "style", "=", "None", ")", ":", "style", ",", "_", "=", "self", ".", "_style_input_check", "(", "style", ")", "return", "self", ".", "styles", ".", "filter_by", "(", "style", ",", "self", ".", "_index_column", ")"...
Returns SFrame of style images used for training the model Parameters ---------- style: int or list, optional The selected style or list of styles to return. If `None`, all styles will be returned See Also -------- stylize Examples ...
[ "Returns", "SFrame", "of", "style", "images", "used", "for", "training", "the", "model" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L876-L911
28,994
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_util.py
load_model
def load_model(model_path): """Load a libsvm model from a path on disk. This currently supports: * C-SVC * NU-SVC * Epsilon-SVR * NU-SVR Parameters ---------- model_path: str Path on disk where the libsvm model representation is. Returns ------- model: ...
python
def load_model(model_path): """Load a libsvm model from a path on disk. This currently supports: * C-SVC * NU-SVC * Epsilon-SVR * NU-SVR Parameters ---------- model_path: str Path on disk where the libsvm model representation is. Returns ------- model: ...
[ "def", "load_model", "(", "model_path", ")", ":", "if", "not", "(", "HAS_LIBSVM", ")", ":", "raise", "RuntimeError", "(", "'libsvm not found. libsvm conversion API is disabled.'", ")", "from", "svmutil", "import", "svm_load_model", "# From libsvm", "import", "os", "if...
Load a libsvm model from a path on disk. This currently supports: * C-SVC * NU-SVC * Epsilon-SVR * NU-SVR Parameters ---------- model_path: str Path on disk where the libsvm model representation is. Returns ------- model: libsvm_model A model of the...
[ "Load", "a", "libsvm", "model", "from", "a", "path", "on", "disk", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_util.py#L8-L34
28,995
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
add_enumerated_multiarray_shapes
def add_enumerated_multiarray_shapes(spec, feature_name, shapes): """ Annotate an input or output multiArray feature in a Neural Network spec to to accommodate a list of enumerated array shapes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str Th...
python
def add_enumerated_multiarray_shapes(spec, feature_name, shapes): """ Annotate an input or output multiArray feature in a Neural Network spec to to accommodate a list of enumerated array shapes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str Th...
[ "def", "add_enumerated_multiarray_shapes", "(", "spec", ",", "feature_name", ",", "shapes", ")", ":", "if", "not", "isinstance", "(", "shapes", ",", "list", ")", ":", "shapes", "=", "[", "shapes", "]", "for", "shape", "in", "shapes", ":", "if", "not", "i...
Annotate an input or output multiArray feature in a Neural Network spec to to accommodate a list of enumerated array shapes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the image feature for which to add shape information. If the...
[ "Annotate", "an", "input", "or", "output", "multiArray", "feature", "in", "a", "Neural", "Network", "spec", "to", "to", "accommodate", "a", "list", "of", "enumerated", "array", "shapes" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L291-L370
28,996
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
add_enumerated_image_sizes
def add_enumerated_image_sizes(spec, feature_name, sizes): """ Annotate an input or output image feature in a Neural Network spec to to accommodate a list of enumerated image sizes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the...
python
def add_enumerated_image_sizes(spec, feature_name, sizes): """ Annotate an input or output image feature in a Neural Network spec to to accommodate a list of enumerated image sizes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the...
[ "def", "add_enumerated_image_sizes", "(", "spec", ",", "feature_name", ",", "sizes", ")", ":", "if", "not", "isinstance", "(", "sizes", ",", "list", ")", ":", "sizes", "=", "[", "sizes", "]", "for", "size", "in", "sizes", ":", "if", "not", "isinstance", ...
Annotate an input or output image feature in a Neural Network spec to to accommodate a list of enumerated image sizes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the image feature for which to add size information. If the featur...
[ "Annotate", "an", "input", "or", "output", "image", "feature", "in", "a", "Neural", "Network", "spec", "to", "to", "accommodate", "a", "list", "of", "enumerated", "image", "sizes" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L373-L437
28,997
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
update_image_size_range
def update_image_size_range(spec, feature_name, size_range): """ Annotate an input or output Image feature in a Neural Network spec to to accommodate a range of image sizes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the Image f...
python
def update_image_size_range(spec, feature_name, size_range): """ Annotate an input or output Image feature in a Neural Network spec to to accommodate a range of image sizes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the Image f...
[ "def", "update_image_size_range", "(", "spec", ",", "feature_name", ",", "size_range", ")", ":", "if", "not", "isinstance", "(", "size_range", ",", "NeuralNetworkImageSizeRange", ")", ":", "raise", "Exception", "(", "'Shape ranges should be of type NeuralNetworkImageSizeR...
Annotate an input or output Image feature in a Neural Network spec to to accommodate a range of image sizes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the Image feature for which to add shape information. If the feature is not ...
[ "Annotate", "an", "input", "or", "output", "Image", "feature", "in", "a", "Neural", "Network", "spec", "to", "to", "accommodate", "a", "range", "of", "image", "sizes" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L440-L490
28,998
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
update_multiarray_shape_range
def update_multiarray_shape_range(spec, feature_name, shape_range): """ Annotate an input or output MLMultiArray feature in a Neural Network spec to accommodate a range of shapes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the f...
python
def update_multiarray_shape_range(spec, feature_name, shape_range): """ Annotate an input or output MLMultiArray feature in a Neural Network spec to accommodate a range of shapes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the f...
[ "def", "update_multiarray_shape_range", "(", "spec", ",", "feature_name", ",", "shape_range", ")", ":", "if", "not", "isinstance", "(", "shape_range", ",", "NeuralNetworkMultiArrayShapeRange", ")", ":", "raise", "Exception", "(", "'Shape range should be of type MultiArray...
Annotate an input or output MLMultiArray feature in a Neural Network spec to accommodate a range of shapes :param spec: MLModel The MLModel spec containing the feature :param feature_name: str The name of the feature for which to add shape range information. If the feature is not f...
[ "Annotate", "an", "input", "or", "output", "MLMultiArray", "feature", "in", "a", "Neural", "Network", "spec", "to", "accommodate", "a", "range", "of", "shapes" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L493-L556
28,999
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
get_allowed_shape_ranges
def get_allowed_shape_ranges(spec): """ For a given model specification, returns a dictionary with a shape range object for each input feature name. """ shaper = NeuralNetworkShaper(spec, False) inputs = _get_input_names(spec) output = {} for input in inputs: output[input] = shaper...
python
def get_allowed_shape_ranges(spec): """ For a given model specification, returns a dictionary with a shape range object for each input feature name. """ shaper = NeuralNetworkShaper(spec, False) inputs = _get_input_names(spec) output = {} for input in inputs: output[input] = shaper...
[ "def", "get_allowed_shape_ranges", "(", "spec", ")", ":", "shaper", "=", "NeuralNetworkShaper", "(", "spec", ",", "False", ")", "inputs", "=", "_get_input_names", "(", "spec", ")", "output", "=", "{", "}", "for", "input", "in", "inputs", ":", "output", "["...
For a given model specification, returns a dictionary with a shape range object for each input feature name.
[ "For", "a", "given", "model", "specification", "returns", "a", "dictionary", "with", "a", "shape", "range", "object", "for", "each", "input", "feature", "name", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L559-L571