partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
tracker_print
Print message to the tracker. This function can be used to communicate the information of the progress to the tracker Parameters ---------- msg : str The message to be printed to tracker.
src/external/xgboost/subtree/rabit/wrapper/rabit.py
def tracker_print(msg): """Print message to the tracker. This function can be used to communicate the information of the progress to the tracker Parameters ---------- msg : str The message to be printed to tracker. """ if not isinstance(msg, str): msg = str(msg) _LI...
def tracker_print(msg): """Print message to the tracker. This function can be used to communicate the information of the progress to the tracker Parameters ---------- msg : str The message to be printed to tracker. """ if not isinstance(msg, str): msg = str(msg) _LI...
[ "Print", "message", "to", "the", "tracker", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L105-L118
[ "def", "tracker_print", "(", "msg", ")", ":", "if", "not", "isinstance", "(", "msg", ",", "str", ")", ":", "msg", "=", "str", "(", "msg", ")", "_LIB", ".", "RabitTrackerPrint", "(", "ctypes", ".", "c_char_p", "(", "msg", ")", ".", "encode", "(", "'...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
allreduce
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...
src/external/xgboost/subtree/rabit/wrapper/rabit.py
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): """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_...
[ "Perform", "allreduce", "return", "the", "result", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L183-L226
[ "def", "allreduce", "(", "data", ",", "op", ",", "prepare_fun", "=", "None", ")", ":", "if", "not", "isinstance", "(", "data", ",", "np", ".", "ndarray", ")", ":", "raise", "Exception", "(", "'allreduce only takes in numpy.ndarray'", ")", "buf", "=", "data...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_load_model
Internal function used by the module, unpickle a model from a buffer specified by ptr, length Arguments: ptr: ctypes.POINTER(ctypes._char) pointer to the memory region of buffer length: int the length of buffer
src/external/xgboost/subtree/rabit/wrapper/rabit.py
def _load_model(ptr, length): """ Internal function used by the module, unpickle a model from a buffer specified by ptr, length Arguments: ptr: ctypes.POINTER(ctypes._char) pointer to the memory region of buffer length: int the length of buffer """ data = ...
def _load_model(ptr, length): """ Internal function used by the module, unpickle a model from a buffer specified by ptr, length Arguments: ptr: ctypes.POINTER(ctypes._char) pointer to the memory region of buffer length: int the length of buffer """ data = ...
[ "Internal", "function", "used", "by", "the", "module", "unpickle", "a", "model", "from", "a", "buffer", "specified", "by", "ptr", "length", "Arguments", ":", "ptr", ":", "ctypes", ".", "POINTER", "(", "ctypes", ".", "_char", ")", "pointer", "to", "the", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L229-L240
[ "def", "_load_model", "(", "ptr", ",", "length", ")", ":", "data", "=", "(", "ctypes", ".", "c_char", "*", "length", ")", ".", "from_address", "(", "ctypes", ".", "addressof", "(", "ptr", ".", "contents", ")", ")", "return", "pickle", ".", "loads", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
load_checkpoint
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 =...
src/external/xgboost/subtree/rabit/wrapper/rabit.py
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): """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...
[ "Load", "latest", "check", "point", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L242-L281
[ "def", "load_checkpoint", "(", "with_local", "=", "False", ")", ":", "gptr", "=", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_char", ")", "(", ")", "global_len", "=", "ctypes", ".", "c_ulong", "(", ")", "if", "with_local", ":", "lptr", "=", "ctype...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
checkpoint
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...
src/external/xgboost/subtree/rabit/wrapper/rabit.py
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): """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...
[ "Checkpoint", "the", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L283-L314
[ "def", "checkpoint", "(", "global_model", ",", "local_model", "=", "None", ")", ":", "sglobal", "=", "pickle", ".", "dumps", "(", "global_model", ")", "if", "local_model", "is", "None", ":", "_LIB", ".", "RabitCheckPoint", "(", "sglobal", ",", "len", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
stack_annotations
Converts object detection annotations (ground truth or predictions) to stacked format (an `SFrame` where each row is one object instance). Parameters ---------- annotations_sarray: SArray An `SArray` with unstacked predictions, exactly formatted as the annotations column when training a...
src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py
def stack_annotations(annotations_sarray): """ Converts object detection annotations (ground truth or predictions) to stacked format (an `SFrame` where each row is one object instance). Parameters ---------- annotations_sarray: SArray An `SArray` with unstacked predictions, exactly form...
def stack_annotations(annotations_sarray): """ Converts object detection annotations (ground truth or predictions) to stacked format (an `SFrame` where each row is one object instance). Parameters ---------- annotations_sarray: SArray An `SArray` with unstacked predictions, exactly form...
[ "Converts", "object", "detection", "annotations", "(", "ground", "truth", "or", "predictions", ")", "to", "stacked", "format", "(", "an", "SFrame", "where", "each", "row", "is", "one", "object", "instance", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py#L14-L63
[ "def", "stack_annotations", "(", "annotations_sarray", ")", ":", "_raise_error_if_not_sarray", "(", "annotations_sarray", ",", "variable_name", "=", "'annotations_sarray'", ")", "sf", "=", "_tc", ".", "SFrame", "(", "{", "'annotations'", ":", "annotations_sarray", "}"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
unstack_annotations
Converts object detection annotations (ground truth or predictions) to unstacked format (an `SArray` where each element is a list of object instances). Parameters ---------- annotations_sframe: SFrame An `SFrame` with stacked predictions, produced by the `stack_annotations` function...
src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py
def unstack_annotations(annotations_sframe, num_rows=None): """ Converts object detection annotations (ground truth or predictions) to unstacked format (an `SArray` where each element is a list of object instances). Parameters ---------- annotations_sframe: SFrame An `SFrame` with s...
def unstack_annotations(annotations_sframe, num_rows=None): """ Converts object detection annotations (ground truth or predictions) to unstacked format (an `SArray` where each element is a list of object instances). Parameters ---------- annotations_sframe: SFrame An `SFrame` with s...
[ "Converts", "object", "detection", "annotations", "(", "ground", "truth", "or", "predictions", ")", "to", "unstacked", "format", "(", "an", "SArray", "where", "each", "element", "is", "a", "list", "of", "object", "instances", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py#L66-L148
[ "def", "unstack_annotations", "(", "annotations_sframe", ",", "num_rows", "=", "None", ")", ":", "_raise_error_if_not_sframe", "(", "annotations_sframe", ",", "variable_name", "=", "\"annotations_sframe\"", ")", "cols", "=", "[", "'label'", ",", "'type'", ",", "'coo...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
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. ...
src/unity/python/turicreate/toolkits/recommender/ranking_factorization_recommender.py
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=1e-9, linear_regularization=1e-9, side_data_factorization=True, ranking_regularization=0.25, ...
[ "Create", "a", "RankingFactorizationRecommender", "that", "learns", "latent", "factors", "for", "each", "user", "and", "item", "and", "uses", "them", "to", "make", "rating", "predictions", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/ranking_factorization_recommender.py#L19-L270
[ "def", "create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "num_factors", "=", "32", ",", "regularization", "=...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
preprocess
splits _sources/reference.rst into separate files
src/external/coremltools_wrap/coremltools/mlmodel/docs/preprocess.py
def preprocess(): "splits _sources/reference.rst into separate files" text = open("./_sources/reference.rst", "r").read() os.remove("./_sources/reference.rst") if not os.path.exists("./_sources/reference"): os.makedirs("./_sources/reference") def pairwise(iterable): "s -> (s0, s1)...
def preprocess(): "splits _sources/reference.rst into separate files" text = open("./_sources/reference.rst", "r").read() os.remove("./_sources/reference.rst") if not os.path.exists("./_sources/reference"): os.makedirs("./_sources/reference") def pairwise(iterable): "s -> (s0, s1)...
[ "splits", "_sources", "/", "reference", ".", "rst", "into", "separate", "files" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/mlmodel/docs/preprocess.py#L6-L29
[ "def", "preprocess", "(", ")", ":", "text", "=", "open", "(", "\"./_sources/reference.rst\"", ",", "\"r\"", ")", ".", "read", "(", ")", "os", ".", "remove", "(", "\"./_sources/reference.rst\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "\"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PackTag
Returns an unsigned 32-bit integer that encodes the field number and wire type information in standard protocol message wire format. Args: field_number: Expected to be an integer in the range [1, 1 << 29) wire_type: One of the WIRETYPE_* constants.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py
def PackTag(field_number, wire_type): """Returns an unsigned 32-bit integer that encodes the field number and wire type information in standard protocol message wire format. Args: field_number: Expected to be an integer in the range [1, 1 << 29) wire_type: One of the WIRETYPE_* constants. """ if not ...
def PackTag(field_number, wire_type): """Returns an unsigned 32-bit integer that encodes the field number and wire type information in standard protocol message wire format. Args: field_number: Expected to be an integer in the range [1, 1 << 29) wire_type: One of the WIRETYPE_* constants. """ if not ...
[ "Returns", "an", "unsigned", "32", "-", "bit", "integer", "that", "encodes", "the", "field", "number", "and", "wire", "type", "information", "in", "standard", "protocol", "message", "wire", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py#L80-L90
[ "def", "PackTag", "(", "field_number", ",", "wire_type", ")", ":", "if", "not", "0", "<=", "wire_type", "<=", "_WIRETYPE_MAX", ":", "raise", "message", ".", "EncodeError", "(", "'Unknown wire type: %d'", "%", "wire_type", ")", "return", "(", "field_number", "<...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_VarUInt64ByteSizeNoTag
Returns the number of bytes required to serialize a single varint using boundary value comparisons. (unrolled loop optimization -WPierce) uint64 must be unsigned.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py
def _VarUInt64ByteSizeNoTag(uint64): """Returns the number of bytes required to serialize a single varint using boundary value comparisons. (unrolled loop optimization -WPierce) uint64 must be unsigned. """ if uint64 <= 0x7f: return 1 if uint64 <= 0x3fff: return 2 if uint64 <= 0x1fffff: return 3 if uint...
def _VarUInt64ByteSizeNoTag(uint64): """Returns the number of bytes required to serialize a single varint using boundary value comparisons. (unrolled loop optimization -WPierce) uint64 must be unsigned. """ if uint64 <= 0x7f: return 1 if uint64 <= 0x3fff: return 2 if uint64 <= 0x1fffff: return 3 if uint...
[ "Returns", "the", "number", "of", "bytes", "required", "to", "serialize", "a", "single", "varint", "using", "boundary", "value", "comparisons", ".", "(", "unrolled", "loop", "optimization", "-", "WPierce", ")", "uint64", "must", "be", "unsigned", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py#L232-L248
[ "def", "_VarUInt64ByteSizeNoTag", "(", "uint64", ")", ":", "if", "uint64", "<=", "0x7f", ":", "return", "1", "if", "uint64", "<=", "0x3fff", ":", "return", "2", "if", "uint64", "<=", "0x1fffff", ":", "return", "3", "if", "uint64", "<=", "0xfffffff", ":",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_seconds_as_string
Returns seconds as a human-friendly string, e.g. '1d 4h 47m 41s'
src/unity/python/turicreate/toolkits/style_transfer/_utils.py
def _seconds_as_string(seconds): """ Returns seconds as a human-friendly string, e.g. '1d 4h 47m 41s' """ TIME_UNITS = [('s', 60), ('m', 60), ('h', 24), ('d', None)] unit_strings = [] cur = max(int(seconds), 1) for suffix, size in TIME_UNITS: if size is not None: cur, res...
def _seconds_as_string(seconds): """ Returns seconds as a human-friendly string, e.g. '1d 4h 47m 41s' """ TIME_UNITS = [('s', 60), ('m', 60), ('h', 24), ('d', None)] unit_strings = [] cur = max(int(seconds), 1) for suffix, size in TIME_UNITS: if size is not None: cur, res...
[ "Returns", "seconds", "as", "a", "human", "-", "friendly", "string", "e", ".", "g", ".", "1d", "4h", "47m", "41s" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/_utils.py#L10-L24
[ "def", "_seconds_as_string", "(", "seconds", ")", ":", "TIME_UNITS", "=", "[", "(", "'s'", ",", "60", ")", ",", "(", "'m'", ",", "60", ")", ",", "(", "'h'", ",", "24", ")", ",", "(", "'d'", ",", "None", ")", "]", "unit_strings", "=", "[", "]", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_converter_module
Returns the module holding the conversion functions for a particular model).
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py
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): """ 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...
[ "Returns", "the", "module", "holding", "the", "conversion", "functions", "for", "a", "particular", "model", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py#L87-L100
[ "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.\"", "%...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_convert_sklearn_model
Converts a generic sklearn pipeline, transformer, classifier, or regressor into an coreML specification.
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py
def _convert_sklearn_model(input_sk_obj, input_features = None, output_feature_names = None, class_labels = None): """ Converts a generic sklearn pipeline, transformer, classifier, or regressor into an coreML specification. """ if not(HAS_SKLEARN): raise RuntimeErr...
def _convert_sklearn_model(input_sk_obj, input_features = None, output_feature_names = None, class_labels = None): """ Converts a generic sklearn pipeline, transformer, classifier, or regressor into an coreML specification. """ if not(HAS_SKLEARN): raise RuntimeErr...
[ "Converts", "a", "generic", "sklearn", "pipeline", "transformer", "classifier", "or", "regressor", "into", "an", "coreML", "specification", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py#L109-L324
[ "def", "_convert_sklearn_model", "(", "input_sk_obj", ",", "input_features", "=", "None", ",", "output_feature_names", "=", "None", ",", "class_labels", "=", "None", ")", ":", "if", "not", "(", "HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-lear...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TreeEnsembleBase.set_default_prediction_value
Set the default prediction value(s). The values given here form the base prediction value that the values at activated leaves are added to. If values is a scalar, then the output of the tree must also be 1 dimensional; otherwise, values must be a list with length matching the dimension...
src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py
def set_default_prediction_value(self, values): """ Set the default prediction value(s). The values given here form the base prediction value that the values at activated leaves are added to. If values is a scalar, then the output of the tree must also be 1 dimensional; otherwi...
def set_default_prediction_value(self, values): """ Set the default prediction value(s). The values given here form the base prediction value that the values at activated leaves are added to. If values is a scalar, then the output of the tree must also be 1 dimensional; otherwi...
[ "Set", "the", "default", "prediction", "value", "(", "s", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L36-L55
[ "def", "set_default_prediction_value", "(", "self", ",", "values", ")", ":", "if", "type", "(", "values", ")", "is", "not", "list", ":", "values", "=", "[", "float", "(", "values", ")", "]", "self", ".", "tree_parameters", ".", "numPredictionDimensions", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TreeEnsembleBase.set_post_evaluation_transform
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. ...
src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py
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): 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: - "...
[ "r", "Set", "the", "post", "processing", "transform", "applied", "after", "the", "prediction", "value", "from", "the", "tree", "ensemble", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L57-L97
[ "def", "set_post_evaluation_transform", "(", "self", ",", "value", ")", ":", "self", ".", "tree_spec", ".", "postEvaluationTransform", "=", "_TreeEnsemble_pb2", ".", "TreeEnsemblePostEvaluationTransform", ".", "Value", "(", "value", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TreeEnsembleBase.add_branch_node
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_...
src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py
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 = False): """ Add a branch node to the tree ensemble. Parameters ---------- tre...
[ "Add", "a", "branch", "node", "to", "the", "tree", "ensemble", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L99-L186
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TreeEnsembleBase.add_leaf_node
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...
src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py
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): """ 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...
[ "Add", "a", "leaf", "node", "to", "the", "tree", "ensemble", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L188-L235
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Creates a new 'PropertySet' instance for the given raw properties, or returns an already existing one.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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 = []): """ 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...
[ "Creates", "a", "new", "PropertySet", "instance", "for", "the", "given", "raw", "properties", "or", "returns", "an", "already", "existing", "one", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L36-L61
[ "def", "create", "(", "raw_properties", "=", "[", "]", ")", ":", "assert", "(", "is_iterable_typed", "(", "raw_properties", ",", "property", ".", "Property", ")", "or", "is_iterable_typed", "(", "raw_properties", ",", "basestring", ")", ")", "# FIXME: propagate ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create_with_validation
Creates new 'PropertySet' instances after checking that all properties are valid and converting implicit properties into gristed form.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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...
[ "Creates", "new", "PropertySet", "instances", "after", "checking", "that", "all", "properties", "are", "valid", "and", "converting", "implicit", "properties", "into", "gristed", "form", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L63-L72
[ "def", "create_with_validation", "(", "raw_properties", ")", ":", "assert", "is_iterable_typed", "(", "raw_properties", ",", "basestring", ")", "properties", "=", "[", "property", ".", "create_from_string", "(", "s", ")", "for", "s", "in", "raw_properties", "]", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create_from_user_input
Creates a property-set from the input given by the user, in the context of 'jamfile-module' at 'location
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """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...
[ "Creates", "a", "property", "-", "set", "from", "the", "input", "given", "by", "the", "user", "in", "the", "context", "of", "jamfile", "-", "module", "at", "location" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L79-L94
[ "def", "create_from_user_input", "(", "raw_properties", ",", "jamfile_module", ",", "location", ")", ":", "assert", "is_iterable_typed", "(", "raw_properties", ",", "basestring", ")", "assert", "isinstance", "(", "jamfile_module", ",", "basestring", ")", "assert", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
refine_from_user_input
Refines requirements with requirements provided by the user. Specially handles "-<property>value" syntax in specification to remove given requirements. - parent-requirements -- property-set object with requirements to refine - specification -- string list of requirements provided by the use ...
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
def refine_from_user_input(parent_requirements, specification, jamfile_module, location): """Refines requirements with requirements provided by the user. Specially handles "-<property>value" syntax in specification to remove given requirements. - parent-requirements -- prope...
def refine_from_user_input(parent_requirements, specification, jamfile_module, location): """Refines requirements with requirements provided by the user. Specially handles "-<property>value" syntax in specification to remove given requirements. - parent-requirements -- prope...
[ "Refines", "requirements", "with", "requirements", "provided", "by", "the", "user", ".", "Specially", "handles", "-", "<property", ">", "value", "syntax", "in", "specification", "to", "remove", "given", "requirements", ".", "-", "parent", "-", "requirements", "-...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L97-L140
[ "def", "refine_from_user_input", "(", "parent_requirements", ",", "specification", ",", "jamfile_module", ",", "location", ")", ":", "assert", "isinstance", "(", "parent_requirements", ",", "PropertySet", ")", "assert", "is_iterable_typed", "(", "specification", ",", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.base
Returns properties that are neither incidental nor free.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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
[ "Returns", "properties", "that", "are", "neither", "incidental", "nor", "free", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L264-L270
[ "def", "base", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "not", "(", "p", ".", "feature", ".", "incidental", "or", "p", ".", "feature", ".", "free", ")", "]", "result", ".", "extend", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.free
Returns free properties which are not dependency properties.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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
[ "Returns", "free", "properties", "which", "are", "not", "dependency", "properties", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L272-L278
[ "def", "free", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "not", "p", ".", "feature", ".", "incidental", "and", "p", ".", "feature", ".", "free", "]", "result", ".", "extend", "(", "self"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.dependency
Returns dependency properties.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ Returns dependency properties. """ result = [p for p in self.lazy_properties if p.feature.dependency] result.extend(self.dependency_) return self.dependency_
[ "Returns", "dependency", "properties", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L283-L288
[ "def", "dependency", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "p", ".", "feature", ".", "dependency", "]", "result", ".", "extend", "(", "self", ".", "dependency_", ")", "return", "self", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.non_dependency
Returns properties that are not dependencies.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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
[ "Returns", "properties", "that", "are", "not", "dependencies", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L290-L295
[ "def", "non_dependency", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "not", "p", ".", "feature", ".", "dependency", "]", "result", ".", "extend", "(", "self", ".", "non_dependency_", ")", "ret...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.incidental
Returns incidental properties.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ Returns incidental properties. """ result = [p for p in self.lazy_properties if p.feature.incidental] result.extend(self.incidental_) return result
[ "Returns", "incidental", "properties", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L307-L312
[ "def", "incidental", "(", "self", ")", ":", "result", "=", "[", "p", "for", "p", "in", "self", ".", "lazy_properties", "if", "p", ".", "feature", ".", "incidental", "]", "result", ".", "extend", "(", "self", ".", "incidental_", ")", "return", "result" ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.refine
Refines this set's properties using the requirements passed as an argument.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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_...
[ "Refines", "this", "set", "s", "properties", "using", "the", "requirements", "passed", "as", "an", "argument", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L314-L323
[ "def", "refine", "(", "self", ",", "requirements", ")", ":", "assert", "isinstance", "(", "requirements", ",", "PropertySet", ")", "if", "requirements", "not", "in", "self", ".", "refined_", ":", "r", "=", "property", ".", "refine", "(", "self", ".", "al...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.target_path
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'.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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...
[ "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",...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L395-L439
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.add
Creates a new property set containing the properties in this one, plus the ones of the property set passed as argument.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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()) ...
[ "Creates", "a", "new", "property", "set", "containing", "the", "properties", "in", "this", "one", "plus", "the", "ones", "of", "the", "property", "set", "passed", "as", "argument", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L441-L448
[ "def", "add", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "PropertySet", ")", "if", "ps", "not", "in", "self", ".", "added_", ":", "self", ".", "added_", "[", "ps", "]", "=", "create", "(", "self", ".", "all_", "+", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.get
Returns all values of 'feature'.
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """ 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...
[ "Returns", "all", "values", "of", "feature", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L457-L474
[ "def", "get", "(", "self", ",", "feature", ")", ":", "if", "type", "(", "feature", ")", "==", "type", "(", "[", "]", ")", ":", "feature", "=", "feature", "[", "0", "]", "if", "not", "isinstance", "(", "feature", ",", "b2", ".", "build", ".", "f...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
PropertySet.get_properties
Returns all contained properties associated with 'feature
deps/src/boost_1_68_0/tools/build/src/build/property_set.py
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): """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...
[ "Returns", "all", "contained", "properties", "associated", "with", "feature" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L477-L487
[ "def", "get_properties", "(", "self", ",", "feature", ")", ":", "if", "not", "isinstance", "(", "feature", ",", "b2", ".", "build", ".", "feature", ".", "Feature", ")", ":", "feature", "=", "b2", ".", "build", ".", "feature", ".", "get", "(", "featur...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_create
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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=True): """ A unified interface for training recommender models. Based on simple characteristics of the data, a type of model is s...
[ "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"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L24-L175
[ "def", "_create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "ranking", "=", "True", ",", "verbose", "=", "Tr...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
compare_models
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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=False, verbose=True, **kwargs): """ Compare the ...
[ "Compare", "the", "prediction", "or", "recommendation", "performance", "of", "recommender", "models", "on", "a", "common", "test", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L177-L328
[ "def", "compare_models", "(", "dataset", ",", "models", ",", "model_names", "=", "None", ",", "user_sample", "=", "1.0", ",", "metric", "=", "'auto'", ",", "target", "=", "None", ",", "exclude_known_for_precision_recall", "=", "True", ",", "make_plot", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
precision_recall_by_user
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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]): """ 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...
[ "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...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L331-L427
[ "def", "precision_recall_by_user", "(", "observed_user_items", ",", "recommendations", ",", "cutoffs", "=", "[", "10", "]", ")", ":", "assert", "type", "(", "observed_user_items", ")", "==", "_SFrame", "assert", "type", "(", "recommendations", ")", "==", "_SFram...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
random_split_by_user
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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): """Create a recommender-friendly train-test split of the p...
[ "Create", "a", "recommender", "-", "friendly", "train", "-", "test", "split", "of", "the", "provided", "data", "set", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L430-L508
[ "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", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender._list_fields
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.
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ 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() ...
[ "Get", "the", "current", "settings", "of", "the", "model", ".", "The", "keys", "depend", "on", "the", "type", "of", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L543-L555
[ "def", "_list_fields", "(", "self", ")", ":", "response", "=", "self", ".", "__proxy__", ".", "list_fields", "(", ")", "return", "[", "s", "for", "s", "in", "response", "[", "'value'", "]", "if", "not", "s", ".", "startswith", "(", "\"_\"", ")", "]" ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender._get_summary_struct
Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of list of tuples) A list of summary sections...
src/unity/python/turicreate/toolkits/recommender/util.py
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of lis...
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of lis...
[ "Returns", "a", "structured", "description", "of", "the", "model", "including", "(", "where", "relevant", ")", "the", "schema", "of", "the", "training", "data", "description", "of", "the", "training", "data", "training", "statistics", "and", "model", "hyperparam...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L634-L782
[ "def", "_get_summary_struct", "(", "self", ")", ":", "stats", "=", "self", ".", "_list_fields", "(", ")", "options", "=", "self", ".", "_get_current_options", "(", ")", "section_titles", "=", "[", "]", "sections", "=", "[", "]", "observation_columns", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender._set_current_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.
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ 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", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L804-L818
[ "def", "_set_current_options", "(", "self", ",", "options", ")", ":", "opts", "=", "self", ".", "_get_current_options", "(", ")", "opts", ".", "update", "(", "options", ")", "response", "=", "self", ".", "__proxy__", ".", "set_current_options", "(", "opts", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.__prepare_dataset_parameter
Processes the dataset parameter for type correctness. Returns it as an SFrame.
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ 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(...
[ "Processes", "the", "dataset", "parameter", "for", "type", "correctness", ".", "Returns", "it", "as", "an", "SFrame", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L820-L843
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender._get_data_schema
Returns a dictionary of (column : type) for the data used in the model.
src/unity/python/turicreate/toolkits/recommender/util.py
def _get_data_schema(self): """ Returns a dictionary of (column : type) for the data used in the model. """ if not hasattr(self, "_data_schema"): response = self.__proxy__.get_data_schema() self._data_schema = {k : _turicreate._cython.cy_flexible_type.py...
def _get_data_schema(self): """ Returns a dictionary of (column : type) for the data used in the model. """ if not hasattr(self, "_data_schema"): response = self.__proxy__.get_data_schema() self._data_schema = {k : _turicreate._cython.cy_flexible_type.py...
[ "Returns", "a", "dictionary", "of", "(", "column", ":", "type", ")", "for", "the", "data", "used", "in", "the", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L845-L857
[ "def", "_get_data_schema", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"_data_schema\"", ")", ":", "response", "=", "self", ".", "__proxy__", ".", "get_data_schema", "(", ")", "self", ".", "_data_schema", "=", "{", "k", ":", "_turi...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.predict
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ Return a score prediction for the user ids and item ids in the provided data set. Parameters ---------- dataset : SFrame Dataset in the same for...
[ "Return", "a", "score", "prediction", "for", "the", "user", "ids", "and", "item", "ids", "in", "the", "provided", "data", "set", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L859-L925
[ "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", "(...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.get_similar_items
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ 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...
[ "Get", "the", "k", "most", "similar", "items", "for", "each", "item", "in", "items", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L927-L988
[ "def", "get_similar_items", "(", "self", ",", "items", "=", "None", ",", "k", "=", "10", ",", "verbose", "=", "False", ")", ":", "if", "items", "is", "None", ":", "get_all_items", "=", "True", "items", "=", "_SArray", "(", ")", "else", ":", "get_all_...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.get_similar_users
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 ...
src/unity/python/turicreate/toolkits/recommender/util.py
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): """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 ...
[ "Get", "the", "k", "most", "similar", "users", "for", "each", "entry", "in", "users", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L990-L1053
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.recommend
Recommend the ``k`` highest scored items for each user. Parameters ---------- users : SArray, SFrame, or list, optional Users or observation queries for which to make recommendations. For list, SArray, and single-column inputs, this is simply a set of user I...
src/unity/python/turicreate/toolkits/recommender/util.py
def recommend(self, users=None, k=10, exclude=None, items=None, new_observation_data=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 for each...
def recommend(self, users=None, k=10, exclude=None, items=None, new_observation_data=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 for each...
[ "Recommend", "the", "k", "highest", "scored", "items", "for", "each", "user", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1056-L1308
[ "def", "recommend", "(", "self", ",", "users", "=", "None", ",", "k", "=", "10", ",", "exclude", "=", "None", ",", "items", "=", "None", ",", "new_observation_data", "=", "None", ",", "new_user_data", "=", "None", ",", "new_item_data", "=", "None", ","...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.recommend_from_interactions
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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, diversity=0, random_seed=None, verbose=True): """ Recommend the ``k`` highest scored items based on the ...
[ "Recommend", "the", "k", "highest", "scored", "items", "based", "on", "the", "interactions", "given", "in", "observed_items", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1310-L1470
[ "def", "recommend_from_interactions", "(", "self", ",", "observed_items", ",", "k", "=", "10", ",", "exclude", "=", "None", ",", "items", "=", "None", ",", "new_user_data", "=", "None", ",", "new_item_data", "=", "None", ",", "exclude_known", "=", "True", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.evaluate_precision_recall
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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, exclude_known=True, verbose=True, **kwargs): """ Compute a model's precision and recall scores for a particular dataset. ...
[ "Compute", "a", "model", "s", "precision", "and", "recall", "scores", "for", "a", "particular", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1492-L1574
[ "def", "evaluate_precision_recall", "(", "self", ",", "dataset", ",", "cutoffs", "=", "list", "(", "range", "(", "1", ",", "11", ",", "1", ")", ")", "+", "list", "(", "range", "(", "11", ",", "50", ",", "5", ")", ")", ",", "skip_set", "=", "None"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.evaluate_rmse
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ 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...
[ "Evaluate", "the", "prediction", "error", "for", "each", "user", "-", "item", "pair", "in", "the", "given", "data", "set", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1576-L1635
[ "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.'", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.evaluate
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...
src/unity/python/turicreate/toolkits/recommender/util.py
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): r""" Evaluate the model's ability to make rating predictions or recommendations. If the model is trained to predic...
[ "r", "Evaluate", "the", "model", "s", "ability", "to", "make", "rating", "predictions", "or", "recommendations", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1637-L1761
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "exclude_known_for_precision_recall", "=", "True", ",", "target", "=", "None", ",", "verbose", "=", "True", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "}", "dat...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender._get_popularity_baseline
Returns a new popularity model matching the data set this model was trained with. Can be used for comparison purposes.
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ 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...
[ "Returns", "a", "new", "popularity", "model", "matching", "the", "data", "set", "this", "model", "was", "trained", "with", ".", "Can", "be", "used", "for", "comparison", "purposes", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1763-L1772
[ "def", "_get_popularity_baseline", "(", "self", ")", ":", "response", "=", "self", ".", "__proxy__", ".", "get_popularity_baseline", "(", ")", "from", ".", "popularity_recommender", "import", "PopularityRecommender", "return", "PopularityRecommender", "(", "response", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender._get_item_intersection_info
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 ...
src/unity/python/turicreate/toolkits/recommender/util.py
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): """ 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...
[ "For", "a", "collection", "of", "item", "-", ">", "item", "pairs", "returns", "information", "about", "the", "users", "in", "that", "intersection", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1774-L1809
[ "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", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_Recommender.export_coreml
Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml('myModel.mlmodel')
src/unity/python/turicreate/toolkits/recommender/util.py
def export_coreml(self, filename): """ Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml('myModel.mlmodel') """ print...
def export_coreml(self, filename): """ Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml('myModel.mlmodel') """ print...
[ "Export", "the", "model", "in", "Core", "ML", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1811-L1830
[ "def", "export_coreml", "(", "self", ",", "filename", ")", ":", "print", "(", "'This model is exported as a custom Core ML model. In order to use it in your\\n'", "'application, you must also include \"libRecommender.dylib\". For additional\\n'", "'details see:\\n'", "'https://apple.github...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
RandomForestRegression.evaluate
Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be the same as that used in training. metric : str, optional Name of the ev...
src/unity/python/turicreate/toolkits/regression/random_forest_regression.py
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): """ Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be ...
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): """ Evaluate the model on the given dataset. Parameters ---------- dataset : SFrame Dataset in the same format used for training. The columns names and types of the dataset must be ...
[ "Evaluate", "the", "model", "on", "the", "given", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/random_forest_regression.py#L179-L228
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "missing_value_action", "=", "'auto'", ")", ":", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "[", "'auto'", ",", "'rmse'", ",", "'max_error'", "]", ")", "retu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
RandomForestRegression.predict
Predict the target column of the given dataset. The target column is provided during :func:`~turicreate.random_forest_regression.create`. If the target column is in the `dataset` it will be ignored. Parameters ---------- dataset : SFrame A dataset that has the...
src/unity/python/turicreate/toolkits/regression/random_forest_regression.py
def predict(self, dataset, missing_value_action='auto'): """ Predict the target column of the given dataset. The target column is provided during :func:`~turicreate.random_forest_regression.create`. If the target column is in the `dataset` it will be ignored. Parameters...
def predict(self, dataset, missing_value_action='auto'): """ Predict the target column of the given dataset. The target column is provided during :func:`~turicreate.random_forest_regression.create`. If the target column is in the `dataset` it will be ignored. Parameters...
[ "Predict", "the", "target", "column", "of", "the", "given", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/random_forest_regression.py#L230-L272
[ "def", "predict", "(", "self", ",", "dataset", ",", "missing_value_action", "=", "'auto'", ")", ":", "return", "super", "(", "RandomForestRegression", ",", "self", ")", ".", "predict", "(", "dataset", ",", "output_type", "=", "'margin'", ",", "missing_value_ac...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create_feature_vectorizer
Creates a feature vectorizer from input features, return the spec for a feature vectorizer that puts everything into a single array of length equal to the total size of all the input features. Returns a 2-tuple `(spec, num_dimension)` Parameters ---------- input_features: [list of 2-tuples] ...
src/external/coremltools_wrap/coremltools/coremltools/models/feature_vectorizer.py
def create_feature_vectorizer(input_features, output_feature_name, known_size_map = {}): """ Creates a feature vectorizer from input features, return the spec for a feature vectorizer that puts everything into a single array of length equal to the total size of all the inpu...
def create_feature_vectorizer(input_features, output_feature_name, known_size_map = {}): """ Creates a feature vectorizer from input features, return the spec for a feature vectorizer that puts everything into a single array of length equal to the total size of all the inpu...
[ "Creates", "a", "feature", "vectorizer", "from", "input", "features", "return", "the", "spec", "for", "a", "feature", "vectorizer", "that", "puts", "everything", "into", "a", "single", "array", "of", "length", "equal", "to", "the", "total", "size", "of", "al...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/feature_vectorizer.py#L15-L94
[ "def", "create_feature_vectorizer", "(", "input_features", ",", "output_feature_name", ",", "known_size_map", "=", "{", "}", ")", ":", "spec", "=", "_Model_pb2", ".", "Model", "(", ")", "spec", ".", "specificationVersion", "=", "SPECIFICATION_VERSION", "input_featur...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
utils.query_boost_version
Read in the Boost version from a given boost_root.
deps/src/boost_1_68_0/libs/predef/tools/ci/common.py
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): ''' 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...
[ "Read", "in", "the", "Boost", "version", "from", "a", "given", "boost_root", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L421-L435
[ "def", "query_boost_version", "(", "boost_root", ")", ":", "boost_version", "=", "None", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "boost_root", ",", "'Jamroot'", ")", ")", ":", "with", "codecs", ".", "open", "("...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
utils.git_clone
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.
deps/src/boost_1_68_0/libs/predef/tools/ci/common.py
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): ''' 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: ...
[ "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...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L438-L471
[ "def", "git_clone", "(", "sub_repo", ",", "branch", ",", "commit", "=", "None", ",", "cwd", "=", "None", ",", "no_submodules", "=", "False", ")", ":", "if", "not", "cwd", ":", "cwd", "=", "cwd", "=", "os", ".", "getcwd", "(", ")", "root_dir", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ci_travis.install_toolset
Installs specific toolset on CI system.
deps/src/boost_1_68_0/libs/predef/tools/ci/common.py
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): ''' 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...
[ "Installs", "specific", "toolset", "on", "CI", "system", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L683-L709
[ "def", "install_toolset", "(", "self", ",", "toolset", ")", ":", "info", "=", "toolset_info", "[", "toolset", "]", "if", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", ":", "os", ".", "chdir", "(", "self", ".", "work_dir", ")", "if", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a :class:`~turicreate.svm_classifier.SVMClassifier` to predict the class of a binary target variable based on a model of which side of a hyperplane the example falls on. In addition to standard numeric and categorical types, features can also be extracted automatically from list- or dictionary-type S...
src/unity/python/turicreate/toolkits/classifier/svm_classifier.py
def create(dataset, target, features=None, penalty=1.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], lbfgs_memory_level = _DEFAULT_SOLVER_OPTIONS['lbfgs_memory_level'], max_iterations = _DEFAULT_SOLVER_OPTIONS['max_iterations'], ...
def create(dataset, target, features=None, penalty=1.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], lbfgs_memory_level = _DEFAULT_SOLVER_OPTIONS['lbfgs_memory_level'], max_iterations = _DEFAULT_SOLVER_OPTIONS['max_iterations'], ...
[ "Create", "a", ":", "class", ":", "~turicreate", ".", "svm_classifier", ".", "SVMClassifier", "to", "predict", "the", "class", "of", "a", "binary", "target", "variable", "based", "on", "a", "model", "of", "which", "side", "of", "a", "hyperplane", "the", "e...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/svm_classifier.py#L27-L226
[ "def", "create", "(", "dataset", ",", "target", ",", "features", "=", "None", ",", "penalty", "=", "1.0", ",", "solver", "=", "'auto'", ",", "feature_rescaling", "=", "True", ",", "convergence_threshold", "=", "_DEFAULT_SOLVER_OPTIONS", "[", "'convergence_thresh...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SVMClassifier.classify
Return a classification, for each example in the ``dataset``, using the trained SVM model. The output SFrame contains predictions as class labels (0 or 1) associated with the the example. Parameters ---------- dataset : SFrame Dataset of new observations. Must includ...
src/unity/python/turicreate/toolkits/classifier/svm_classifier.py
def classify(self, dataset, missing_value_action='auto'): """ Return a classification, for each example in the ``dataset``, using the trained SVM model. The output SFrame contains predictions as class labels (0 or 1) associated with the the example. Parameters ----------...
def classify(self, dataset, missing_value_action='auto'): """ Return a classification, for each example in the ``dataset``, using the trained SVM model. The output SFrame contains predictions as class labels (0 or 1) associated with the the example. Parameters ----------...
[ "Return", "a", "classification", "for", "each", "example", "in", "the", "dataset", "using", "the", "trained", "SVM", "model", ".", "The", "output", "SFrame", "contains", "predictions", "as", "class", "labels", "(", "0", "or", "1", ")", "associated", "with", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/svm_classifier.py#L521-L566
[ "def", "classify", "(", "self", ",", "dataset", ",", "missing_value_action", "=", "'auto'", ")", ":", "return", "super", "(", "SVMClassifier", ",", "self", ")", ".", "classify", "(", "dataset", ",", "missing_value_action", "=", "missing_value_action", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_layer_converter_fn
Get the right converter function for Keras
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py
def _get_layer_converter_fn(layer, add_custom_layers = False): """Get the right converter function for Keras """ layer_type = type(layer) if layer_type in _KERAS_LAYER_REGISTRY: convert_func = _KERAS_LAYER_REGISTRY[layer_type] if convert_func is _layers2.convert_activation: a...
def _get_layer_converter_fn(layer, add_custom_layers = False): """Get the right converter function for Keras """ layer_type = type(layer) if layer_type in _KERAS_LAYER_REGISTRY: convert_func = _KERAS_LAYER_REGISTRY[layer_type] if convert_func is _layers2.convert_activation: a...
[ "Get", "the", "right", "converter", "function", "for", "Keras" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py#L117-L131
[ "def", "_get_layer_converter_fn", "(", "layer", ",", "add_custom_layers", "=", "False", ")", ":", "layer_type", "=", "type", "(", "layer", ")", "if", "layer_type", "in", "_KERAS_LAYER_REGISTRY", ":", "convert_func", "=", "_KERAS_LAYER_REGISTRY", "[", "layer_type", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_load_keras_model
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 ...
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py
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): """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...
[ "Load", "a", "keras", "model", "from", "disk" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py#L134-L168
[ "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", "(", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Plot.show
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 -------- ...
src/unity/python/turicreate/visualization/_plot.py
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): """ 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'). ...
[ "A", "method", "for", "displaying", "the", "Plot", "object" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/_plot.py#L104-L142
[ "def", "show", "(", "self", ")", ":", "global", "_target", "display", "=", "False", "try", ":", "if", "_target", "==", "'auto'", "and", "get_ipython", "(", ")", ".", "__class__", ".", "__name__", "==", "\"ZMQInteractiveShell\"", ":", "self", ".", "_repr_ja...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Plot.save
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...
src/unity/python/turicreate/visualization/_plot.py
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): """ 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...
[ "A", "method", "for", "saving", "the", "Plot", "object", "in", "a", "vega", "representation" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/_plot.py#L144-L248
[ "def", "save", "(", "self", ",", "filepath", ")", ":", "if", "type", "(", "filepath", ")", "!=", "str", ":", "raise", "ValueError", "(", "\"filepath provided is not a string\"", ")", "if", "filepath", ".", "endswith", "(", "\".json\"", ")", ":", "# save as v...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
mthread_submit
customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args arguments to launch each job this usually includes th...
src/external/xgboost/subtree/rabit/tracker/rabit_demo.py
def mthread_submit(nslave, worker_args, worker_envs): """ customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args...
def mthread_submit(nslave, worker_args, worker_envs): """ customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args...
[ "customized", "submit", "script", "that", "submit", "nslave", "jobs", "each", "must", "contain", "args", "as", "parameter", "note", "this", "can", "be", "a", "lambda", "function", "containing", "additional", "parameters", "in", "input", "Parameters", "nslave", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_demo.py#L78-L93
[ "def", "mthread_submit", "(", "nslave", ",", "worker_args", ",", "worker_envs", ")", ":", "procs", "=", "{", "}", "for", "i", "in", "range", "(", "nslave", ")", ":", "procs", "[", "i", "]", "=", "Thread", "(", "target", "=", "exec_cmd", ",", "args", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_value
Get the right value from the scikit-tree
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py
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): """ 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 ...
[ "Get", "the", "right", "value", "from", "the", "scikit", "-", "tree" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L16-L42
[ "def", "_get_value", "(", "scikit_value", ",", "mode", "=", "'regressor'", ",", "scaling", "=", "1.0", ",", "n_classes", "=", "2", ",", "tree_index", "=", "0", ")", ":", "# Regression", "if", "mode", "==", "'regressor'", ":", "return", "scikit_value", "[",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_recurse
Traverse through the tree and append to the tree spec.
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py
def _recurse(coreml_tree, scikit_tree, tree_id, node_id, scaling = 1.0, mode = 'regressor', n_classes = 2, tree_index = 0): """Traverse through the tree and append to the tree spec. """ if not(HAS_SKLEARN): raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disab...
def _recurse(coreml_tree, scikit_tree, tree_id, node_id, scaling = 1.0, mode = 'regressor', n_classes = 2, tree_index = 0): """Traverse through the tree and append to the tree spec. """ if not(HAS_SKLEARN): raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disab...
[ "Traverse", "through", "the", "tree", "and", "append", "to", "the", "tree", "spec", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L44-L77
[ "def", "_recurse", "(", "coreml_tree", ",", "scikit_tree", ",", "tree_id", ",", "node_id", ",", "scaling", "=", "1.0", ",", "mode", "=", "'regressor'", ",", "n_classes", "=", "2", ",", "tree_index", "=", "0", ")", ":", "if", "not", "(", "HAS_SKLEARN", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_tree_ensemble
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. -------...
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py
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_evaluation_transform = No...
[ "Convert", "a", "generic", "tree", "regressor", "model", "to", "the", "protobuf", "spec", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L97-L199
[ "def", "convert_tree_ensemble", "(", "model", ",", "input_features", ",", "output_features", "=", "(", "'predicted_class'", ",", "float", ")", ",", "mode", "=", "'regressor'", ",", "base_prediction", "=", "None", ",", "class_labels", "=", "None", ",", "post_eval...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_vgg16_data_prep
Takes images scaled to [0, 1] and returns them appropriately scaled and mean-subtracted for VGG-16
src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py
def _vgg16_data_prep(batch): """ Takes images scaled to [0, 1] and returns them appropriately scaled and mean-subtracted for VGG-16 """ from mxnet import nd mean = nd.array([123.68, 116.779, 103.939], ctx=batch.context) return nd.broadcast_sub(255 * batch, mean.reshape((-1, 1, 1)))
def _vgg16_data_prep(batch): """ Takes images scaled to [0, 1] and returns them appropriately scaled and mean-subtracted for VGG-16 """ from mxnet import nd mean = nd.array([123.68, 116.779, 103.939], ctx=batch.context) return nd.broadcast_sub(255 * batch, mean.reshape((-1, 1, 1)))
[ "Takes", "images", "scaled", "to", "[", "0", "1", "]", "and", "returns", "them", "appropriately", "scaled", "and", "mean", "-", "subtracted", "for", "VGG", "-", "16" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L26-L33
[ "def", "_vgg16_data_prep", "(", "batch", ")", ":", "from", "mxnet", "import", "nd", "mean", "=", "nd", ".", "array", "(", "[", "123.68", ",", "116.779", ",", "103.939", "]", ",", "ctx", "=", "batch", ".", "context", ")", "return", "nd", ".", "broadca...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a :class:`StyleTransfer` model. Parameters ---------- style_dataset: SFrame Input style images. The columns named by the ``style_feature`` parameters will be extracted for training the model. content_dataset : SFrame Input content images. The columns named by the ``conte...
src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py
def create(style_dataset, content_dataset, style_feature=None, content_feature=None, max_iterations=None, model='resnet-16', verbose=True, batch_size = 6, **kwargs): """ Create a :class:`StyleTransfer` model. Parameters ---------- style_dataset: SFrame Input style images. Th...
def create(style_dataset, content_dataset, style_feature=None, content_feature=None, max_iterations=None, model='resnet-16', verbose=True, batch_size = 6, **kwargs): """ Create a :class:`StyleTransfer` model. Parameters ---------- style_dataset: SFrame Input style images. Th...
[ "Create", "a", ":", "class", ":", "StyleTransfer", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L35-L402
[ "def", "create", "(", "style_dataset", ",", "content_dataset", ",", "style_feature", "=", "None", ",", "content_feature", "=", "None", ",", "max_iterations", "=", "None", ",", "model", "=", "'resnet-16'", ",", "verbose", "=", "True", ",", "batch_size", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
StyleTransfer._canonize_content_input
Takes input and returns tuple of the input in canonical form (SFrame) along with an unpack callback function that can be applied to prediction results to "undo" the canonization.
src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py
def _canonize_content_input(self, dataset, single_style): """ Takes input and returns tuple of the input in canonical form (SFrame) along with an unpack callback function that can be applied to prediction results to "undo" the canonization. """ unpack = lambda x: x ...
def _canonize_content_input(self, dataset, single_style): """ Takes input and returns tuple of the input in canonical form (SFrame) along with an unpack callback function that can be applied to prediction results to "undo" the canonization. """ unpack = lambda x: x ...
[ "Takes", "input", "and", "returns", "tuple", "of", "the", "input", "in", "canonical", "form", "(", "SFrame", ")", "along", "with", "an", "unpack", "callback", "function", "that", "can", "be", "applied", "to", "prediction", "results", "to", "undo", "the", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L542-L557
[ "def", "_canonize_content_input", "(", "self", ",", "dataset", ",", "single_style", ")", ":", "unpack", "=", "lambda", "x", ":", "x", "if", "isinstance", "(", "dataset", ",", "_tc", ".", "SArray", ")", ":", "dataset", "=", "_tc", ".", "SFrame", "(", "{...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
StyleTransfer.stylize
Stylize an SFrame of Images given a style index or a list of styles. Parameters ---------- images : SFrame | Image A dataset that has the same content image column that was used during training. style : int or list, optional The selected styl...
src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py
def stylize(self, images, style=None, verbose=True, max_size=800, batch_size = 4): """ Stylize an SFrame of Images given a style index or a list of styles. Parameters ---------- images : SFrame | Image A dataset that has the same content image column that was...
def stylize(self, images, style=None, verbose=True, max_size=800, batch_size = 4): """ Stylize an SFrame of Images given a style index or a list of styles. Parameters ---------- images : SFrame | Image A dataset that has the same content image column that was...
[ "Stylize", "an", "SFrame", "of", "Images", "given", "a", "style", "index", "or", "a", "list", "of", "styles", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L559-L754
[ "def", "stylize", "(", "self", ",", "images", ",", "style", "=", "None", ",", "verbose", "=", "True", ",", "max_size", "=", "800", ",", "batch_size", "=", "4", ")", ":", "if", "(", "batch_size", "<", "1", ")", ":", "raise", "_ToolkitError", "(", "\...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
StyleTransfer.export_coreml
Save the model in Core ML format. The Core ML model takes an image of fixed size, and a style index inputs and produces an output of an image of fixed size Parameters ---------- path : string A string to the path for saving the Core ML model. image_shape: tu...
src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py
def export_coreml(self, path, image_shape=(256, 256), include_flexible_shape=True): """ Save the model in Core ML format. The Core ML model takes an image of fixed size, and a style index inputs and produces an output of an image of fixed size Parameters -------...
def export_coreml(self, path, image_shape=(256, 256), include_flexible_shape=True): """ Save the model in Core ML format. The Core ML model takes an image of fixed size, and a style index inputs and produces an output of an image of fixed size Parameters -------...
[ "Save", "the", "model", "in", "Core", "ML", "format", ".", "The", "Core", "ML", "model", "takes", "an", "image", "of", "fixed", "size", "and", "a", "style", "index", "inputs", "and", "produces", "an", "output", "of", "an", "image", "of", "fixed", "size...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L770-L874
[ "def", "export_coreml", "(", "self", ",", "path", ",", "image_shape", "=", "(", "256", ",", "256", ")", ",", "include_flexible_shape", "=", "True", ")", ":", "import", "mxnet", "as", "_mx", "from", ".", ".", "_mxnet", ".", "_mxnet_to_coreml", "import", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
StyleTransfer.get_styles
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 ...
src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py
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): """ 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 ...
[ "Returns", "SFrame", "of", "style", "images", "used", "for", "training", "the", "model" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L876-L911
[ "def", "get_styles", "(", "self", ",", "style", "=", "None", ")", ":", "style", ",", "_", "=", "self", ".", "_style_input_check", "(", "style", ")", "return", "self", ".", "styles", ".", "filter_by", "(", "style", ",", "self", ".", "_index_column", ")"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert an MXNet model to the protobuf spec. Parameters ---------- model: MXNet model A trained MXNet neural network model. input_shape: list of tuples A list of (name, shape) tuples, defining the input names and their shapes. The list also serves to define the desired order of...
src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_mxnet_converter.py
def convert(model, input_shape, class_labels=None, mode=None, preprocessor_args=None, builder=None, verbose=True): """Convert an MXNet model to the protobuf spec. Parameters ---------- model: MXNet model A trained MXNet neural network model. input_shape: list of tuples ...
def convert(model, input_shape, class_labels=None, mode=None, preprocessor_args=None, builder=None, verbose=True): """Convert an MXNet model to the protobuf spec. Parameters ---------- model: MXNet model A trained MXNet neural network model. input_shape: list of tuples ...
[ "Convert", "an", "MXNet", "model", "to", "the", "protobuf", "spec", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_mxnet_converter.py#L127-L272
[ "def", "convert", "(", "model", ",", "input_shape", ",", "class_labels", "=", "None", ",", "mode", "=", "None", ",", "preprocessor_args", "=", "None", ",", "builder", "=", "None", ",", "verbose", "=", "True", ")", ":", "if", "not", "isinstance", "(", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
load_model
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...
src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_util.py
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): """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: ...
[ "Load", "a", "libsvm", "model", "from", "a", "path", "on", "disk", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_util.py#L8-L34
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
add_enumerated_multiarray_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 The name of the image feature for which to add shape information. If the...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
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): """ 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...
[ "Annotate", "an", "input", "or", "output", "multiArray", "feature", "in", "a", "Neural", "Network", "spec", "to", "to", "accommodate", "a", "list", "of", "enumerated", "array", "shapes" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L291-L370
[ "def", "add_enumerated_multiarray_shapes", "(", "spec", ",", "feature_name", ",", "shapes", ")", ":", "if", "not", "isinstance", "(", "shapes", ",", "list", ")", ":", "shapes", "=", "[", "shapes", "]", "for", "shape", "in", "shapes", ":", "if", "not", "i...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
add_enumerated_image_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 image feature for which to add size information. If the featur...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
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): """ 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...
[ "Annotate", "an", "input", "or", "output", "image", "feature", "in", "a", "Neural", "Network", "spec", "to", "to", "accommodate", "a", "list", "of", "enumerated", "image", "sizes" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L373-L437
[ "def", "add_enumerated_image_sizes", "(", "spec", ",", "feature_name", ",", "sizes", ")", ":", "if", "not", "isinstance", "(", "sizes", ",", "list", ")", ":", "sizes", "=", "[", "sizes", "]", "for", "size", "in", "sizes", ":", "if", "not", "isinstance", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
update_image_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 feature for which to add shape information. If the feature is not ...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
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): """ 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...
[ "Annotate", "an", "input", "or", "output", "Image", "feature", "in", "a", "Neural", "Network", "spec", "to", "to", "accommodate", "a", "range", "of", "image", "sizes" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L440-L490
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
update_multiarray_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 feature for which to add shape range information. If the feature is not f...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
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): """ 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...
[ "Annotate", "an", "input", "or", "output", "MLMultiArray", "feature", "in", "a", "Neural", "Network", "spec", "to", "accommodate", "a", "range", "of", "shapes" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L493-L556
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
get_allowed_shape_ranges
For a given model specification, returns a dictionary with a shape range object for each input feature name.
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
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): """ 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...
[ "For", "a", "given", "model", "specification", "returns", "a", "dictionary", "with", "a", "shape", "range", "object", "for", "each", "input", "feature", "name", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L559-L571
[ "def", "get_allowed_shape_ranges", "(", "spec", ")", ":", "shaper", "=", "NeuralNetworkShaper", "(", "spec", ",", "False", ")", "inputs", "=", "_get_input_names", "(", "spec", ")", "output", "=", "{", "}", "for", "input", "in", "inputs", ":", "output", "["...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
can_allow_multiple_input_shapes
Examines a model specification and determines if it can compute results for more than one output shape. :param spec: MLModel The protobuf specification of the model. :return: Bool Returns True if the model can allow multiple input shapes, False otherwise.
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
def can_allow_multiple_input_shapes(spec): """ Examines a model specification and determines if it can compute results for more than one output shape. :param spec: MLModel The protobuf specification of the model. :return: Bool Returns True if the model can allow multiple input shapes, ...
def can_allow_multiple_input_shapes(spec): """ Examines a model specification and determines if it can compute results for more than one output shape. :param spec: MLModel The protobuf specification of the model. :return: Bool Returns True if the model can allow multiple input shapes, ...
[ "Examines", "a", "model", "specification", "and", "determines", "if", "it", "can", "compute", "results", "for", "more", "than", "one", "output", "shape", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L575-L607
[ "def", "can_allow_multiple_input_shapes", "(", "spec", ")", ":", "# First, check that the model actually has a neural network in it", "try", ":", "layers", "=", "_get_nn_layers", "(", "spec", ")", "except", ":", "raise", "Exception", "(", "'Unable to verify that this model co...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NeuralNetworkMultiArrayShapeRange.isFlexible
Returns true if any one of the channel, height, or width ranges of this shape allow more than one input value.
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py
def isFlexible(self): """ Returns true if any one of the channel, height, or width ranges of this shape allow more than one input value. """ for key, value in self.arrayShapeRange.items(): if key in _CONSTRAINED_KEYS: if value.isFlexible: r...
def isFlexible(self): """ Returns true if any one of the channel, height, or width ranges of this shape allow more than one input value. """ for key, value in self.arrayShapeRange.items(): if key in _CONSTRAINED_KEYS: if value.isFlexible: r...
[ "Returns", "true", "if", "any", "one", "of", "the", "channel", "height", "or", "width", "ranges", "of", "this", "shape", "allow", "more", "than", "one", "input", "value", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L220-L229
[ "def", "isFlexible", "(", "self", ")", ":", "for", "key", ",", "value", "in", "self", ".", "arrayShapeRange", ".", "items", "(", ")", ":", "if", "key", "in", "_CONSTRAINED_KEYS", ":", "if", "value", ".", "isFlexible", ":", "return", "True", "return", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
define_macro
Generate a macro definition or undefinition
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def define_macro(out_f, (name, args, body), undefine=False, check=True): """Generate a macro definition or undefinition""" if undefine: out_f.write( '#undef {0}\n' .format(macro_name(name)) ) else: if args: arg_list = '({0})'.format(', '.join(args)...
def define_macro(out_f, (name, args, body), undefine=False, check=True): """Generate a macro definition or undefinition""" if undefine: out_f.write( '#undef {0}\n' .format(macro_name(name)) ) else: if args: arg_list = '({0})'.format(', '.join(args)...
[ "Generate", "a", "macro", "definition", "or", "undefinition" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L92-L115
[ "def", "define_macro", "(", "out_f", ",", "(", "name", ",", "args", ",", "body", ")", ",", "undefine", "=", "False", ",", "check", "=", "True", ")", ":", "if", "undefine", ":", "out_f", ".", "write", "(", "'#undef {0}\\n'", ".", "format", "(", "macro...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
filename
Generate the filename
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def filename(out_dir, name, undefine=False): """Generate the filename""" if undefine: prefix = 'undef_' else: prefix = '' return os.path.join(out_dir, '{0}{1}.hpp'.format(prefix, name.lower()))
def filename(out_dir, name, undefine=False): """Generate the filename""" if undefine: prefix = 'undef_' else: prefix = '' return os.path.join(out_dir, '{0}{1}.hpp'.format(prefix, name.lower()))
[ "Generate", "the", "filename" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L118-L124
[ "def", "filename", "(", "out_dir", ",", "name", ",", "undefine", "=", "False", ")", ":", "if", "undefine", ":", "prefix", "=", "'undef_'", "else", ":", "prefix", "=", "''", "return", "os", ".", "path", ".", "join", "(", "out_dir", ",", "'{0}{1}.hpp'", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
length_limits
Generates the length limits
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def length_limits(max_length_limit, length_limit_step): """Generates the length limits""" string_len = len(str(max_length_limit)) return [ str(i).zfill(string_len) for i in xrange( length_limit_step, max_length_limit + length_limit_step - 1, length_limit_s...
def length_limits(max_length_limit, length_limit_step): """Generates the length limits""" string_len = len(str(max_length_limit)) return [ str(i).zfill(string_len) for i in xrange( length_limit_step, max_length_limit + length_limit_step - 1, length_limit_s...
[ "Generates", "the", "length", "limits" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L127-L137
[ "def", "length_limits", "(", "max_length_limit", ",", "length_limit_step", ")", ":", "string_len", "=", "len", "(", "str", "(", "max_length_limit", ")", ")", "return", "[", "str", "(", "i", ")", ".", "zfill", "(", "string_len", ")", "for", "i", "in", "xr...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generate_take
Generate the take function
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def generate_take(out_f, steps, line_prefix): """Generate the take function""" out_f.write( '{0}constexpr inline int take(int n_)\n' '{0}{{\n' '{0} return {1} 0 {2};\n' '{0}}}\n' '\n'.format( line_prefix, ''.join('n_ >= {0} ? {0} : ('.format(s) fo...
def generate_take(out_f, steps, line_prefix): """Generate the take function""" out_f.write( '{0}constexpr inline int take(int n_)\n' '{0}{{\n' '{0} return {1} 0 {2};\n' '{0}}}\n' '\n'.format( line_prefix, ''.join('n_ >= {0} ? {0} : ('.format(s) fo...
[ "Generate", "the", "take", "function" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L145-L157
[ "def", "generate_take", "(", "out_f", ",", "steps", ",", "line_prefix", ")", ":", "out_f", ".", "write", "(", "'{0}constexpr inline int take(int n_)\\n'", "'{0}{{\\n'", "'{0} return {1} 0 {2};\\n'", "'{0}}}\\n'", "'\\n'", ".", "format", "(", "line_prefix", ",", "''",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generate_make_string
Generate the make_string template
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def generate_make_string(out_f, max_step): """Generate the make_string template""" steps = [2 ** n for n in xrange(int(math.log(max_step, 2)), -1, -1)] with Namespace( out_f, ['boost', 'metaparse', 'v{0}'.format(VERSION), 'impl'] ) as nsp: generate_take(out_f, steps, nsp.prefix(...
def generate_make_string(out_f, max_step): """Generate the make_string template""" steps = [2 ** n for n in xrange(int(math.log(max_step, 2)), -1, -1)] with Namespace( out_f, ['boost', 'metaparse', 'v{0}'.format(VERSION), 'impl'] ) as nsp: generate_take(out_f, steps, nsp.prefix(...
[ "Generate", "the", "make_string", "template" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L160-L199
[ "def", "generate_make_string", "(", "out_f", ",", "max_step", ")", ":", "steps", "=", "[", "2", "**", "n", "for", "n", "in", "xrange", "(", "int", "(", "math", ".", "log", "(", "max_step", ",", "2", ")", ")", ",", "-", "1", ",", "-", "1", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generate_string
Generate string.hpp
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def generate_string(out_dir, limits): """Generate string.hpp""" max_limit = max((int(v) for v in limits)) with open(filename(out_dir, 'string'), 'wb') as out_f: with IncludeGuard(out_f): out_f.write( '\n' '#include <boost/metaparse/v{0}/cpp11/impl/concat....
def generate_string(out_dir, limits): """Generate string.hpp""" max_limit = max((int(v) for v in limits)) with open(filename(out_dir, 'string'), 'wb') as out_f: with IncludeGuard(out_f): out_f.write( '\n' '#include <boost/metaparse/v{0}/cpp11/impl/concat....
[ "Generate", "string", ".", "hpp" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L202-L275
[ "def", "generate_string", "(", "out_dir", ",", "limits", ")", ":", "max_limit", "=", "max", "(", "(", "int", "(", "v", ")", "for", "v", "in", "limits", ")", ")", "with", "open", "(", "filename", "(", "out_dir", ",", "'string'", ")", ",", "'wb'", ")...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
existing_path
Throws when the path does not exist
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def existing_path(value): """Throws when the path does not exist""" if os.path.exists(value): return value else: raise argparse.ArgumentTypeError("Path {0} not found".format(value))
def existing_path(value): """Throws when the path does not exist""" if os.path.exists(value): return value else: raise argparse.ArgumentTypeError("Path {0} not found".format(value))
[ "Throws", "when", "the", "path", "does", "not", "exist" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L287-L292
[ "def", "existing_path", "(", "value", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "value", ")", ":", "return", "value", "else", ":", "raise", "argparse", ".", "ArgumentTypeError", "(", "\"Path {0} not found\"", ".", "format", "(", "value", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
main
The main function of the script
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def main(): """The main function of the script""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( '--boost_dir', required=False, type=existing_path, help='The path to the include/boost directory of Metaparse' ) parser.add_argument( '...
def main(): """The main function of the script""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( '--boost_dir', required=False, type=existing_path, help='The path to the include/boost directory of Metaparse' ) parser.add_argument( '...
[ "The", "main", "function", "of", "the", "script" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L295-L343
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ")", "parser", ".", "add_argument", "(", "'--boost_dir'", ",", "required", "=", "False", ",", "type", "=", "existing_path", ",", "help", "="...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Namespace.begin
Generate the beginning part
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def begin(self): """Generate the beginning part""" self.out_f.write('\n') for depth, name in enumerate(self.names): self.out_f.write( '{0}namespace {1}\n{0}{{\n'.format(self.prefix(depth), name) )
def begin(self): """Generate the beginning part""" self.out_f.write('\n') for depth, name in enumerate(self.names): self.out_f.write( '{0}namespace {1}\n{0}{{\n'.format(self.prefix(depth), name) )
[ "Generate", "the", "beginning", "part" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L25-L31
[ "def", "begin", "(", "self", ")", ":", "self", ".", "out_f", ".", "write", "(", "'\\n'", ")", "for", "depth", ",", "name", "in", "enumerate", "(", "self", ".", "names", ")", ":", "self", ".", "out_f", ".", "write", "(", "'{0}namespace {1}\\n{0}{{\\n'",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Namespace.end
Generate the closing part
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def end(self): """Generate the closing part""" for depth in xrange(len(self.names) - 1, -1, -1): self.out_f.write('{0}}}\n'.format(self.prefix(depth)))
def end(self): """Generate the closing part""" for depth in xrange(len(self.names) - 1, -1, -1): self.out_f.write('{0}}}\n'.format(self.prefix(depth)))
[ "Generate", "the", "closing", "part" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L33-L36
[ "def", "end", "(", "self", ")", ":", "for", "depth", "in", "xrange", "(", "len", "(", "self", ".", "names", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "self", ".", "out_f", ".", "write", "(", "'{0}}}\\n'", ".", "format", "(", "sel...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
IncludeGuard.begin
Generate the beginning part
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
def begin(self): """Generate the beginning part""" name = 'BOOST_METAPARSE_V1_CPP11_IMPL_STRING_HPP' self.out_f.write('#ifndef {0}\n#define {0}\n'.format(name)) write_autogen_info(self.out_f)
def begin(self): """Generate the beginning part""" name = 'BOOST_METAPARSE_V1_CPP11_IMPL_STRING_HPP' self.out_f.write('#ifndef {0}\n#define {0}\n'.format(name)) write_autogen_info(self.out_f)
[ "Generate", "the", "beginning", "part" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L69-L73
[ "def", "begin", "(", "self", ")", ":", "name", "=", "'BOOST_METAPARSE_V1_CPP11_IMPL_STRING_HPP'", "self", ".", "out_f", ".", "write", "(", "'#ifndef {0}\\n#define {0}\\n'", ".", "format", "(", "name", ")", ")", "write_autogen_info", "(", "self", ".", "out_f", ")...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
get_deep_features
Calculates the deep features used by the Sound Classifier. Internally the Sound Classifier calculates deep features for both model creation and predictions. If the same data will be used multiple times, calculating the deep features just once will result in a significant speed up. Parameters -...
src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py
def get_deep_features(audio_data, verbose=True): ''' Calculates the deep features used by the Sound Classifier. Internally the Sound Classifier calculates deep features for both model creation and predictions. If the same data will be used multiple times, calculating the deep features just once wil...
def get_deep_features(audio_data, verbose=True): ''' Calculates the deep features used by the Sound Classifier. Internally the Sound Classifier calculates deep features for both model creation and predictions. If the same data will be used multiple times, calculating the deep features just once wil...
[ "Calculates", "the", "deep", "features", "used", "by", "the", "Sound", "Classifier", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L45-L75
[ "def", "get_deep_features", "(", "audio_data", ",", "verbose", "=", "True", ")", ":", "from", ".", "_audio_feature_extractor", "import", "_get_feature_extractor", "if", "not", "_is_audio_data_sarray", "(", "audio_data", ")", ":", "raise", "TypeError", "(", "\"Input ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Creates a :class:`SoundClassifier` model. Parameters ---------- dataset : SFrame Input data. The column named by the 'feature' parameter will be extracted for modeling. target : string or int Name of the column containing the target variable. The values in this column m...
src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py
def create(dataset, target, feature, max_iterations=10, custom_layer_sizes=[100, 100], verbose=True, validation_set='auto', batch_size=64): ''' Creates a :class:`SoundClassifier` model. Parameters ---------- dataset : SFrame Input data. The column named by the 'feature...
def create(dataset, target, feature, max_iterations=10, custom_layer_sizes=[100, 100], verbose=True, validation_set='auto', batch_size=64): ''' Creates a :class:`SoundClassifier` model. Parameters ---------- dataset : SFrame Input data. The column named by the 'feature...
[ "Creates", "a", ":", "class", ":", "SoundClassifier", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L78-L303
[ "def", "create", "(", "dataset", ",", "target", ",", "feature", ",", "max_iterations", "=", "10", ",", "custom_layer_sizes", "=", "[", "100", ",", "100", "]", ",", "verbose", "=", "True", ",", "validation_set", "=", "'auto'", ",", "batch_size", "=", "64"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SoundClassifier._load_version
A function to load a previously saved SoundClassifier instance.
src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py
def _load_version(cls, state, version): """ A function to load a previously saved SoundClassifier instance. """ from ._audio_feature_extractor import _get_feature_extractor from .._mxnet import _mxnet_utils state['_feature_extractor'] = _get_feature_extractor(state['feat...
def _load_version(cls, state, version): """ A function to load a previously saved SoundClassifier instance. """ from ._audio_feature_extractor import _get_feature_extractor from .._mxnet import _mxnet_utils state['_feature_extractor'] = _get_feature_extractor(state['feat...
[ "A", "function", "to", "load", "a", "previously", "saved", "SoundClassifier", "instance", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L363-L388
[ "def", "_load_version", "(", "cls", ",", "state", ",", "version", ")", ":", "from", ".", "_audio_feature_extractor", "import", "_get_feature_extractor", "from", ".", ".", "_mxnet", "import", "_mxnet_utils", "state", "[", "'_feature_extractor'", "]", "=", "_get_fea...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SoundClassifier.classify
Return the classification for each examples in the ``dataset``. The output SFrame contains predicted class labels and its probability. Parameters ---------- dataset : SFrame | SArray | dict The audio data to be classified. If dataset is an SFrame, it must have a ...
src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py
def classify(self, dataset, verbose=True, batch_size=64): """ Return the classification for each examples in the ``dataset``. The output SFrame contains predicted class labels and its probability. Parameters ---------- dataset : SFrame | SArray | dict The aud...
def classify(self, dataset, verbose=True, batch_size=64): """ Return the classification for each examples in the ``dataset``. The output SFrame contains predicted class labels and its probability. Parameters ---------- dataset : SFrame | SArray | dict The aud...
[ "Return", "the", "classification", "for", "each", "examples", "in", "the", "dataset", ".", "The", "output", "SFrame", "contains", "predicted", "class", "labels", "and", "its", "probability", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L447-L487
[ "def", "classify", "(", "self", ",", "dataset", ",", "verbose", "=", "True", ",", "batch_size", "=", "64", ")", ":", "prob_vector", "=", "self", ".", "predict", "(", "dataset", ",", "output_type", "=", "'probability_vector'", ",", "verbose", "=", "verbose"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SoundClassifier.evaluate
Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset to use for evaluation, must include a column with the same name as the features used for model training. Additional colu...
src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py
def evaluate(self, dataset, metric='auto', verbose=True, batch_size=64): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset to use for evaluation, must include a c...
def evaluate(self, dataset, metric='auto', verbose=True, batch_size=64): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset to use for evaluation, must include a c...
[ "Evaluate", "the", "model", "by", "making", "predictions", "of", "target", "values", "and", "comparing", "these", "to", "actual", "values", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L489-L600
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "verbose", "=", "True", ",", "batch_size", "=", "64", ")", ":", "from", "turicreate", ".", "toolkits", "import", "evaluation", "# parameter checking", "if", "not", "isinstance...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SoundClassifier.export_coreml
Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('./myModel.mlmodel')
src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py
def export_coreml(self, filename): """ Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('./myModel.mlmodel') """ import coremltools from coremltools.proto.FeatureTypes_pb2 import A...
def export_coreml(self, filename): """ Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('./myModel.mlmodel') """ import coremltools from coremltools.proto.FeatureTypes_pb2 import A...
[ "Save", "the", "model", "in", "Core", "ML", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L602-L721
[ "def", "export_coreml", "(", "self", ",", "filename", ")", ":", "import", "coremltools", "from", "coremltools", ".", "proto", ".", "FeatureTypes_pb2", "import", "ArrayFeatureType", "from", ".", ".", "_mxnet", "import", "_mxnet_utils", "prob_name", "=", "self", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e