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
_toolkits_select_columns
Same as select columns but redirect runtime error to ToolkitError.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _toolkits_select_columns(dataset, columns): """ Same as select columns but redirect runtime error to ToolkitError. """ try: return dataset.select_columns(columns) except RuntimeError: missing_features = list(set(columns).difference(set(dataset.column_names()))) raise Tool...
def _toolkits_select_columns(dataset, columns): """ Same as select columns but redirect runtime error to ToolkitError. """ try: return dataset.select_columns(columns) except RuntimeError: missing_features = list(set(columns).difference(set(dataset.column_names()))) raise Tool...
[ "Same", "as", "select", "columns", "but", "redirect", "runtime", "error", "to", "ToolkitError", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L462-L471
[ "def", "_toolkits_select_columns", "(", "dataset", ",", "columns", ")", ":", "try", ":", "return", "dataset", ".", "select_columns", "(", "columns", ")", "except", "RuntimeError", ":", "missing_features", "=", "list", "(", "set", "(", "columns", ")", ".", "d...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_raise_error_if_column_exists
Check if a column exists in an SFrame with error message.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _raise_error_if_column_exists(dataset, column_name = 'dataset', dataset_variable_name = 'dataset', column_name_error_message_name = 'column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must...
def _raise_error_if_column_exists(dataset, column_name = 'dataset', dataset_variable_name = 'dataset', column_name_error_message_name = 'column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must...
[ "Check", "if", "a", "column", "exists", "in", "an", "SFrame", "with", "error", "message", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L473-L483
[ "def", "_raise_error_if_column_exists", "(", "dataset", ",", "column_name", "=", "'dataset'", ",", "dataset_variable_name", "=", "'dataset'", ",", "column_name_error_message_name", "=", "'column_name'", ")", ":", "err_msg", "=", "'The SFrame {0} must contain the column {1}.'"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_check_categorical_option_type
Check whether or not the requested option is one of the allowed values.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _check_categorical_option_type(option_name, option_value, possible_values): """ Check whether or not the requested option is one of the allowed values. """ err_msg = '{0} is not a valid option for {1}. '.format(option_value, option_name) err_msg += ' Expected one of: '.format(possible_values) ...
def _check_categorical_option_type(option_name, option_value, possible_values): """ Check whether or not the requested option is one of the allowed values. """ err_msg = '{0} is not a valid option for {1}. '.format(option_value, option_name) err_msg += ' Expected one of: '.format(possible_values) ...
[ "Check", "whether", "or", "not", "the", "requested", "option", "is", "one", "of", "the", "allowed", "values", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L485-L494
[ "def", "_check_categorical_option_type", "(", "option_name", ",", "option_value", ",", "possible_values", ")", ":", "err_msg", "=", "'{0} is not a valid option for {1}. '", ".", "format", "(", "option_value", ",", "option_name", ")", "err_msg", "+=", "' Expected one of: '...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_raise_error_if_not_sarray
Check if the input is an SArray. Provide a proper error message otherwise.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _raise_error_if_not_sarray(dataset, variable_name="SArray"): """ Check if the input is an SArray. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SArray." if not isinstance(dataset, _SArray): raise ToolkitError(err_msg % variable_name)
def _raise_error_if_not_sarray(dataset, variable_name="SArray"): """ Check if the input is an SArray. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SArray." if not isinstance(dataset, _SArray): raise ToolkitError(err_msg % variable_name)
[ "Check", "if", "the", "input", "is", "an", "SArray", ".", "Provide", "a", "proper", "error", "message", "otherwise", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L496-L503
[ "def", "_raise_error_if_not_sarray", "(", "dataset", ",", "variable_name", "=", "\"SArray\"", ")", ":", "err_msg", "=", "\"Input %s is not an SArray.\"", "if", "not", "isinstance", "(", "dataset", ",", "_SArray", ")", ":", "raise", "ToolkitError", "(", "err_msg", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_raise_error_if_not_sframe
Check if the input is an SFrame. Provide a proper error message otherwise.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _raise_error_if_not_sframe(dataset, variable_name="SFrame"): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SFrame. If it is a Pandas DataFrame," err_msg += " you may use the to_sframe() function to convert it to an SFrame." ...
def _raise_error_if_not_sframe(dataset, variable_name="SFrame"): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SFrame. If it is a Pandas DataFrame," err_msg += " you may use the to_sframe() function to convert it to an SFrame." ...
[ "Check", "if", "the", "input", "is", "an", "SFrame", ".", "Provide", "a", "proper", "error", "message", "otherwise", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L511-L520
[ "def", "_raise_error_if_not_sframe", "(", "dataset", ",", "variable_name", "=", "\"SFrame\"", ")", ":", "err_msg", "=", "\"Input %s is not an SFrame. If it is a Pandas DataFrame,\"", "err_msg", "+=", "\" you may use the to_sframe() function to convert it to an SFrame.\"", "if", "no...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_raise_error_if_sframe_empty
Check if the input is empty.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _raise_error_if_sframe_empty(dataset, variable_name="SFrame"): """ Check if the input is empty. """ err_msg = "Input %s either has no rows or no columns. A non-empty SFrame " err_msg += "is required." if dataset.num_rows() == 0 or dataset.num_columns() == 0: raise ToolkitError(err_m...
def _raise_error_if_sframe_empty(dataset, variable_name="SFrame"): """ Check if the input is empty. """ err_msg = "Input %s either has no rows or no columns. A non-empty SFrame " err_msg += "is required." if dataset.num_rows() == 0 or dataset.num_columns() == 0: raise ToolkitError(err_m...
[ "Check", "if", "the", "input", "is", "empty", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L522-L530
[ "def", "_raise_error_if_sframe_empty", "(", "dataset", ",", "variable_name", "=", "\"SFrame\"", ")", ":", "err_msg", "=", "\"Input %s either has no rows or no columns. A non-empty SFrame \"", "err_msg", "+=", "\"is required.\"", "if", "dataset", ".", "num_rows", "(", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_raise_error_evaluation_metric_is_valid
Check if the input is an SFrame. Provide a proper error message otherwise.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _raise_error_evaluation_metric_is_valid(metric, allowed_metrics): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Evaluation metric '%s' not recognized. The supported evaluation" err_msg += " metrics are (%s)." if metric not in allowed_metr...
def _raise_error_evaluation_metric_is_valid(metric, allowed_metrics): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Evaluation metric '%s' not recognized. The supported evaluation" err_msg += " metrics are (%s)." if metric not in allowed_metr...
[ "Check", "if", "the", "input", "is", "an", "SFrame", ".", "Provide", "a", "proper", "error", "message", "otherwise", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L541-L552
[ "def", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "allowed_metrics", ")", ":", "err_msg", "=", "\"Evaluation metric '%s' not recognized. The supported evaluation\"", "err_msg", "+=", "\" metrics are (%s).\"", "if", "metric", "not", "in", "allowed_metrics", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_numeric_param_check_range
Checks if numeric parameter is within given range
src/unity/python/turicreate/toolkits/_internal_utils.py
def _numeric_param_check_range(variable_name, variable_value, range_bottom, range_top): """ Checks if numeric parameter is within given range """ err_msg = "%s must be between %i and %i" if variable_value < range_bottom or variable_value > range_top: raise ToolkitError(err_msg % (variable_n...
def _numeric_param_check_range(variable_name, variable_value, range_bottom, range_top): """ Checks if numeric parameter is within given range """ err_msg = "%s must be between %i and %i" if variable_value < range_bottom or variable_value > range_top: raise ToolkitError(err_msg % (variable_n...
[ "Checks", "if", "numeric", "parameter", "is", "within", "given", "range" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L554-L561
[ "def", "_numeric_param_check_range", "(", "variable_name", ",", "variable_value", ",", "range_bottom", ",", "range_top", ")", ":", "err_msg", "=", "\"%s must be between %i and %i\"", "if", "variable_value", "<", "range_bottom", "or", "variable_value", ">", "range_top", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_validate_data
Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. features : list[string], optional List of feature names used. validation_s...
src/unity/python/turicreate/toolkits/_internal_utils.py
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
[ "Validate", "and", "canonicalize", "training", "and", "validation", "data", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L563-L625
[ "def", "_validate_data", "(", "dataset", ",", "target", ",", "features", "=", "None", ",", "validation_set", "=", "'auto'", ")", ":", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"training dataset\"", ")", "# Determine columns to keep", "if", "features", "is...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_validate_row_label
Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset. label : str, optional Name of the column containing row labels. ...
src/unity/python/turicreate/toolkits/_internal_utils.py
def _validate_row_label(dataset, label=None, default_label='__id'): """ Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset....
def _validate_row_label(dataset, label=None, default_label='__id'): """ Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset....
[ "Validate", "a", "row", "label", "column", ".", "If", "the", "row", "label", "is", "not", "specified", "a", "column", "is", "created", "with", "row", "numbers", "named", "with", "the", "string", "in", "the", "default_label", "parameter", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L627-L682
[ "def", "_validate_row_label", "(", "dataset", ",", "label", "=", "None", ",", "default_label", "=", "'__id'", ")", ":", "## If no label is provided, set it to be a default and add a row number to", "# dataset. Check that this new name does not conflict with an existing", "# name.",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_mac_ver
Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _mac_ver(): """ Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple. """ import platform import sys if sys.platform == 'darwin': ver_str = platform.mac_ver()[0] return tuple([int(v) for v in v...
def _mac_ver(): """ Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple. """ import platform import sys if sys.platform == 'darwin': ver_str = platform.mac_ver()[0] return tuple([int(v) for v in v...
[ "Returns", "Mac", "version", "as", "a", "tuple", "of", "integers", "making", "it", "easy", "to", "do", "proper", "version", "comparisons", ".", "On", "non", "-", "Macs", "it", "returns", "an", "empty", "tuple", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L698-L709
[ "def", "_mac_ver", "(", ")", ":", "import", "platform", "import", "sys", "if", "sys", ".", "platform", "==", "'darwin'", ":", "ver_str", "=", "platform", ".", "mac_ver", "(", ")", "[", "0", "]", "return", "tuple", "(", "[", "int", "(", "v", ")", "f...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_print_neural_compute_device
Print a message making it clear to the user what compute resource is used in neural network training.
src/unity/python/turicreate/toolkits/_internal_utils.py
def _print_neural_compute_device(cuda_gpus, use_mps, cuda_mem_req=None, has_mps_impl=True): """ Print a message making it clear to the user what compute resource is used in neural network training. """ num_cuda_gpus = len(cuda_gpus) if num_cuda_gpus >= 1: gpu_names = ', '.join(gpu['name'...
def _print_neural_compute_device(cuda_gpus, use_mps, cuda_mem_req=None, has_mps_impl=True): """ Print a message making it clear to the user what compute resource is used in neural network training. """ num_cuda_gpus = len(cuda_gpus) if num_cuda_gpus >= 1: gpu_names = ', '.join(gpu['name'...
[ "Print", "a", "message", "making", "it", "clear", "to", "the", "user", "what", "compute", "resource", "is", "used", "in", "neural", "network", "training", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L711-L733
[ "def", "_print_neural_compute_device", "(", "cuda_gpus", ",", "use_mps", ",", "cuda_mem_req", "=", "None", ",", "has_mps_impl", "=", "True", ")", ":", "num_cuda_gpus", "=", "len", "(", "cuda_gpus", ")", "if", "num_cuda_gpus", ">=", "1", ":", "gpu_names", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_GetMessageFromFactory
Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is not found in the factory's descriptor pool.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
def _GetMessageFromFactory(factory, full_name): """Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is n...
def _GetMessageFromFactory(factory, full_name): """Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is n...
[ "Get", "a", "proto", "class", "from", "the", "MessageFactory", "by", "name", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L44-L57
[ "def", "_GetMessageFromFactory", "(", "factory", ",", "full_name", ")", ":", "proto_descriptor", "=", "factory", ".", "pool", ".", "FindMessageTypeByName", "(", "full_name", ")", "proto_cls", "=", "factory", ".", "GetPrototype", "(", "proto_descriptor", ")", "retu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
MakeSimpleProtoClass
Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherwise the fields will be sorted by name. full_name: opti...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
def MakeSimpleProtoClass(fields, full_name=None, pool=None): """Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherw...
def MakeSimpleProtoClass(fields, full_name=None, pool=None): """Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherw...
[ "Create", "a", "Protobuf", "class", "whose", "fields", "are", "basic", "types", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L60-L113
[ "def", "MakeSimpleProtoClass", "(", "fields", ",", "full_name", "=", "None", ",", "pool", "=", "None", ")", ":", "factory", "=", "message_factory", ".", "MessageFactory", "(", "pool", "=", "pool", ")", "if", "full_name", "is", "not", "None", ":", "try", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_MakeFileDescriptorProto
Populate FileDescriptorProto for MessageFactory's DescriptorPool.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
def _MakeFileDescriptorProto(proto_file_name, full_name, field_items): """Populate FileDescriptorProto for MessageFactory's DescriptorPool.""" package, name = full_name.rsplit('.', 1) file_proto = descriptor_pb2.FileDescriptorProto() file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name) f...
def _MakeFileDescriptorProto(proto_file_name, full_name, field_items): """Populate FileDescriptorProto for MessageFactory's DescriptorPool.""" package, name = full_name.rsplit('.', 1) file_proto = descriptor_pb2.FileDescriptorProto() file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name) f...
[ "Populate", "FileDescriptorProto", "for", "MessageFactory", "s", "DescriptorPool", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L116-L130
[ "def", "_MakeFileDescriptorProto", "(", "proto_file_name", ",", "full_name", ",", "field_items", ")", ":", "package", ",", "name", "=", "full_name", ".", "rsplit", "(", "'.'", ",", "1", ")", "file_proto", "=", "descriptor_pb2", ".", "FileDescriptorProto", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeClassifier A trained scikit-learn tree model. input_name: str Name of the input columns. output_name: str Name of the output columns. Returns ------- model_spec...
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_classifier.py
def convert(model, input_name, output_features): """Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeClassifier A trained scikit-learn tree model. input_name: str Name of the input columns. output_name: str Name of the...
def convert(model, input_name, output_features): """Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeClassifier A trained scikit-learn tree model. input_name: str Name of the input columns. output_name: str Name of the...
[ "Convert", "a", "decision", "tree", "model", "to", "protobuf", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_classifier.py#L18-L45
[ "def", "convert", "(", "model", ",", "input_name", ",", "output_features", ")", ":", "if", "not", "(", "HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "_sklearn_util", ".", "check_expected...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_model_metadata
Returns user-defined metadata, making sure information all models should have is also available, as a dictionary
src/unity/python/turicreate/toolkits/_coreml_utils.py
def _get_model_metadata(model_class, metadata, version=None): """ Returns user-defined metadata, making sure information all models should have is also available, as a dictionary """ from turicreate import __version__ info = { 'turicreate_version': __version__, 'type': model_cla...
def _get_model_metadata(model_class, metadata, version=None): """ Returns user-defined metadata, making sure information all models should have is also available, as a dictionary """ from turicreate import __version__ info = { 'turicreate_version': __version__, 'type': model_cla...
[ "Returns", "user", "-", "defined", "metadata", "making", "sure", "information", "all", "models", "should", "have", "is", "also", "available", "as", "a", "dictionary" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_coreml_utils.py#L16-L29
[ "def", "_get_model_metadata", "(", "model_class", ",", "metadata", ",", "version", "=", "None", ")", ":", "from", "turicreate", "import", "__version__", "info", "=", "{", "'turicreate_version'", ":", "__version__", ",", "'type'", ":", "model_class", ",", "}", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_set_model_metadata
Sets user-defined metadata, making sure information all models should have is also available
src/unity/python/turicreate/toolkits/_coreml_utils.py
def _set_model_metadata(mlmodel, model_class, metadata, version=None): """ Sets user-defined metadata, making sure information all models should have is also available """ info = _get_model_metadata(model_class, metadata, version) mlmodel.user_defined_metadata.update(info)
def _set_model_metadata(mlmodel, model_class, metadata, version=None): """ Sets user-defined metadata, making sure information all models should have is also available """ info = _get_model_metadata(model_class, metadata, version) mlmodel.user_defined_metadata.update(info)
[ "Sets", "user", "-", "defined", "metadata", "making", "sure", "information", "all", "models", "should", "have", "is", "also", "available" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_coreml_utils.py#L32-L38
[ "def", "_set_model_metadata", "(", "mlmodel", ",", "model_class", ",", "metadata", ",", "version", "=", "None", ")", ":", "info", "=", "_get_model_metadata", "(", "model_class", ",", "metadata", ",", "version", ")", "mlmodel", ".", "user_defined_metadata", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_ToCamelCase
Converts name to camel-case and returns it.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
def _ToCamelCase(name): """Converts name to camel-case and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': if result: capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c # L...
def _ToCamelCase(name): """Converts name to camel-case and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': if result: capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c # L...
[ "Converts", "name", "to", "camel", "-", "case", "and", "returns", "it", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L873-L891
[ "def", "_ToCamelCase", "(", "name", ")", ":", "capitalize_next", "=", "False", "result", "=", "[", "]", "for", "c", "in", "name", ":", "if", "c", "==", "'_'", ":", "if", "result", ":", "capitalize_next", "=", "True", "elif", "capitalize_next", ":", "re...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_ToJsonName
Converts name to Json name and returns it.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
def _ToJsonName(name): """Converts name to Json name and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c return ''.join(result)
def _ToJsonName(name): """Converts name to Json name and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c return ''.join(result)
[ "Converts", "name", "to", "Json", "name", "and", "returns", "it", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L902-L916
[ "def", "_ToJsonName", "(", "name", ")", ":", "capitalize_next", "=", "False", "result", "=", "[", "]", "for", "c", "in", "name", ":", "if", "c", "==", "'_'", ":", "capitalize_next", "=", "True", "elif", "capitalize_next", ":", "result", ".", "append", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DescriptorBase._SetOptions
Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
def _SetOptions(self, options, options_class_name): """Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2. """ self._options = options self._options_class_name = options_class_name # Does this descr...
def _SetOptions(self, options, options_class_name): """Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2. """ self._options = options self._options_class_name = options_class_name # Does this descr...
[ "Sets", "the", "descriptor", "s", "options" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L106-L116
[ "def", "_SetOptions", "(", "self", ",", "options", ",", "options_class_name", ")", ":", "self", ".", "_options", "=", "options", "self", ".", "_options_class_name", "=", "options_class_name", "# Does this descriptor have non-default options?", "self", ".", "has_options"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DescriptorBase.GetOptions
Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
def GetOptions(self): """Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor. """ if self._options: return self._options from google.protobuf import descriptor_pb2 try: options_class = getattr(descriptor_pb2, self._...
def GetOptions(self): """Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor. """ if self._options: return self._options from google.protobuf import descriptor_pb2 try: options_class = getattr(descriptor_pb2, self._...
[ "Retrieves", "descriptor", "options", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L118-L133
[ "def", "GetOptions", "(", "self", ")", ":", "if", "self", ".", "_options", ":", "return", "self", ".", "_options", "from", "google", ".", "protobuf", "import", "descriptor_pb2", "try", ":", "options_class", "=", "getattr", "(", "descriptor_pb2", ",", "self",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_NestedDescriptorBase.CopyToProto
Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
def CopyToProto(self, proto): """Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments. """ if (self.file is not None and self._serialized_...
def CopyToProto(self, proto): """Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments. """ if (self.file is not None and self._serialized_...
[ "Copies", "this", "to", "the", "matching", "proto", "in", "descriptor_pb2", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L174-L189
[ "def", "CopyToProto", "(", "self", ",", "proto", ")", ":", "if", "(", "self", ".", "file", "is", "not", "None", "and", "self", ".", "_serialized_start", "is", "not", "None", "and", "self", ".", "_serialized_end", "is", "not", "None", ")", ":", "proto",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Descriptor.EnumValueName
Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyError if either the Enum doesn't exist or the va...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
def EnumValueName(self, enum, value): """Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyErr...
def EnumValueName(self, enum, value): """Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyErr...
[ "Returns", "the", "string", "name", "of", "an", "enum", "value", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L321-L337
[ "def", "EnumValueName", "(", "self", ",", "enum", ",", "value", ")", ":", "return", "self", ".", "enum_types_by_name", "[", "enum", "]", ".", "values_by_number", "[", "value", "]", ".", "name" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
resolve_reference
Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def resolve_reference(target_reference, project): """ Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference. """ # Separate target name from properties override assert isinsta...
def resolve_reference(target_reference, project): """ Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference. """ # Separate target name from properties override assert isinsta...
[ "Given", "a", "target_reference", "made", "in", "context", "of", "project", "returns", "the", "AbstractTarget", "instance", "that", "is", "referred", "to", "as", "well", "as", "properties", "explicitly", "specified", "for", "this", "reference", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L841-L864
[ "def", "resolve_reference", "(", "target_reference", ",", "project", ")", ":", "# Separate target name from properties override", "assert", "isinstance", "(", "target_reference", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generate_from_reference
Attempts to generate the target given by target reference, which can refer both to a main target or to a file. Returns a list consisting of - usage requirements - generated virtual targets, if any target_reference: Target reference project: Project where the reference is made prop...
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def generate_from_reference(target_reference, project, property_set_): """ Attempts to generate the target given by target reference, which can refer both to a main target or to a file. Returns a list consisting of - usage requirements - generated virtual targets, if any target_reference: Targe...
def generate_from_reference(target_reference, project, property_set_): """ Attempts to generate the target given by target reference, which can refer both to a main target or to a file. Returns a list consisting of - usage requirements - generated virtual targets, if any target_reference: Targe...
[ "Attempts", "to", "generate", "the", "target", "given", "by", "target", "reference", "which", "can", "refer", "both", "to", "a", "main", "target", "or", "to", "a", "file", ".", "Returns", "a", "list", "consisting", "of", "-", "usage", "requirements", "-", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L866-L886
[ "def", "generate_from_reference", "(", "target_reference", ",", "project", ",", "property_set_", ")", ":", "assert", "isinstance", "(", "target_reference", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "assert", "isinstan...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TargetRegistry.main_target_alternative
Registers the specified target as a main target alternatives. Returns 'target'.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def main_target_alternative (self, target): """ Registers the specified target as a main target alternatives. Returns 'target'. """ assert isinstance(target, AbstractTarget) target.project ().add_alternative (target) return target
def main_target_alternative (self, target): """ Registers the specified target as a main target alternatives. Returns 'target'. """ assert isinstance(target, AbstractTarget) target.project ().add_alternative (target) return target
[ "Registers", "the", "specified", "target", "as", "a", "main", "target", "alternatives", ".", "Returns", "target", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L107-L113
[ "def", "main_target_alternative", "(", "self", ",", "target", ")", ":", "assert", "isinstance", "(", "target", ",", "AbstractTarget", ")", "target", ".", "project", "(", ")", ".", "add_alternative", "(", "target", ")", "return", "target" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TargetRegistry.main_target_sources
Return the list of sources to use, if main target rule is invoked with 'sources'. If there are any objects in 'sources', they are treated as main target instances, and the name of such targets are adjusted to be '<name_of_this_target>__<name_of_source_target>'. Such renaming is disabled ...
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def main_target_sources (self, sources, main_target_name, no_renaming=0): """Return the list of sources to use, if main target rule is invoked with 'sources'. If there are any objects in 'sources', they are treated as main target instances, and the name of such targets are adjusted to be...
def main_target_sources (self, sources, main_target_name, no_renaming=0): """Return the list of sources to use, if main target rule is invoked with 'sources'. If there are any objects in 'sources', they are treated as main target instances, and the name of such targets are adjusted to be...
[ "Return", "the", "list", "of", "sources", "to", "use", "if", "main", "target", "rule", "is", "invoked", "with", "sources", ".", "If", "there", "are", "any", "objects", "in", "sources", "they", "are", "treated", "as", "main", "target", "instances", "and", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L115-L145
[ "def", "main_target_sources", "(", "self", ",", "sources", ",", "main_target_name", ",", "no_renaming", "=", "0", ")", ":", "assert", "is_iterable_typed", "(", "sources", ",", "basestring", ")", "assert", "isinstance", "(", "main_target_name", ",", "basestring", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TargetRegistry.main_target_requirements
Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specification' are the properties xplicitly specified for a main target...
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def main_target_requirements(self, specification, project): """Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specificat...
def main_target_requirements(self, specification, project): """Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specificat...
[ "Returns", "the", "requirement", "to", "use", "when", "declaring", "a", "main", "target", "which", "are", "obtained", "by", "-", "translating", "all", "specified", "property", "paths", "and", "-", "refining", "project", "requirements", "with", "the", "one", "s...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L148-L167
[ "def", "main_target_requirements", "(", "self", ",", "specification", ",", "project", ")", ":", "assert", "is_iterable_typed", "(", "specification", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "# create a copy since the l...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TargetRegistry.main_target_usage_requirements
Returns the use requirement to use when declaraing a main target, which are obtained by - translating all specified property paths, and - adding project's usage requirements specification: Use-properties explicitly specified for a main target project: ...
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def main_target_usage_requirements (self, specification, project): """ Returns the use requirement to use when declaraing a main target, which are obtained by - translating all specified property paths, and - adding project's usage requirements specification: Use...
def main_target_usage_requirements (self, specification, project): """ Returns the use requirement to use when declaraing a main target, which are obtained by - translating all specified property paths, and - adding project's usage requirements specification: Use...
[ "Returns", "the", "use", "requirement", "to", "use", "when", "declaraing", "a", "main", "target", "which", "are", "obtained", "by", "-", "translating", "all", "specified", "property", "paths", "and", "-", "adding", "project", "s", "usage", "requirements", "spe...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L169-L188
[ "def", "main_target_usage_requirements", "(", "self", ",", "specification", ",", "project", ")", ":", "assert", "is_iterable_typed", "(", "specification", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "project_usage_require...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TargetRegistry.main_target_default_build
Return the default build value to use when declaring a main target, which is obtained by using specified value if not empty and parent's default build attribute otherwise. specification: Default build explicitly specified for a main target project: Project where t...
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def main_target_default_build (self, specification, project): """ Return the default build value to use when declaring a main target, which is obtained by using specified value if not empty and parent's default build attribute otherwise. specification: Default build explicit...
def main_target_default_build (self, specification, project): """ Return the default build value to use when declaring a main target, which is obtained by using specified value if not empty and parent's default build attribute otherwise. specification: Default build explicit...
[ "Return", "the", "default", "build", "value", "to", "use", "when", "declaring", "a", "main", "target", "which", "is", "obtained", "by", "using", "specified", "value", "if", "not", "empty", "and", "parent", "s", "default", "build", "attribute", "otherwise", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L190-L202
[ "def", "main_target_default_build", "(", "self", ",", "specification", ",", "project", ")", ":", "assert", "is_iterable_typed", "(", "specification", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "if", "specification", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TargetRegistry.start_building
Helper rules to detect cycles in main target references.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def start_building (self, main_target_instance): """ Helper rules to detect cycles in main target references. """ assert isinstance(main_target_instance, MainTarget) if id(main_target_instance) in self.targets_being_built_: names = [] for t in self.targets_being_b...
def start_building (self, main_target_instance): """ Helper rules to detect cycles in main target references. """ assert isinstance(main_target_instance, MainTarget) if id(main_target_instance) in self.targets_being_built_: names = [] for t in self.targets_being_b...
[ "Helper", "rules", "to", "detect", "cycles", "in", "main", "target", "references", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L204-L215
[ "def", "start_building", "(", "self", ",", "main_target_instance", ")", ":", "assert", "isinstance", "(", "main_target_instance", ",", "MainTarget", ")", "if", "id", "(", "main_target_instance", ")", "in", "self", ".", "targets_being_built_", ":", "names", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TargetRegistry.create_typed_target
Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified by the user in Jamfile corresponding to 'project'.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
[ "Creates", "a", "TypedTarget", "with", "the", "specified", "properties", ".", "The", "name", "sources", "requirements", "default_build", "and", "usage_requirements", "are", "assumed", "to", "be", "in", "the", "form", "specified", "by", "the", "user", "in", "Jamf...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L222-L237
[ "def", "create_typed_target", "(", "self", ",", "type", ",", "project", ",", "name", ",", "sources", ",", "requirements", ",", "default_build", ",", "usage_requirements", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "isinsta...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.generate
Generates all possible targets contained in this project.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def generate (self, ps): """ Generates all possible targets contained in this project. """ assert isinstance(ps, property_set.PropertySet) self.manager_.targets().log( "Building project '%s' with '%s'" % (self.name (), str(ps))) self.manager_.targets().increase_indent...
def generate (self, ps): """ Generates all possible targets contained in this project. """ assert isinstance(ps, property_set.PropertySet) self.manager_.targets().log( "Building project '%s' with '%s'" % (self.name (), str(ps))) self.manager_.targets().increase_indent...
[ "Generates", "all", "possible", "targets", "contained", "in", "this", "project", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L433-L448
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "targets", "(", ")", ".", "log", "(", "\"Building project '%s' with '%s'\"", "%", "(", "self...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.targets_to_build
Computes and returns a list of AbstractTarget instances which must be built when this project is built.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def targets_to_build (self): """ Computes and returns a list of AbstractTarget instances which must be built when this project is built. """ result = [] if not self.built_main_targets_: self.build_main_targets () # Collect all main targets here, except f...
def targets_to_build (self): """ Computes and returns a list of AbstractTarget instances which must be built when this project is built. """ result = [] if not self.built_main_targets_: self.build_main_targets () # Collect all main targets here, except f...
[ "Computes", "and", "returns", "a", "list", "of", "AbstractTarget", "instances", "which", "must", "be", "built", "when", "this", "project", "is", "built", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L450-L469
[ "def", "targets_to_build", "(", "self", ")", ":", "result", "=", "[", "]", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "# Collect all main targets here, except for \"explicit\" ones.", "for", "n", ",", "t", "i...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.mark_targets_as_explicit
Add 'target' to the list of targets in this project that should be build only by explicit request.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def mark_targets_as_explicit (self, target_names): """Add 'target' to the list of targets in this project that should be build only by explicit request.""" # Record the name of the target, not instance, since this # rule is called before main target instaces are created. assert ...
def mark_targets_as_explicit (self, target_names): """Add 'target' to the list of targets in this project that should be build only by explicit request.""" # Record the name of the target, not instance, since this # rule is called before main target instaces are created. assert ...
[ "Add", "target", "to", "the", "list", "of", "targets", "in", "this", "project", "that", "should", "be", "build", "only", "by", "explicit", "request", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L471-L478
[ "def", "mark_targets_as_explicit", "(", "self", ",", "target_names", ")", ":", "# Record the name of the target, not instance, since this", "# rule is called before main target instaces are created.", "assert", "is_iterable_typed", "(", "target_names", ",", "basestring", ")", "self...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.add_alternative
Add new target alternative.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def add_alternative (self, target_instance): """ Add new target alternative. """ assert isinstance(target_instance, AbstractTarget) if self.built_main_targets_: raise IllegalOperation ("add-alternative called when main targets are already created for project '%s'" % self.full...
def add_alternative (self, target_instance): """ Add new target alternative. """ assert isinstance(target_instance, AbstractTarget) if self.built_main_targets_: raise IllegalOperation ("add-alternative called when main targets are already created for project '%s'" % self.full...
[ "Add", "new", "target", "alternative", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L484-L491
[ "def", "add_alternative", "(", "self", ",", "target_instance", ")", ":", "assert", "isinstance", "(", "target_instance", ",", "AbstractTarget", ")", "if", "self", ".", "built_main_targets_", ":", "raise", "IllegalOperation", "(", "\"add-alternative called when main targ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.has_main_target
Tells if a main target with the specified name exists.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def has_main_target (self, name): """Tells if a main target with the specified name exists.""" assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets() return name in self.main_target_
def has_main_target (self, name): """Tells if a main target with the specified name exists.""" assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets() return name in self.main_target_
[ "Tells", "if", "a", "main", "target", "with", "the", "specified", "name", "exists", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L500-L506
[ "def", "has_main_target", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "return", "name", "in", "self", "....
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.create_main_target
Returns a 'MainTarget' class instance corresponding to the 'name'.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def create_main_target (self, name): """ Returns a 'MainTarget' class instance corresponding to the 'name'. """ assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets () return self.main_targets_.get (name, None)
def create_main_target (self, name): """ Returns a 'MainTarget' class instance corresponding to the 'name'. """ assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets () return self.main_targets_.get (name, None)
[ "Returns", "a", "MainTarget", "class", "instance", "corresponding", "to", "the", "name", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L508-L515
[ "def", "create_main_target", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "return", "self", ".", "main_targ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.find_really
Find and return the target with the specified id, treated relative to self.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def find_really(self, id): """ Find and return the target with the specified id, treated relative to self. """ assert isinstance(id, basestring) result = None current_location = self.get ('location') __re_split_project_target = re.compile (r'(.*)//(.*)') ...
def find_really(self, id): """ Find and return the target with the specified id, treated relative to self. """ assert isinstance(id, basestring) result = None current_location = self.get ('location') __re_split_project_target = re.compile (r'(.*)//(.*)') ...
[ "Find", "and", "return", "the", "target", "with", "the", "specified", "id", "treated", "relative", "to", "self", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L518-L588
[ "def", "find_really", "(", "self", ",", "id", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "result", "=", "None", "current_location", "=", "self", ".", "get", "(", "'location'", ")", "__re_split_project_target", "=", "re", ".", "com...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectTarget.add_constant
Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def add_constant(self, name, value, path=0): """Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project. """ assert ...
def add_constant(self, name, value, path=0): """Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project. """ assert ...
[ "Adds", "a", "new", "constant", "for", "this", "project", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L619-L646
[ "def", "add_constant", "(", "self", ",", "name", ",", "value", ",", "path", "=", "0", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "assert", "isinstance", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
MainTarget.add_alternative
Add a new alternative for this target.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def add_alternative (self, target): """ Add a new alternative for this target. """ assert isinstance(target, BasicTarget) d = target.default_build () if self.alternatives_ and self.default_build_ != d: get_manager().errors()("default build must be identical in all al...
def add_alternative (self, target): """ Add a new alternative for this target. """ assert isinstance(target, BasicTarget) d = target.default_build () if self.alternatives_ and self.default_build_ != d: get_manager().errors()("default build must be identical in all al...
[ "Add", "a", "new", "alternative", "for", "this", "target", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L676-L691
[ "def", "add_alternative", "(", "self", ",", "target", ")", ":", "assert", "isinstance", "(", "target", ",", "BasicTarget", ")", "d", "=", "target", ".", "default_build", "(", ")", "if", "self", ".", "alternatives_", "and", "self", ".", "default_build_", "!...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
MainTarget.__select_alternatives
Returns the best viable alternative for this property_set See the documentation for selection rules. # TODO: shouldn't this be 'alternative' (singular)?
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def __select_alternatives (self, property_set_, debug): """ Returns the best viable alternative for this property_set See the documentation for selection rules. # TODO: shouldn't this be 'alternative' (singular)? """ # When selecting alternatives we have to consider defau...
def __select_alternatives (self, property_set_, debug): """ Returns the best viable alternative for this property_set See the documentation for selection rules. # TODO: shouldn't this be 'alternative' (singular)? """ # When selecting alternatives we have to consider defau...
[ "Returns", "the", "best", "viable", "alternative", "for", "this", "property_set", "See", "the", "documentation", "for", "selection", "rules", ".", "#", "TODO", ":", "shouldn", "t", "this", "be", "alternative", "(", "singular", ")", "?" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L693-L746
[ "def", "__select_alternatives", "(", "self", ",", "property_set_", ",", "debug", ")", ":", "# When selecting alternatives we have to consider defaults,", "# for example:", "# lib l : l.cpp : <variant>debug ;", "# lib l : l_opt.cpp : <variant>release ;", "# won't work unless we add ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
MainTarget.generate
Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def generate (self, ps): """ Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative. """ ...
def generate (self, ps): """ Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative. """ ...
[ "Select", "an", "alternative", "for", "this", "main", "target", "by", "finding", "all", "alternatives", "which", "requirements", "are", "satisfied", "by", "properties", "and", "picking", "the", "one", "with", "longest", "requirements", "set", ".", "Returns", "th...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L752-L774
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "targets", "(", ")", ".", "start_building", "(", "self", ")", "# We want composite properties ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
MainTarget.__generate_really
Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible that no targets are generated.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def __generate_really (self, prop_set): """ Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible...
def __generate_really (self, prop_set): """ Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible...
[ "Generates", "the", "main", "target", "with", "the", "given", "property", "set", "and", "returns", "a", "list", "which", "first", "element", "is", "property_set", "object", "containing", "usage_requirements", "of", "generated", "target", "and", "with", "generated"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L776-L797
[ "def", "__generate_really", "(", "self", ",", "prop_set", ")", ":", "assert", "isinstance", "(", "prop_set", ",", "property_set", ".", "PropertySet", ")", "best_alternative", "=", "self", ".", "__select_alternatives", "(", "prop_set", ",", "debug", "=", "0", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BasicTarget.sources
Returns the list of AbstractTargets which are used as sources. The extra properties specified for sources are not represented. The only used of this rule at the moment is the '--dump-tests' feature of the test system.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def sources (self): """ Returns the list of AbstractTargets which are used as sources. The extra properties specified for sources are not represented. The only used of this rule at the moment is the '--dump-tests' feature of the test system. """ if self.source...
def sources (self): """ Returns the list of AbstractTargets which are used as sources. The extra properties specified for sources are not represented. The only used of this rule at the moment is the '--dump-tests' feature of the test system. """ if self.source...
[ "Returns", "the", "list", "of", "AbstractTargets", "which", "are", "used", "as", "sources", ".", "The", "extra", "properties", "specified", "for", "sources", "are", "not", "represented", ".", "The", "only", "used", "of", "this", "rule", "at", "the", "moment"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L939-L950
[ "def", "sources", "(", "self", ")", ":", "if", "self", ".", "source_targets_", "==", "None", ":", "self", ".", "source_targets_", "=", "[", "]", "for", "s", "in", "self", ".", "sources_", ":", "self", ".", "source_targets_", ".", "append", "(", "resolv...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BasicTarget.common_properties
Given build request and requirements, return properties common to dependency build request and target build properties.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def common_properties (self, build_request, requirements): """ Given build request and requirements, return properties common to dependency build request and target build properties. """ # For optimization, we add free unconditional requirements directly, # withou...
def common_properties (self, build_request, requirements): """ Given build request and requirements, return properties common to dependency build request and target build properties. """ # For optimization, we add free unconditional requirements directly, # withou...
[ "Given", "build", "request", "and", "requirements", "return", "properties", "common", "to", "dependency", "build", "request", "and", "target", "build", "properties", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L958-L982
[ "def", "common_properties", "(", "self", ",", "build_request", ",", "requirements", ")", ":", "# For optimization, we add free unconditional requirements directly,", "# without using complex algorithsm.", "# This gives the complex algorithm better chance of caching results.", "# The exact ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BasicTarget.match
Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def match (self, property_set_, debug): """ Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'. """ # The condition is composed of all base non-conditional properties. # It's not clear if we should expand 'self.requirements...
def match (self, property_set_, debug): """ Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'. """ # The condition is composed of all base non-conditional properties. # It's not clear if we should expand 'self.requirements...
[ "Returns", "the", "alternative", "condition", "for", "this", "alternative", "if", "the", "condition", "is", "satisfied", "by", "property_set", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1103-L1131
[ "def", "match", "(", "self", ",", "property_set_", ",", "debug", ")", ":", "# The condition is composed of all base non-conditional properties.", "# It's not clear if we should expand 'self.requirements_' or not.", "# For one thing, it would be nice to be able to put", "# <toolset>msvc-...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BasicTarget.generate_dependency_properties
Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements).
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def generate_dependency_properties(self, properties, ps): """ Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements). """ ...
def generate_dependency_properties(self, properties, ps): """ Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements). """ ...
[ "Takes", "a", "target", "reference", "which", "might", "be", "either", "target", "id", "or", "a", "dependency", "property", "and", "generates", "that", "target", "using", "property_set", "as", "build", "request", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1147-L1167
[ "def", "generate_dependency_properties", "(", "self", ",", "properties", ",", "ps", ")", ":", "assert", "is_iterable_typed", "(", "properties", ",", "property", ".", "Property", ")", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BasicTarget.generate
Determines final build properties, generates sources, and calls 'construct'. This method should not be overridden.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def generate (self, ps): """ Determines final build properties, generates sources, and calls 'construct'. This method should not be overridden. """ assert isinstance(ps, property_set.PropertySet) self.manager_.errors().push_user_context( "Generating target " +...
def generate (self, ps): """ Determines final build properties, generates sources, and calls 'construct'. This method should not be overridden. """ assert isinstance(ps, property_set.PropertySet) self.manager_.errors().push_user_context( "Generating target " +...
[ "Determines", "final", "build", "properties", "generates", "sources", "and", "calls", "construct", ".", "This", "method", "should", "not", "be", "overridden", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1173-L1294
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "errors", "(", ")", ".", "push_user_context", "(", "\"Generating target \"", "+", "self", "....
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BasicTarget.compute_usage_requirements
Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets.
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def compute_usage_requirements (self, subvariant): """ Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets. """ assert isinstance(subvariant, virtual_target.Subvariant) rproperties =...
def compute_usage_requirements (self, subvariant): """ Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets. """ assert isinstance(subvariant, virtual_target.Subvariant) rproperties =...
[ "Given", "the", "set", "of", "generated", "targets", "and", "refined", "build", "properties", "determines", "and", "sets", "appripriate", "usage", "requirements", "on", "those", "targets", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1296-L1342
[ "def", "compute_usage_requirements", "(", "self", ",", "subvariant", ")", ":", "assert", "isinstance", "(", "subvariant", ",", "virtual_target", ".", "Subvariant", ")", "rproperties", "=", "subvariant", ".", "build_properties", "(", ")", "xusage_requirements", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BasicTarget.create_subvariant
Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - 'all-targets' all virtual targets created while building this main target - 'build-request' is property-set instance with requested build properties
deps/src/boost_1_68_0/tools/build/src/build/targets.py
def create_subvariant (self, root_targets, all_targets, build_request, sources, rproperties, usage_requirements): """Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - '...
def create_subvariant (self, root_targets, all_targets, build_request, sources, rproperties, usage_requirements): """Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - '...
[ "Creates", "a", "new", "subvariant", "-", "dg", "instances", "for", "targets", "-", "root", "-", "targets", "the", "virtual", "targets", "will", "be", "returned", "to", "dependents", "-", "all", "-", "targets", "all", "virtual", "targets", "created", "while"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1344-L1370
[ "def", "create_subvariant", "(", "self", ",", "root_targets", ",", "all_targets", ",", "build_request", ",", "sources", ",", "rproperties", ",", "usage_requirements", ")", ":", "assert", "is_iterable_typed", "(", "root_targets", ",", "virtual_target", ".", "VirtualT...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
variant
Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this variant is used as parent. Second, determines the full property set for ...
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
def variant (name, parents_or_properties, explicit_properties = []): """ Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this vari...
def variant (name, parents_or_properties, explicit_properties = []): """ Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this vari...
[ "Declares", "a", "new", "variant", ".", "First", "determines", "explicit", "properties", "for", "this", "variant", "by", "refining", "parents", "explicit", "properties", "with", "the", "passed", "explicit", "properties", ".", "The", "result", "is", "remembered", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L33-L82
[ "def", "variant", "(", "name", ",", "parents_or_properties", ",", "explicit_properties", "=", "[", "]", ")", ":", "parents", "=", "[", "]", "if", "not", "explicit_properties", ":", "explicit_properties", "=", "parents_or_properties", "else", ":", "parents", "=",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
register_globals
Registers all features and variants declared by this module.
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
def register_globals (): """ Registers all features and variants declared by this module. """ # This feature is used to determine which OS we're on. # In future, this may become <target-os> and <host-os> # TODO: check this. Compatibility with bjam names? Subfeature for version? os = sys.platfor...
def register_globals (): """ Registers all features and variants declared by this module. """ # This feature is used to determine which OS we're on. # In future, this may become <target-os> and <host-os> # TODO: check this. Compatibility with bjam names? Subfeature for version? os = sys.platfor...
[ "Registers", "all", "features", "and", "variants", "declared", "by", "this", "module", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L110-L330
[ "def", "register_globals", "(", ")", ":", "# This feature is used to determine which OS we're on.", "# In future, this may become <target-os> and <host-os>", "# TODO: check this. Compatibility with bjam names? Subfeature for version?", "os", "=", "sys", ".", "platform", "feature", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
lib
The implementation of the 'lib' rule. Beyond standard syntax that rule allows simplified: 'lib a b c ;'.
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]): """The implementation of the 'lib' rule. Beyond standard syntax that rule allows simplified: 'lib a b c ;'.""" assert is_iterable_typed(names, basestring) assert is_iterable_typed(sources, basestring) assert is_ite...
def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]): """The implementation of the 'lib' rule. Beyond standard syntax that rule allows simplified: 'lib a b c ;'.""" assert is_iterable_typed(names, basestring) assert is_iterable_typed(sources, basestring) assert is_ite...
[ "The", "implementation", "of", "the", "lib", "rule", ".", "Beyond", "standard", "syntax", "that", "rule", "allows", "simplified", ":", "lib", "a", "b", "c", ";", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L475-L507
[ "def", "lib", "(", "names", ",", "sources", "=", "[", "]", ",", "requirements", "=", "[", "]", ",", "default_build", "=", "[", "]", ",", "usage_requirements", "=", "[", "]", ")", ":", "assert", "is_iterable_typed", "(", "names", ",", "basestring", ")",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
CompileAction.adjust_properties
For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path.
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
def adjust_properties (self, prop_set): """ For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path. """ assert isinstance(prop_set, property_set.PropertySet) s = self.targets ...
def adjust_properties (self, prop_set): """ For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path. """ assert isinstance(prop_set, property_set.PropertySet) s = self.targets ...
[ "For", "all", "virtual", "targets", "for", "the", "same", "dependency", "graph", "as", "self", "i", ".", "e", ".", "which", "belong", "to", "the", "same", "main", "target", "add", "their", "directories", "to", "include", "path", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L581-L589
[ "def", "adjust_properties", "(", "self", ",", "prop_set", ")", ":", "assert", "isinstance", "(", "prop_set", ",", "property_set", ".", "PropertySet", ")", "s", "=", "self", ".", "targets", "(", ")", "[", "0", "]", ".", "creating_subvariant", "(", ")", "r...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is determined by the number of observations involving each item. When a target is provided, popularity is computed using the item's mean target value. When the target column contains rating...
src/unity/python/turicreate/toolkits/recommender/popularity_recommender.py
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, random_seed=0, verbose=True): """ Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is ...
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, random_seed=0, verbose=True): """ Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is ...
[ "Create", "a", "model", "that", "makes", "recommendations", "using", "item", "popularity", ".", "When", "no", "target", "column", "is", "provided", "the", "popularity", "is", "determined", "by", "the", "number", "of", "observations", "involving", "each", "item",...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/popularity_recommender.py#L15-L102
[ "def", "create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "random_seed", "=", "0", ",", "verbose", "=", "Tr...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
XGBModel.get_params
Get parameter.s
src/external/xgboost/python-package/xgboost/sklearn.py
def get_params(self, deep=False): """Get parameter.s""" params = super(XGBModel, self).get_params(deep=deep) if params['missing'] is np.nan: params['missing'] = None # sklearn doesn't handle nan. see #4725 if not params.get('eval_metric', True): del params['eval_...
def get_params(self, deep=False): """Get parameter.s""" params = super(XGBModel, self).get_params(deep=deep) if params['missing'] is np.nan: params['missing'] = None # sklearn doesn't handle nan. see #4725 if not params.get('eval_metric', True): del params['eval_...
[ "Get", "parameter", ".", "s" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L126-L133
[ "def", "get_params", "(", "self", ",", "deep", "=", "False", ")", ":", "params", "=", "super", "(", "XGBModel", ",", "self", ")", ".", "get_params", "(", "deep", "=", "deep", ")", "if", "params", "[", "'missing'", "]", "is", "np", ".", "nan", ":", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
XGBModel.get_xgb_params
Get xgboost type parameters.
src/external/xgboost/python-package/xgboost/sklearn.py
def get_xgb_params(self): """Get xgboost type parameters.""" xgb_params = self.get_params() xgb_params['silent'] = 1 if self.silent else 0 if self.nthread <= 0: xgb_params.pop('nthread', None) return xgb_params
def get_xgb_params(self): """Get xgboost type parameters.""" xgb_params = self.get_params() xgb_params['silent'] = 1 if self.silent else 0 if self.nthread <= 0: xgb_params.pop('nthread', None) return xgb_params
[ "Get", "xgboost", "type", "parameters", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L135-L143
[ "def", "get_xgb_params", "(", "self", ")", ":", "xgb_params", "=", "self", ".", "get_params", "(", ")", "xgb_params", "[", "'silent'", "]", "=", "1", "if", "self", ".", "silent", "else", "0", "if", "self", ".", "nthread", "<=", "0", ":", "xgb_params", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
XGBModel.fit
Fit the gradient boosting model Parameters ---------- X : array_like Feature matrix y : array_like Labels eval_set : list, optional A list of (X, y) tuple pairs to use as a validation set for early-stopping eval_metric : st...
src/external/xgboost/python-package/xgboost/sklearn.py
def fit(self, X, y, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable=missing-docstring,invalid-name,attribute-defined-outside-init """ Fit the gradient boosting model Parameters ---------- X : array_like ...
def fit(self, X, y, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable=missing-docstring,invalid-name,attribute-defined-outside-init """ Fit the gradient boosting model Parameters ---------- X : array_like ...
[ "Fit", "the", "gradient", "boosting", "model" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L145-L213
[ "def", "fit", "(", "self", ",", "X", ",", "y", ",", "eval_set", "=", "None", ",", "eval_metric", "=", "None", ",", "early_stopping_rounds", "=", "None", ",", "verbose", "=", "True", ")", ":", "# pylint: disable=missing-docstring,invalid-name,attribute-defined-outs...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
XGBClassifier.fit
Fit gradient boosting classifier Parameters ---------- X : array_like Feature matrix y : array_like Labels sample_weight : array_like Weight for each instance eval_set : list, optional A list of (X, y) pairs to use as a val...
src/external/xgboost/python-package/xgboost/sklearn.py
def fit(self, X, y, sample_weight=None, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable = attribute-defined-outside-init,arguments-differ """ Fit gradient boosting classifier Parameters ---------- X : array_like ...
def fit(self, X, y, sample_weight=None, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable = attribute-defined-outside-init,arguments-differ """ Fit gradient boosting classifier Parameters ---------- X : array_like ...
[ "Fit", "gradient", "boosting", "classifier" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L280-L369
[ "def", "fit", "(", "self", ",", "X", ",", "y", ",", "sample_weight", "=", "None", ",", "eval_set", "=", "None", ",", "eval_metric", "=", "None", ",", "early_stopping_rounds", "=", "None", ",", "verbose", "=", "True", ")", ":", "# pylint: disable = attribut...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
add_grist
Transform a string by bracketing it with "<>". If already bracketed, does nothing. features: one string or a sequence of strings return: the gristed string, if features is a string, or a sequence of gristed strings, if features is a sequence
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def add_grist (features): """ Transform a string by bracketing it with "<>". If already bracketed, does nothing. features: one string or a sequence of strings return: the gristed string, if features is a string, or a sequence of gristed strings, if features is a sequence """ assert is_iterab...
def add_grist (features): """ Transform a string by bracketing it with "<>". If already bracketed, does nothing. features: one string or a sequence of strings return: the gristed string, if features is a string, or a sequence of gristed strings, if features is a sequence """ assert is_iterab...
[ "Transform", "a", "string", "by", "bracketing", "it", "with", "<", ">", ".", "If", "already", "bracketed", "does", "nothing", ".", "features", ":", "one", "string", "or", "a", "sequence", "of", "strings", "return", ":", "the", "gristed", "string", "if", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L39-L54
[ "def", "add_grist", "(", "features", ")", ":", "assert", "is_iterable_typed", "(", "features", ",", "basestring", ")", "or", "isinstance", "(", "features", ",", "basestring", ")", "def", "grist_one", "(", "feature", ")", ":", "if", "feature", "[", "0", "]"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
replace_grist
Replaces the grist of a string by a new one. Returns the string with the new grist.
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def replace_grist (features, new_grist): """ Replaces the grist of a string by a new one. Returns the string with the new grist. """ assert is_iterable_typed(features, basestring) or isinstance(features, basestring) assert isinstance(new_grist, basestring) # this function is used a lot in th...
def replace_grist (features, new_grist): """ Replaces the grist of a string by a new one. Returns the string with the new grist. """ assert is_iterable_typed(features, basestring) or isinstance(features, basestring) assert isinstance(new_grist, basestring) # this function is used a lot in th...
[ "Replaces", "the", "grist", "of", "a", "string", "by", "a", "new", "one", ".", "Returns", "the", "string", "with", "the", "new", "grist", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L56-L83
[ "def", "replace_grist", "(", "features", ",", "new_grist", ")", ":", "assert", "is_iterable_typed", "(", "features", ",", "basestring", ")", "or", "isinstance", "(", "features", ",", "basestring", ")", "assert", "isinstance", "(", "new_grist", ",", "basestring",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
get_value
Gets the value of a property, that is, the part following the grist, if any.
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def get_value (property): """ Gets the value of a property, that is, the part following the grist, if any. """ assert is_iterable_typed(property, basestring) or isinstance(property, basestring) return replace_grist (property, '')
def get_value (property): """ Gets the value of a property, that is, the part following the grist, if any. """ assert is_iterable_typed(property, basestring) or isinstance(property, basestring) return replace_grist (property, '')
[ "Gets", "the", "value", "of", "a", "property", "that", "is", "the", "part", "following", "the", "grist", "if", "any", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L85-L89
[ "def", "get_value", "(", "property", ")", ":", "assert", "is_iterable_typed", "(", "property", ",", "basestring", ")", "or", "isinstance", "(", "property", ",", "basestring", ")", "return", "replace_grist", "(", "property", ",", "''", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
get_grist
Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence.
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def get_grist (value): """ Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def get_grist_one (name): split = __re_grist_and_value.match (n...
def get_grist (value): """ Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def get_grist_one (name): split = __re_grist_and_value.match (n...
[ "Returns", "the", "grist", "of", "a", "string", ".", "If", "value", "is", "a", "sequence", "does", "it", "for", "every", "value", "and", "returns", "the", "result", "as", "a", "sequence", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L91-L106
[ "def", "get_grist", "(", "value", ")", ":", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "or", "isinstance", "(", "value", ",", "basestring", ")", "def", "get_grist_one", "(", "name", ")", ":", "split", "=", "__re_grist_and_value", "....
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ungrist
Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence.
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def ungrist (value): """ Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def ungrist_one (value): stripped = __re_grist_content.match (v...
def ungrist (value): """ Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def ungrist_one (value): stripped = __re_grist_content.match (v...
[ "Returns", "the", "value", "without", "grist", ".", "If", "value", "is", "a", "sequence", "does", "it", "for", "every", "value", "and", "returns", "the", "result", "as", "a", "sequence", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L108-L123
[ "def", "ungrist", "(", "value", ")", ":", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "or", "isinstance", "(", "value", ",", "basestring", ")", "def", "ungrist_one", "(", "value", ")", ":", "stripped", "=", "__re_grist_content", ".",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
replace_suffix
Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added.
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def replace_suffix (name, new_suffix): """ Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added. """ assert isinstance(name, basestring) assert isinstance(new_suffix, basestring) split = os.path.splitext (name) return split [0] + new_suffix
def replace_suffix (name, new_suffix): """ Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added. """ assert isinstance(name, basestring) assert isinstance(new_suffix, basestring) split = os.path.splitext (name) return split [0] + new_suffix
[ "Replaces", "the", "suffix", "of", "name", "by", "new_suffix", ".", "If", "no", "suffix", "exists", "the", "new", "one", "is", "added", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L125-L132
[ "def", "replace_suffix", "(", "name", ",", "new_suffix", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "isinstance", "(", "new_suffix", ",", "basestring", ")", "split", "=", "os", ".", "path", ".", "splitext", "(", "name"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
split_action_id
Splits an id in the toolset and specific rule parts. E.g. 'gcc.compile.c++' returns ('gcc', 'compile.c++')
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def split_action_id (id): """ Splits an id in the toolset and specific rule parts. E.g. 'gcc.compile.c++' returns ('gcc', 'compile.c++') """ assert isinstance(id, basestring) split = id.split ('.', 1) toolset = split [0] name = '' if len (split) > 1: name = split [1] retu...
def split_action_id (id): """ Splits an id in the toolset and specific rule parts. E.g. 'gcc.compile.c++' returns ('gcc', 'compile.c++') """ assert isinstance(id, basestring) split = id.split ('.', 1) toolset = split [0] name = '' if len (split) > 1: name = split [1] retu...
[ "Splits", "an", "id", "in", "the", "toolset", "and", "specific", "rule", "parts", ".", "E", ".", "g", ".", "gcc", ".", "compile", ".", "c", "++", "returns", "(", "gcc", "compile", ".", "c", "++", ")" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L141-L151
[ "def", "split_action_id", "(", "id", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "split", "=", "id", ".", "split", "(", "'.'", ",", "1", ")", "toolset", "=", "split", "[", "0", "]", "name", "=", "''", "if", "len", "(", "s...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
on_windows
Returns true if running on windows, whether in cygwin or not.
deps/src/boost_1_68_0/tools/build/src/util/utility.py
def on_windows (): """ Returns true if running on windows, whether in cygwin or not. """ if bjam.variable("NT"): return True elif bjam.variable("UNIX"): uname = bjam.variable("JAMUNAME") if uname and uname[0].startswith("CYGWIN"): return True return False
def on_windows (): """ Returns true if running on windows, whether in cygwin or not. """ if bjam.variable("NT"): return True elif bjam.variable("UNIX"): uname = bjam.variable("JAMUNAME") if uname and uname[0].startswith("CYGWIN"): return True return False
[ "Returns", "true", "if", "running", "on", "windows", "whether", "in", "cygwin", "or", "not", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L164-L176
[ "def", "on_windows", "(", ")", ":", "if", "bjam", ".", "variable", "(", "\"NT\"", ")", ":", "return", "True", "elif", "bjam", ".", "variable", "(", "\"UNIX\"", ")", ":", "uname", "=", "bjam", ".", "variable", "(", "\"JAMUNAME\"", ")", "if", "uname", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_validate_dataset
Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset.
src/unity/python/turicreate/toolkits/clustering/kmeans.py
def _validate_dataset(dataset): """ Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset. """ if not (isinstance(dataset, _SFrame)): raise TypeError("Input 'dataset' must be an SFrame.") if dataset.num_rows() == 0 or dataset.num_columns(...
def _validate_dataset(dataset): """ Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset. """ if not (isinstance(dataset, _SFrame)): raise TypeError("Input 'dataset' must be an SFrame.") if dataset.num_rows() == 0 or dataset.num_columns(...
[ "Validate", "the", "main", "Kmeans", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L25-L38
[ "def", "_validate_dataset", "(", "dataset", ")", ":", "if", "not", "(", "isinstance", "(", "dataset", ",", "_SFrame", ")", ")", ":", "raise", "TypeError", "(", "\"Input 'dataset' must be an SFrame.\"", ")", "if", "dataset", ".", "num_rows", "(", ")", "==", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_validate_initial_centers
Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form.
src/unity/python/turicreate/toolkits/clustering/kmeans.py
def _validate_initial_centers(initial_centers): """ Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form. """ if not (isinstance(initial_centers, _SFrame)): raise TypeError("Input 'initial_centers' must...
def _validate_initial_centers(initial_centers): """ Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form. """ if not (isinstance(initial_centers, _SFrame)): raise TypeError("Input 'initial_centers' must...
[ "Validate", "the", "initial", "centers", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L41-L55
[ "def", "_validate_initial_centers", "(", "initial_centers", ")", ":", "if", "not", "(", "isinstance", "(", "initial_centers", ",", "_SFrame", ")", ")", ":", "raise", "TypeError", "(", "\"Input 'initial_centers' must be an SFrame.\"", ")", "if", "initial_centers", ".",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_validate_num_clusters
Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- num_clusters : int Specified number of clusters. initial_centers ...
src/unity/python/turicreate/toolkits/clustering/kmeans.py
def _validate_num_clusters(num_clusters, initial_centers, num_rows): """ Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- ...
def _validate_num_clusters(num_clusters, initial_centers, num_rows): """ Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- ...
[ "Validate", "the", "combination", "of", "the", "num_clusters", "and", "initial_centers", "parameters", "in", "the", "Kmeans", "model", "create", "function", ".", "If", "the", "combination", "is", "valid", "determine", "and", "return", "the", "correct", "number", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L58-L115
[ "def", "_validate_num_clusters", "(", "num_clusters", ",", "initial_centers", ",", "num_rows", ")", ":", "## Basic validation", "if", "num_clusters", "is", "not", "None", "and", "not", "isinstance", "(", "num_clusters", ",", "int", ")", ":", "raise", "_ToolkitErro...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_validate_features
Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column_type_map : dict[str, type] Dictionary mapping each column name to the type...
src/unity/python/turicreate/toolkits/clustering/kmeans.py
def _validate_features(features, column_type_map, valid_types, label): """ Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column...
def _validate_features(features, column_type_map, valid_types, label): """ Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column...
[ "Identify", "the", "subset", "of", "desired", "features", "that", "are", "valid", "for", "the", "Kmeans", "model", ".", "A", "warning", "is", "emitted", "for", "each", "feature", "that", "is", "excluded", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L118-L186
[ "def", "_validate_features", "(", "features", ",", "column_type_map", ",", "valid_types", ",", "label", ")", ":", "if", "not", "isinstance", "(", "features", ",", "list", ")", ":", "raise", "TypeError", "(", "\"Input 'features' must be a list, if specified.\"", ")",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in the input 'dataset'. Given a number of clusters, k-means iteratively chooses the best cluster centers and assigns nearby points to the best cluster. If no poin...
src/unity/python/turicreate/toolkits/clustering/kmeans.py
def create(dataset, num_clusters=None, features=None, label=None, initial_centers=None, max_iterations=10, batch_size=None, verbose=True): """ Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in...
def create(dataset, num_clusters=None, features=None, label=None, initial_centers=None, max_iterations=10, batch_size=None, verbose=True): """ Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in...
[ "Create", "a", "k", "-", "means", "clustering", "model", ".", "The", "KmeansModel", "object", "contains", "the", "computed", "cluster", "centers", "and", "the", "cluster", "assignment", "for", "each", "instance", "in", "the", "input", "dataset", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L410-L602
[ "def", "create", "(", "dataset", ",", "num_clusters", "=", "None", ",", "features", "=", "None", ",", "label", "=", "None", ",", "initial_centers", "=", "None", ",", "max_iterations", "=", "10", ",", "batch_size", "=", "None", ",", "verbose", "=", "True"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
KmeansModel.predict
Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : SFrame Dataset of new observations. Must include the features used for ...
src/unity/python/turicreate/toolkits/clustering/kmeans.py
def predict(self, dataset, output_type='cluster_id', verbose=True): """ Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : S...
def predict(self, dataset, output_type='cluster_id', verbose=True): """ Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : S...
[ "Return", "predicted", "cluster", "label", "for", "instances", "in", "the", "new", "dataset", ".", "K", "-", "means", "predictions", "are", "made", "by", "assigning", "each", "new", "instance", "to", "the", "closest", "cluster", "center", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L208-L287
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'cluster_id'", ",", "verbose", "=", "True", ")", ":", "## Validate the input dataset.", "_tkutl", ".", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"dataset\"", ")", "_tkutl", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
KmeansModel._get
Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================+ | batch_size | Number ...
src/unity/python/turicreate/toolkits/clustering/kmeans.py
def _get(self, field): """ Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================...
def _get(self, field): """ Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================...
[ "Return", "the", "value", "of", "a", "given", "field", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L289-L345
[ "def", "_get", "(", "self", ",", "field", ")", ":", "opts", "=", "{", "'model'", ":", "self", ".", "__proxy__", ",", "'model_name'", ":", "self", ".", "__name__", ",", "'field'", ":", "field", "}", "response", "=", "_tc", ".", "extensions", ".", "_km...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
count_words
If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. Counts for the same word, in the same row, are added together. This outpu...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def count_words(text, to_lower=True, delimiters=DEFAULT_DELIMITERS): """ If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. C...
def count_words(text, to_lower=True, delimiters=DEFAULT_DELIMITERS): """ If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. C...
[ "If", "text", "is", "an", "SArray", "of", "strings", "or", "an", "SArray", "of", "lists", "of", "strings", "the", "occurances", "of", "word", "are", "counted", "for", "each", "row", "in", "the", "SArray", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L24-L117
[ "def", "count_words", "(", "text", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute word counts", "sf", "=", "_turicreate", ".", "SFrame", "(", "{",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
count_ngrams
Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element. The n-grams can be specified to be either character n-grams or word n-grams. The input SArray could contain strings, dicts with string keys and numeric values,...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def count_ngrams(text, n=2, method="word", to_lower=True, delimiters=DEFAULT_DELIMITERS, ignore_punct=True, ignore_space=True): """ Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element...
def count_ngrams(text, n=2, method="word", to_lower=True, delimiters=DEFAULT_DELIMITERS, ignore_punct=True, ignore_space=True): """ Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element...
[ "Return", "an", "SArray", "of", "dict", "type", "where", "each", "element", "contains", "the", "count", "for", "each", "of", "the", "n", "-", "grams", "that", "appear", "in", "the", "corresponding", "input", "element", ".", "The", "n", "-", "grams", "can...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L119-L243
[ "def", "count_ngrams", "(", "text", ",", "n", "=", "2", ",", "method", "=", "\"word\"", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ",", "ignore_punct", "=", "True", ",", "ignore_space", "=", "True", ")", ":", "_raise_error_...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
tf_idf
Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`d`, :math:`f(w)` is the number...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def tf_idf(text): """ Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`...
def tf_idf(text): """ Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`...
[ "Compute", "the", "TF", "-", "IDF", "scores", "for", "each", "word", "in", "each", "document", ".", "The", "collection", "of", "documents", "must", "be", "in", "bag", "-", "of", "-", "words", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L246-L295
[ "def", "tf_idf", "(", "text", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "if", "len", "(", "text", ")", "==", "0", ":", "return", "_turicreate", ".", "SArray", "(", ")", "dataset", "=", "_turicreate", ".", "SFrame", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
drop_words
Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the models learned on the transformed data. RareWordTrimmer can be applied to all the string-, dictionary-, and list-typed ...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def drop_words(text, threshold=2, to_lower=True, delimiters=DEFAULT_DELIMITERS, stop_words=None): ''' Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the mo...
def drop_words(text, threshold=2, to_lower=True, delimiters=DEFAULT_DELIMITERS, stop_words=None): ''' Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the mo...
[ "Remove", "words", "that", "occur", "below", "a", "certain", "number", "of", "times", "in", "an", "SArray", ".", "This", "is", "a", "common", "method", "of", "cleaning", "text", "before", "it", "is", "used", "and", "can", "increase", "the", "quality", "a...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L298-L410
[ "def", "drop_words", "(", "text", ",", "threshold", "=", "2", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ",", "stop_words", "=", "None", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute wor...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
tokenize
Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HTML, or other structured text formats. to_lower : bool, optional If...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def tokenize(text, to_lower=False, delimiters=DEFAULT_DELIMITERS): """ Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HT...
def tokenize(text, to_lower=False, delimiters=DEFAULT_DELIMITERS): """ Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HT...
[ "Tokenize", "the", "input", "SArray", "of", "text", "strings", "and", "return", "the", "list", "of", "tokens", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L412-L478
[ "def", "tokenize", "(", "text", ",", "to_lower", "=", "False", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute word counts", "sf", "=", "_turicreate", ".", "SFrame", "(", "{", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
bm25
For a given query and set of documents, compute the BM25 score for each document. If we have a query with words q_1, ..., q_n the BM25 score for a document is: .. math:: \sum_{i=1}^N IDF(q_i)\\frac{f(q_i) * (k_1+1)}{f(q_i) + k_1 * (1-b+b*|D|/d_avg))} where * :math:`\mbox{IDF}(q_i) = log((N - ...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def bm25(dataset, query, k1=1.5, b=.75): """ For a given query and set of documents, compute the BM25 score for each document. If we have a query with words q_1, ..., q_n the BM25 score for a document is: .. math:: \sum_{i=1}^N IDF(q_i)\\frac{f(q_i) * (k_1+1)}{f(q_i) + k_1 * (1-b+b*|D|/d_avg))}...
def bm25(dataset, query, k1=1.5, b=.75): """ For a given query and set of documents, compute the BM25 score for each document. If we have a query with words q_1, ..., q_n the BM25 score for a document is: .. math:: \sum_{i=1}^N IDF(q_i)\\frac{f(q_i) * (k_1+1)}{f(q_i) + k_1 * (1-b+b*|D|/d_avg))}...
[ "For", "a", "given", "query", "and", "set", "of", "documents", "compute", "the", "BM25", "score", "for", "each", "document", ".", "If", "we", "have", "a", "query", "with", "words", "q_1", "...", "q_n", "the", "BM25", "score", "for", "a", "document", "i...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L480-L590
[ "def", "bm25", "(", "dataset", ",", "query", ",", "k1", "=", "1.5", ",", "b", "=", ".75", ")", ":", "if", "type", "(", "dataset", ")", "!=", "_turicreate", ".", "SArray", ":", "raise", "TypeError", "(", "'bm25 requires an SArray of dict, list, or str type'",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
parse_sparse
Parse a file that's in libSVM format. In libSVM format each line of the text file represents a document in bag of words format: num_unique_words_in_doc word_id:count another_id:count The word_ids have 0-based indexing, i.e. 0 corresponds to the first word in the vocab filename. Parameters ---...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def parse_sparse(filename, vocab_filename): """ Parse a file that's in libSVM format. In libSVM format each line of the text file represents a document in bag of words format: num_unique_words_in_doc word_id:count another_id:count The word_ids have 0-based indexing, i.e. 0 corresponds to the first...
def parse_sparse(filename, vocab_filename): """ Parse a file that's in libSVM format. In libSVM format each line of the text file represents a document in bag of words format: num_unique_words_in_doc word_id:count another_id:count The word_ids have 0-based indexing, i.e. 0 corresponds to the first...
[ "Parse", "a", "file", "that", "s", "in", "libSVM", "format", ".", "In", "libSVM", "format", "each", "line", "of", "the", "text", "file", "represents", "a", "document", "in", "bag", "of", "words", "format", ":" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L593-L662
[ "def", "parse_sparse", "(", "filename", ",", "vocab_filename", ")", ":", "vocab", "=", "_turicreate", ".", "SFrame", ".", "read_csv", "(", "vocab_filename", ",", "header", "=", "None", ")", "[", "'X1'", "]", "vocab", "=", "list", "(", "vocab", ")", "docs...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
parse_docword
Parse a file that's in "docword" format. This consists of a 3-line header comprised of the document count, the vocabulary count, and the number of tokens, i.e. unique (doc_id, word_id) pairs. After the header, each line contains a space-separated triple of (doc_id, word_id, frequency), where frequency i...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def parse_docword(filename, vocab_filename): """ Parse a file that's in "docword" format. This consists of a 3-line header comprised of the document count, the vocabulary count, and the number of tokens, i.e. unique (doc_id, word_id) pairs. After the header, each line contains a space-separated trip...
def parse_docword(filename, vocab_filename): """ Parse a file that's in "docword" format. This consists of a 3-line header comprised of the document count, the vocabulary count, and the number of tokens, i.e. unique (doc_id, word_id) pairs. After the header, each line contains a space-separated trip...
[ "Parse", "a", "file", "that", "s", "in", "docword", "format", ".", "This", "consists", "of", "a", "3", "-", "line", "header", "comprised", "of", "the", "document", "count", "the", "vocabulary", "count", "and", "the", "number", "of", "tokens", "i", ".", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L665-L716
[ "def", "parse_docword", "(", "filename", ",", "vocab_filename", ")", ":", "vocab", "=", "_turicreate", ".", "SFrame", ".", "read_csv", "(", "vocab_filename", ",", "header", "=", "None", ")", "[", "'X1'", "]", "vocab", "=", "list", "(", "vocab", ")", "sf"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
random_split
Utility for performing a random split for text data that is already in bag-of-words format. For each (word, count) pair in a particular element, the counts are uniformly partitioned in either a training set or a test set. Parameters ---------- dataset : SArray of type dict, SFrame with columns ...
src/unity/python/turicreate/toolkits/text_analytics/_util.py
def random_split(dataset, prob=.5): """ Utility for performing a random split for text data that is already in bag-of-words format. For each (word, count) pair in a particular element, the counts are uniformly partitioned in either a training set or a test set. Parameters ---------- dat...
def random_split(dataset, prob=.5): """ Utility for performing a random split for text data that is already in bag-of-words format. For each (word, count) pair in a particular element, the counts are uniformly partitioned in either a training set or a test set. Parameters ---------- dat...
[ "Utility", "for", "performing", "a", "random", "split", "for", "text", "data", "that", "is", "already", "in", "bag", "-", "of", "-", "words", "format", ".", "For", "each", "(", "word", "count", ")", "pair", "in", "a", "particular", "element", "the", "c...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L719-L778
[ "def", "random_split", "(", "dataset", ",", "prob", "=", ".5", ")", ":", "def", "grab_values", "(", "x", ",", "train", "=", "True", ")", ":", "if", "train", ":", "ix", "=", "0", "else", ":", "ix", "=", "1", "return", "dict", "(", "[", "(", "key...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
train
Train a booster with given parameters. Parameters ---------- params : dict Booster params. dtrain : DMatrix Data to be trained. num_boost_round: int Number of boosting iterations. watchlist (evals): list of pairs (DMatrix, string) List of items to be evaluated du...
src/external/xgboost/python-package/xgboost/training.py
def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, maximize=False, early_stopping_rounds=None, evals_result=None, verbose_eval=True, learning_rates=None, xgb_model=None): # pylint: disable=too-many-statements,too-many-branches, attribute-defined-outside-init """Tra...
def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, maximize=False, early_stopping_rounds=None, evals_result=None, verbose_eval=True, learning_rates=None, xgb_model=None): # pylint: disable=too-many-statements,too-many-branches, attribute-defined-outside-init """Tra...
[ "Train", "a", "booster", "with", "given", "parameters", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L12-L192
[ "def", "train", "(", "params", ",", "dtrain", ",", "num_boost_round", "=", "10", ",", "evals", "=", "(", ")", ",", "obj", "=", "None", ",", "feval", "=", "None", ",", "maximize", "=", "False", ",", "early_stopping_rounds", "=", "None", ",", "evals_resu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
mknfold
Make an n-fold list of CVPack from random indices.
src/external/xgboost/python-package/xgboost/training.py
def mknfold(dall, nfold, param, seed, evals=(), fpreproc=None): """ Make an n-fold list of CVPack from random indices. """ evals = list(evals) np.random.seed(seed) randidx = np.random.permutation(dall.num_row()) kstep = len(randidx) / nfold idset = [randidx[(i * kstep): min(len(randidx),...
def mknfold(dall, nfold, param, seed, evals=(), fpreproc=None): """ Make an n-fold list of CVPack from random indices. """ evals = list(evals) np.random.seed(seed) randidx = np.random.permutation(dall.num_row()) kstep = len(randidx) / nfold idset = [randidx[(i * kstep): min(len(randidx),...
[ "Make", "an", "n", "-", "fold", "list", "of", "CVPack", "from", "random", "indices", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L213-L233
[ "def", "mknfold", "(", "dall", ",", "nfold", ",", "param", ",", "seed", ",", "evals", "=", "(", ")", ",", "fpreproc", "=", "None", ")", ":", "evals", "=", "list", "(", "evals", ")", "np", ".", "random", ".", "seed", "(", "seed", ")", "randidx", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
aggcv
Aggregate cross-validation results.
src/external/xgboost/python-package/xgboost/training.py
def aggcv(rlist, show_stdv=True, show_progress=None, as_pandas=True): # pylint: disable=invalid-name """ Aggregate cross-validation results. """ cvmap = {} idx = rlist[0].split()[0] for line in rlist: arr = line.split() assert idx == arr[0] for it in arr[1:]: ...
def aggcv(rlist, show_stdv=True, show_progress=None, as_pandas=True): # pylint: disable=invalid-name """ Aggregate cross-validation results. """ cvmap = {} idx = rlist[0].split()[0] for line in rlist: arr = line.split() assert idx == arr[0] for it in arr[1:]: ...
[ "Aggregate", "cross", "-", "validation", "results", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L236-L291
[ "def", "aggcv", "(", "rlist", ",", "show_stdv", "=", "True", ",", "show_progress", "=", "None", ",", "as_pandas", "=", "True", ")", ":", "# pylint: disable=invalid-name", "cvmap", "=", "{", "}", "idx", "=", "rlist", "[", "0", "]", ".", "split", "(", ")...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
cv
Cross-validation with given paramaters. Parameters ---------- params : dict Booster params. dtrain : DMatrix Data to be trained. num_boost_round : int Number of boosting iterations. nfold : int Number of folds in CV. metrics : list of strings Evaluati...
src/external/xgboost/python-package/xgboost/training.py
def cv(params, dtrain, num_boost_round=10, nfold=3, metrics=(), obj=None, feval=None, fpreproc=None, as_pandas=True, show_progress=None, show_stdv=True, seed=0): # pylint: disable = invalid-name """Cross-validation with given paramaters. Parameters ---------- params : dict Boo...
def cv(params, dtrain, num_boost_round=10, nfold=3, metrics=(), obj=None, feval=None, fpreproc=None, as_pandas=True, show_progress=None, show_stdv=True, seed=0): # pylint: disable = invalid-name """Cross-validation with given paramaters. Parameters ---------- params : dict Boo...
[ "Cross", "-", "validation", "with", "given", "paramaters", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L294-L354
[ "def", "cv", "(", "params", ",", "dtrain", ",", "num_boost_round", "=", "10", ",", "nfold", "=", "3", ",", "metrics", "=", "(", ")", ",", "obj", "=", "None", ",", "feval", "=", "None", ",", "fpreproc", "=", "None", ",", "as_pandas", "=", "True", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a :class:`ImageClassifier` 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/image_classifier/image_classifier.py
def create(dataset, target, feature=None, model = 'resnet-50', l2_penalty=0.01, l1_penalty=0.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], step_size = _DEFAULT_SOLVER_OPTIONS['step_size'], lbfgs_memory_level = _DEFAULT_SOLVER...
def create(dataset, target, feature=None, model = 'resnet-50', l2_penalty=0.01, l1_penalty=0.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], step_size = _DEFAULT_SOLVER_OPTIONS['step_size'], lbfgs_memory_level = _DEFAULT_SOLVER...
[ "Create", "a", ":", "class", ":", "ImageClassifier", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L38-L307
[ "def", "create", "(", "dataset", ",", "target", ",", "feature", "=", "None", ",", "model", "=", "'resnet-50'", ",", "l2_penalty", "=", "0.01", ",", "l1_penalty", "=", "0.0", ",", "solver", "=", "'auto'", ",", "feature_rescaling", "=", "True", ",", "conve...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ImageClassifier._get_native_state
Save the model as a dictionary, which can be loaded with the :py:func:`~turicreate.load_model` method.
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
def _get_native_state(self): """ Save the model as a dictionary, which can be loaded with the :py:func:`~turicreate.load_model` method. """ state = self.__proxy__.get_state() state['classifier'] = state['classifier'].__proxy__ del state['feature_extractor'] ...
def _get_native_state(self): """ Save the model as a dictionary, which can be loaded with the :py:func:`~turicreate.load_model` method. """ state = self.__proxy__.get_state() state['classifier'] = state['classifier'].__proxy__ del state['feature_extractor'] ...
[ "Save", "the", "model", "as", "a", "dictionary", "which", "can", "be", "loaded", "with", "the", ":", "py", ":", "func", ":", "~turicreate", ".", "load_model", "method", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L329-L338
[ "def", "_get_native_state", "(", "self", ")", ":", "state", "=", "self", ".", "__proxy__", ".", "get_state", "(", ")", "state", "[", "'classifier'", "]", "=", "state", "[", "'classifier'", "]", ".", "__proxy__", "del", "state", "[", "'feature_extractor'", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ImageClassifier._load_version
A function to load a previously saved ImageClassifier instance.
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
def _load_version(cls, state, version): """ A function to load a previously saved ImageClassifier instance. """ _tkutl._model_version_check(version, cls._PYTHON_IMAGE_CLASSIFIER_VERSION) from turicreate.toolkits.classifier.logistic_classifier import LogisticClassifier ...
def _load_version(cls, state, version): """ A function to load a previously saved ImageClassifier instance. """ _tkutl._model_version_check(version, cls._PYTHON_IMAGE_CLASSIFIER_VERSION) from turicreate.toolkits.classifier.logistic_classifier import LogisticClassifier ...
[ "A", "function", "to", "load", "a", "previously", "saved", "ImageClassifier", "instance", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L341-L362
[ "def", "_load_version", "(", "cls", ",", "state", ",", "version", ")", ":", "_tkutl", ".", "_model_version_check", "(", "version", ",", "cls", ".", "_PYTHON_IMAGE_CLASSIFIER_VERSION", ")", "from", "turicreate", ".", "toolkits", ".", "classifier", ".", "logistic_...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ImageClassifier.predict
Return predictions for ``dataset``, using the trained logistic regression model. Predictions can be generated as class labels, probabilities that the target value is True, or margins (i.e. the distance of the observations from the hyperplane separating the classes). `probability_vector` ...
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
def predict(self, dataset, output_type='class', batch_size=64): """ Return predictions for ``dataset``, using the trained logistic regression model. Predictions can be generated as class labels, probabilities that the target value is True, or margins (i.e. the distance of the obs...
def predict(self, dataset, output_type='class', batch_size=64): """ Return predictions for ``dataset``, using the trained logistic regression model. Predictions can be generated as class labels, probabilities that the target value is True, or margins (i.e. the distance of the obs...
[ "Return", "predictions", "for", "dataset", "using", "the", "trained", "logistic", "regression", "model", ".", "Predictions", "can", "be", "generated", "as", "class", "labels", "probabilities", "that", "the", "target", "value", "is", "True", "or", "margins", "(",...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L433-L499
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'class'", ",", "batch_size", "=", "64", ")", ":", "if", "not", "isinstance", "(", "dataset", ",", "(", "_tc", ".", "SFrame", ",", "_tc", ".", "SArray", ",", "_tc", ".", "Image",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ImageClassifier.predict_topk
Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depending on the ``output_type`` parameter. Input dataset size must be the same as for training of the model. ...
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
def predict_topk(self, dataset, output_type="probability", k=3, batch_size=64): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depending on the ``...
def predict_topk(self, dataset, output_type="probability", k=3, batch_size=64): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depending on the ``...
[ "Return", "top", "-", "k", "predictions", "for", "the", "dataset", "using", "the", "trained", "model", ".", "Predictions", "are", "returned", "as", "an", "SFrame", "with", "three", "columns", ":", "id", "class", "and", "probability", "margin", "or", "rank", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L546-L609
[ "def", "predict_topk", "(", "self", ",", "dataset", ",", "output_type", "=", "\"probability\"", ",", "k", "=", "3", ",", "batch_size", "=", "64", ")", ":", "if", "not", "isinstance", "(", "dataset", ",", "(", "_tc", ".", "SFrame", ",", "_tc", ".", "S...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ImageClassifier.evaluate
Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the target and features used for model training. Additi...
src/unity/python/turicreate/toolkits/image_classifier/image_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 of new observations. Must include colum...
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 of new observations. Must include colum...
[ "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/image_classifier/image_classifier.py#L611-L816
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "verbose", "=", "True", ",", "batch_size", "=", "64", ")", ":", "import", "os", ",", "json", ",", "math", "if", "(", "batch_size", "<", "1", ")", ":", "raise", "Valu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ImageClassifier.export_coreml
Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('myModel.mlmodel')
src/unity/python/turicreate/toolkits/image_classifier/image_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 # First define three internal helper functions ...
def export_coreml(self, filename): """ Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('myModel.mlmodel') """ import coremltools # First define three internal helper functions ...
[ "Save", "the", "model", "in", "Core", "ML", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L824-L1021
[ "def", "export_coreml", "(", "self", ",", "filename", ")", ":", "import", "coremltools", "# First define three internal helper functions", "# Internal helper function", "def", "_create_vision_feature_print_scene", "(", ")", ":", "prob_name", "=", "self", ".", "target", "+...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.make_input_layers
Extract the ordering of the input layers.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
def make_input_layers(self): """ Extract the ordering of the input layers. """ self.input_layers = [] in_nodes = self.model._inbound_nodes if hasattr( self.model,'_inbound_nodes') else self.model.inbound_nodes if hasattr(self.model, 'input_layers'): ...
def make_input_layers(self): """ Extract the ordering of the input layers. """ self.input_layers = [] in_nodes = self.model._inbound_nodes if hasattr( self.model,'_inbound_nodes') else self.model.inbound_nodes if hasattr(self.model, 'input_layers'): ...
[ "Extract", "the", "ordering", "of", "the", "input", "layers", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L148-L179
[ "def", "make_input_layers", "(", "self", ")", ":", "self", ".", "input_layers", "=", "[", "]", "in_nodes", "=", "self", ".", "model", ".", "_inbound_nodes", "if", "hasattr", "(", "self", ".", "model", ",", "'_inbound_nodes'", ")", "else", "self", ".", "m...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.make_output_layers
Extract the ordering of output layers.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
def make_output_layers(self): """ Extract the ordering of output layers. """ self.output_layers = [] # import pytest; pytest.set_trace() if hasattr(self.model, 'output_layers'): # find corresponding output layers in CoreML model # assume output lay...
def make_output_layers(self): """ Extract the ordering of output layers. """ self.output_layers = [] # import pytest; pytest.set_trace() if hasattr(self.model, 'output_layers'): # find corresponding output layers in CoreML model # assume output lay...
[ "Extract", "the", "ordering", "of", "output", "layers", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L181-L216
[ "def", "make_output_layers", "(", "self", ")", ":", "self", ".", "output_layers", "=", "[", "]", "# import pytest; pytest.set_trace()", "if", "hasattr", "(", "self", ".", "model", ",", "'output_layers'", ")", ":", "# find corresponding output layers in CoreML model", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph._remove_layer_and_reconnect
Remove the layer, and reconnect each of its predecessor to each of its successor
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
def _remove_layer_and_reconnect(self, layer): """ Remove the layer, and reconnect each of its predecessor to each of its successor """ successors = self.get_successors(layer) predecessors = self.get_predecessors(layer) # remove layer's edges for succ in successors...
def _remove_layer_and_reconnect(self, layer): """ Remove the layer, and reconnect each of its predecessor to each of its successor """ successors = self.get_successors(layer) predecessors = self.get_predecessors(layer) # remove layer's edges for succ in successors...
[ "Remove", "the", "layer", "and", "reconnect", "each", "of", "its", "predecessor", "to", "each", "of", "its", "successor" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L387-L421
[ "def", "_remove_layer_and_reconnect", "(", "self", ",", "layer", ")", ":", "successors", "=", "self", ".", "get_successors", "(", "layer", ")", "predecessors", "=", "self", ".", "get_predecessors", "(", "layer", ")", "# remove layer's edges", "for", "succ", "in"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.defuse_activation
Defuse the fused activation layers in the network.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
def defuse_activation(self): """ Defuse the fused activation layers in the network. """ idx, nb_layers = 0, len(self.layer_list) while idx < nb_layers: layer = self.layer_list[idx] k_layer = self.keras_layer_map[layer] if (isinstance(k_layer, _keras.la...
def defuse_activation(self): """ Defuse the fused activation layers in the network. """ idx, nb_layers = 0, len(self.layer_list) while idx < nb_layers: layer = self.layer_list[idx] k_layer = self.keras_layer_map[layer] if (isinstance(k_layer, _keras.la...
[ "Defuse", "the", "fused", "activation", "layers", "in", "the", "network", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L498-L524
[ "def", "defuse_activation", "(", "self", ")", ":", "idx", ",", "nb_layers", "=", "0", ",", "len", "(", "self", ".", "layer_list", ")", "while", "idx", "<", "nb_layers", ":", "layer", "=", "self", ".", "layer_list", "[", "idx", "]", "k_layer", "=", "s...
74514c3f99e25b46f22c6e02977fe3da69221c2e