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 | convert_tree_ensemble | Convert a generic tree model to the protobuf spec.
This currently supports:
* Decision tree regression
Parameters
----------
model: str | Booster
Path on disk where the XGboost JSON representation of the model is or
a handle to the XGboost model.
feature_names : list of stri... | src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree_ensemble.py | def convert_tree_ensemble(model, feature_names, target, force_32bit_float):
"""Convert a generic tree model to the protobuf spec.
This currently supports:
* Decision tree regression
Parameters
----------
model: str | Booster
Path on disk where the XGboost JSON representation of the m... | def convert_tree_ensemble(model, feature_names, target, force_32bit_float):
"""Convert a generic tree model to the protobuf spec.
This currently supports:
* Decision tree regression
Parameters
----------
model: str | Booster
Path on disk where the XGboost JSON representation of the m... | [
"Convert",
"a",
"generic",
"tree",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree_ensemble.py#L75-L156 | [
"def",
"convert_tree_ensemble",
"(",
"model",
",",
"feature_names",
",",
"target",
",",
"force_32bit_float",
")",
":",
"if",
"not",
"(",
"_HAS_XGBOOST",
")",
":",
"raise",
"RuntimeError",
"(",
"'xgboost not found. xgboost conversion API is disabled.'",
")",
"import",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a one-hot-encoder model to the protobuf spec.
Parameters
----------
model: OneHotEncoder
A trained one-hot encoder model.
input_features: str, optional
Name of the input column.
output_features: str, optional
Name of the output column.
Returns
-------
... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py | def convert(model, input_features, output_features):
"""Convert a one-hot-encoder model to the protobuf spec.
Parameters
----------
model: OneHotEncoder
A trained one-hot encoder model.
input_features: str, optional
Name of the input column.
output_features: str, optional
... | def convert(model, input_features, output_features):
"""Convert a one-hot-encoder model to the protobuf spec.
Parameters
----------
model: OneHotEncoder
A trained one-hot encoder model.
input_features: str, optional
Name of the input column.
output_features: str, optional
... | [
"Convert",
"a",
"one",
"-",
"hot",
"-",
"encoder",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py#L33-L189 | [
"def",
"convert",
"(",
"model",
",",
"input_features",
",",
"output_features",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"# Make sure the model is fitted.",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | update_dimension | Given a model that takes an array of dimension input_dimension, returns
the output dimension. | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py | def update_dimension(model, input_dimension):
"""
Given a model that takes an array of dimension input_dimension, returns
the output dimension.
"""
if not(_HAS_SKLEARN):
raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.')
_sklearn_util.check_fitted(mod... | def update_dimension(model, input_dimension):
"""
Given a model that takes an array of dimension input_dimension, returns
the output dimension.
"""
if not(_HAS_SKLEARN):
raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.')
_sklearn_util.check_fitted(mod... | [
"Given",
"a",
"model",
"that",
"takes",
"an",
"array",
"of",
"dimension",
"input_dimension",
"returns",
"the",
"output",
"dimension",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py#L192-L209 | [
"def",
"update_dimension",
"(",
"model",
",",
"input_dimension",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"_sklearn_util",
".",
"check_fitted",
"(",
"mo... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_reshape | Converts a reshape layer from mxnet to coreml.
This doesn't currently handle the deprecated parameters for the reshape layer.
Parameters
----------
net: network
An mxnet network object.
node: layer
Node to convert.
module: module
A module for MXNet
builder: Neura... | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_reshape(net, node, module, builder):
"""Converts a reshape layer from mxnet to coreml.
This doesn't currently handle the deprecated parameters for the reshape layer.
Parameters
----------
net: network
An mxnet network object.
node: layer
Node to convert.
modul... | def convert_reshape(net, node, module, builder):
"""Converts a reshape layer from mxnet to coreml.
This doesn't currently handle the deprecated parameters for the reshape layer.
Parameters
----------
net: network
An mxnet network object.
node: layer
Node to convert.
modul... | [
"Converts",
"a",
"reshape",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L61-L97 | [
"def",
"convert_reshape",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_elementwise_mul_scalar | Convert a scalar multiplication from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_elementwise_mul_scalar(net, node, module, builder):
"""Convert a scalar multiplication from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetwo... | def convert_elementwise_mul_scalar(net, node, module, builder):
"""Convert a scalar multiplication from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetwo... | [
"Convert",
"a",
"scalar",
"multiplication",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L224-L252 | [
"def",
"convert_elementwise_mul_scalar",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"import",
"numpy",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_dense | Convert a dense layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_dense(net, node, module, builder):
"""Convert a dense layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural ... | def convert_dense(net, node, module, builder):
"""Convert a dense layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural ... | [
"Convert",
"a",
"dense",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L286-L325 | [
"def",
"convert_dense",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"has_bias",
"=",
"True",
"name",
"=",
"node",
"[",
"'name'",
"]",
"in... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_padding | Convert a padding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_padding(net, node, module, builder):
"""Convert a padding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | def convert_padding(net, node, module, builder):
"""Convert a padding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | [
"Convert",
"a",
"padding",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L421-L462 | [
"def",
"convert_padding",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_upsample | Convert a UpSampling layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_upsample(net, node, module, builder):
"""Convert a UpSampling layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A... | def convert_upsample(net, node, module, builder):
"""Convert a UpSampling layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A... | [
"Convert",
"a",
"UpSampling",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L704-L738 | [
"def",
"convert_upsample",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_softmax | Convert a softmax layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_softmax(net, node, module, builder):
"""Convert a softmax layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | def convert_softmax(net, node, module, builder):
"""Convert a softmax layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | [
"Convert",
"a",
"softmax",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L768-L795 | [
"def",
"convert_softmax",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_custom | Convert highly specific ops | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_custom(net, node, module, builder):
"""Convert highly specific ops"""
input_name, output_name = _get_input_output_name(net, node)
name = node['name']
param = _get_attr(node)
if param['op_type'] == 'special-darknet-maxpool':
_add_pooling.add_pooling_with_padding_types(
... | def convert_custom(net, node, module, builder):
"""Convert highly specific ops"""
input_name, output_name = _get_input_output_name(net, node)
name = node['name']
param = _get_attr(node)
if param['op_type'] == 'special-darknet-maxpool':
_add_pooling.add_pooling_with_padding_types(
... | [
"Convert",
"highly",
"specific",
"ops"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L808-L829 | [
"def",
"convert_custom",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_embedding | Convert an embedding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_embedding(net, node, model, builder):
"""Convert an embedding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A ne... | def convert_embedding(net, node, model, builder):
"""Convert an embedding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A ne... | [
"Convert",
"an",
"embedding",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L831-L875 | [
"def",
"convert_embedding",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"inputs",
"=",
"node",
"[... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_scalar_add | Convert a scalar add layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_scalar_add(net, node, model, builder):
"""Convert a scalar add layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A n... | def convert_scalar_add(net, node, model, builder):
"""Convert a scalar add layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A n... | [
"Convert",
"a",
"scalar",
"add",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L899-L923 | [
"def",
"convert_scalar_add",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"import",
"numpy",
"as",
"_np",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_scalar_multiply | Convert a scalar multiply layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_scalar_multiply(net, node, model, builder):
"""Convert a scalar multiply layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | def convert_scalar_multiply(net, node, model, builder):
"""Convert a scalar multiply layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | [
"Convert",
"a",
"scalar",
"multiply",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L926-L949 | [
"def",
"convert_scalar_multiply",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"import",
"numpy",
"as",
"_np",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'na... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert_instancenorm | Convert an instance norm layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | def convert_instancenorm(net, node, model, builder):
"""Convert an instance norm layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | def convert_instancenorm(net, node, model, builder):
"""Convert an instance norm layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | [
"Convert",
"an",
"instance",
"norm",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L976-L1026 | [
"def",
"convert_instancenorm",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"import",
"numpy",
"as",
"_np",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_aws_credentials | Returns the values stored in the AWS credential environment variables.
Returns the value stored in the AWS_ACCESS_KEY_ID environment variable and
the value stored in the AWS_SECRET_ACCESS_KEY environment variable.
Returns
-------
out : tuple [string]
The first string of the tuple is the val... | src/unity/python/turicreate/util/__init__.py | def _get_aws_credentials():
"""
Returns the values stored in the AWS credential environment variables.
Returns the value stored in the AWS_ACCESS_KEY_ID environment variable and
the value stored in the AWS_SECRET_ACCESS_KEY environment variable.
Returns
-------
out : tuple [string]
... | def _get_aws_credentials():
"""
Returns the values stored in the AWS credential environment variables.
Returns the value stored in the AWS_ACCESS_KEY_ID environment variable and
the value stored in the AWS_SECRET_ACCESS_KEY environment variable.
Returns
-------
out : tuple [string]
... | [
"Returns",
"the",
"values",
"stored",
"in",
"the",
"AWS",
"credential",
"environment",
"variables",
".",
"Returns",
"the",
"value",
"stored",
"in",
"the",
"AWS_ACCESS_KEY_ID",
"environment",
"variable",
"and",
"the",
"value",
"stored",
"in",
"the",
"AWS_SECRET_ACC... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L47-L70 | [
"def",
"_get_aws_credentials",
"(",
")",
":",
"if",
"(",
"not",
"'AWS_ACCESS_KEY_ID'",
"in",
"_os",
".",
"environ",
")",
":",
"raise",
"KeyError",
"(",
"'No access key found. Please set the environment variable AWS_ACCESS_KEY_ID.'",
")",
"if",
"(",
"not",
"'AWS_SECRET_A... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _try_inject_s3_credentials | Inject aws credentials into s3 url as s3://[aws_id]:[aws_key]:[bucket/][objectkey]
If s3 url already contains secret key/id pairs, just return as is. | src/unity/python/turicreate/util/__init__.py | def _try_inject_s3_credentials(url):
"""
Inject aws credentials into s3 url as s3://[aws_id]:[aws_key]:[bucket/][objectkey]
If s3 url already contains secret key/id pairs, just return as is.
"""
assert url.startswith('s3://')
path = url[5:]
# Check if the path already contains credentials
... | def _try_inject_s3_credentials(url):
"""
Inject aws credentials into s3 url as s3://[aws_id]:[aws_key]:[bucket/][objectkey]
If s3 url already contains secret key/id pairs, just return as is.
"""
assert url.startswith('s3://')
path = url[5:]
# Check if the path already contains credentials
... | [
"Inject",
"aws",
"credentials",
"into",
"s3",
"url",
"as",
"s3",
":",
"//",
"[",
"aws_id",
"]",
":",
"[",
"aws_key",
"]",
":",
"[",
"bucket",
"/",
"]",
"[",
"objectkey",
"]"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L73-L92 | [
"def",
"_try_inject_s3_credentials",
"(",
"url",
")",
":",
"assert",
"url",
".",
"startswith",
"(",
"'s3://'",
")",
"path",
"=",
"url",
"[",
"5",
":",
"]",
"# Check if the path already contains credentials",
"tokens",
"=",
"path",
".",
"split",
"(",
"':'",
")"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _make_internal_url | Process user input url string with proper normalization
For all urls:
Expands ~ to $HOME
For S3 urls:
Returns the s3 URL with credentials filled in using turicreate.aws.get_aws_credential().
For example: "s3://mybucket/foo" -> "s3://$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY:mybucket/foo".
... | src/unity/python/turicreate/util/__init__.py | def _make_internal_url(url):
"""
Process user input url string with proper normalization
For all urls:
Expands ~ to $HOME
For S3 urls:
Returns the s3 URL with credentials filled in using turicreate.aws.get_aws_credential().
For example: "s3://mybucket/foo" -> "s3://$AWS_ACCESS_KEY_ID:$... | def _make_internal_url(url):
"""
Process user input url string with proper normalization
For all urls:
Expands ~ to $HOME
For S3 urls:
Returns the s3 URL with credentials filled in using turicreate.aws.get_aws_credential().
For example: "s3://mybucket/foo" -> "s3://$AWS_ACCESS_KEY_ID:$... | [
"Process",
"user",
"input",
"url",
"string",
"with",
"proper",
"normalization",
"For",
"all",
"urls",
":",
"Expands",
"~",
"to",
"$HOME",
"For",
"S3",
"urls",
":",
"Returns",
"the",
"s3",
"URL",
"with",
"credentials",
"filled",
"in",
"using",
"turicreate",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L95-L149 | [
"def",
"_make_internal_url",
"(",
"url",
")",
":",
"if",
"not",
"url",
":",
"raise",
"ValueError",
"(",
"'Invalid url: %s'",
"%",
"url",
")",
"from",
".",
".",
"import",
"_sys_util",
"from",
".",
"import",
"_file_util",
"# Convert Windows paths to Unix-style slash... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | is_directory_archive | Utility function that returns True if the path provided is a directory that has an SFrame or SGraph in it.
SFrames are written to disk as a directory archive, this function identifies if a given directory is an archive
for an SFrame.
Parameters
----------
path : string
Directory to evaluat... | src/unity/python/turicreate/util/__init__.py | def is_directory_archive(path):
"""
Utility function that returns True if the path provided is a directory that has an SFrame or SGraph in it.
SFrames are written to disk as a directory archive, this function identifies if a given directory is an archive
for an SFrame.
Parameters
----------
... | def is_directory_archive(path):
"""
Utility function that returns True if the path provided is a directory that has an SFrame or SGraph in it.
SFrames are written to disk as a directory archive, this function identifies if a given directory is an archive
for an SFrame.
Parameters
----------
... | [
"Utility",
"function",
"that",
"returns",
"True",
"if",
"the",
"path",
"provided",
"is",
"a",
"directory",
"that",
"has",
"an",
"SFrame",
"or",
"SGraph",
"in",
"it",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L152-L181 | [
"def",
"is_directory_archive",
"(",
"path",
")",
":",
"if",
"path",
"is",
"None",
":",
"return",
"False",
"if",
"not",
"_os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"return",
"False",
"ini_path",
"=",
"'/'",
".",
"join",
"(",
"[",
"_conver... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_archive_type | Returns the contents type for the provided archive path.
Parameters
----------
path : string
Directory to evaluate.
Returns
-------
Returns a string of: sframe, sgraph, raises TypeError for anything else | src/unity/python/turicreate/util/__init__.py | def get_archive_type(path):
"""
Returns the contents type for the provided archive path.
Parameters
----------
path : string
Directory to evaluate.
Returns
-------
Returns a string of: sframe, sgraph, raises TypeError for anything else
"""
if not is_directory_archive(pa... | def get_archive_type(path):
"""
Returns the contents type for the provided archive path.
Parameters
----------
path : string
Directory to evaluate.
Returns
-------
Returns a string of: sframe, sgraph, raises TypeError for anything else
"""
if not is_directory_archive(pa... | [
"Returns",
"the",
"contents",
"type",
"for",
"the",
"provided",
"archive",
"path",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L183-L207 | [
"def",
"get_archive_type",
"(",
"path",
")",
":",
"if",
"not",
"is_directory_archive",
"(",
"path",
")",
":",
"raise",
"TypeError",
"(",
"'Unable to determine the type of archive at path: %s'",
"%",
"path",
")",
"try",
":",
"ini_path",
"=",
"'/'",
".",
"join",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | crossproduct | Create an SFrame containing the crossproduct of all provided options.
Parameters
----------
d : dict
Each key is the name of an option, and each value is a list
of the possible values for that option.
Returns
-------
out : SFrame
There will be a column for each key in t... | src/unity/python/turicreate/util/__init__.py | def crossproduct(d):
"""
Create an SFrame containing the crossproduct of all provided options.
Parameters
----------
d : dict
Each key is the name of an option, and each value is a list
of the possible values for that option.
Returns
-------
out : SFrame
There w... | def crossproduct(d):
"""
Create an SFrame containing the crossproduct of all provided options.
Parameters
----------
d : dict
Each key is the name of an option, and each value is a list
of the possible values for that option.
Returns
-------
out : SFrame
There w... | [
"Create",
"an",
"SFrame",
"containing",
"the",
"crossproduct",
"of",
"all",
"provided",
"options",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L209-L246 | [
"def",
"crossproduct",
"(",
"d",
")",
":",
"from",
".",
".",
"import",
"SArray",
"d",
"=",
"[",
"list",
"(",
"zip",
"(",
"list",
"(",
"d",
".",
"keys",
"(",
")",
")",
",",
"x",
")",
")",
"for",
"x",
"in",
"_itertools",
".",
"product",
"(",
"*... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_turicreate_object_type | Given url where a Turi Create object is persisted, return the Turi
Create object type: 'model', 'graph', 'sframe', or 'sarray' | src/unity/python/turicreate/util/__init__.py | def get_turicreate_object_type(url):
'''
Given url where a Turi Create object is persisted, return the Turi
Create object type: 'model', 'graph', 'sframe', or 'sarray'
'''
from .._connect import main as _glconnect
ret = _glconnect.get_unity().get_turicreate_object_type(_make_internal_url(url))
... | def get_turicreate_object_type(url):
'''
Given url where a Turi Create object is persisted, return the Turi
Create object type: 'model', 'graph', 'sframe', or 'sarray'
'''
from .._connect import main as _glconnect
ret = _glconnect.get_unity().get_turicreate_object_type(_make_internal_url(url))
... | [
"Given",
"url",
"where",
"a",
"Turi",
"Create",
"object",
"is",
"persisted",
"return",
"the",
"Turi",
"Create",
"object",
"type",
":",
"model",
"graph",
"sframe",
"or",
"sarray"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L249-L260 | [
"def",
"get_turicreate_object_type",
"(",
"url",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"ret",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
".",
"get_turicreate_object_type",
"(",
"_make_internal_url",
"(",
"url",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _assert_sframe_equal | Assert the two SFrames are equal.
The default behavior of this function uses the strictest possible
definition of equality, where all columns must be in the same order, with
the same names and have the same data in the same order. Each of these
stipulations can be relaxed individually and in concert w... | src/unity/python/turicreate/util/__init__.py | def _assert_sframe_equal(sf1,
sf2,
check_column_names=True,
check_column_order=True,
check_row_order=True,
float_column_delta=None):
"""
Assert the two SFrames are equal.
The default... | def _assert_sframe_equal(sf1,
sf2,
check_column_names=True,
check_column_order=True,
check_row_order=True,
float_column_delta=None):
"""
Assert the two SFrames are equal.
The default... | [
"Assert",
"the",
"two",
"SFrames",
"are",
"equal",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L263-L365 | [
"def",
"_assert_sframe_equal",
"(",
"sf1",
",",
"sf2",
",",
"check_column_names",
"=",
"True",
",",
"check_column_order",
"=",
"True",
",",
"check_row_order",
"=",
"True",
",",
"float_column_delta",
"=",
"None",
")",
":",
"from",
".",
".",
"import",
"SFrame",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_temp_file_location | Returns user specified temporary file location.
The temporary location is specified through:
>>> turicreate.config.set_runtime_config('TURI_CACHE_FILE_LOCATIONS', ...) | src/unity/python/turicreate/util/__init__.py | def _get_temp_file_location():
'''
Returns user specified temporary file location.
The temporary location is specified through:
>>> turicreate.config.set_runtime_config('TURI_CACHE_FILE_LOCATIONS', ...)
'''
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
cache_... | def _get_temp_file_location():
'''
Returns user specified temporary file location.
The temporary location is specified through:
>>> turicreate.config.set_runtime_config('TURI_CACHE_FILE_LOCATIONS', ...)
'''
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
cache_... | [
"Returns",
"user",
"specified",
"temporary",
"file",
"location",
".",
"The",
"temporary",
"location",
"is",
"specified",
"through",
":"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L367-L380 | [
"def",
"_get_temp_file_location",
"(",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"cache_dir",
"=",
"_convert_slashes",
"(",
"unity",
".",
"get_current_cache_file_location",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _make_temp_directory | Generate a temporary directory that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the directory is no
longer needed. But the directory will be cleaned as unity_server restarts | src/unity/python/turicreate/util/__init__.py | def _make_temp_directory(prefix):
'''
Generate a temporary directory that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the directory is no
longer needed. But the directory will be cleaned as unity_server restarts
'''
temp_dir = ... | def _make_temp_directory(prefix):
'''
Generate a temporary directory that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the directory is no
longer needed. But the directory will be cleaned as unity_server restarts
'''
temp_dir = ... | [
"Generate",
"a",
"temporary",
"directory",
"that",
"would",
"not",
"live",
"beyond",
"the",
"lifetime",
"of",
"unity_server",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L382-L392 | [
"def",
"_make_temp_directory",
"(",
"prefix",
")",
":",
"temp_dir",
"=",
"_make_temp_filename",
"(",
"prefix",
"=",
"str",
"(",
"prefix",
")",
")",
"_os",
".",
"makedirs",
"(",
"temp_dir",
")",
"return",
"temp_dir"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _make_temp_filename | Generate a temporary file that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the file is no
longer needed. But temp files created using this method will be cleaned up
when unity_server restarts | src/unity/python/turicreate/util/__init__.py | def _make_temp_filename(prefix):
'''
Generate a temporary file that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the file is no
longer needed. But temp files created using this method will be cleaned up
when unity_server restarts
... | def _make_temp_filename(prefix):
'''
Generate a temporary file that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the file is no
longer needed. But temp files created using this method will be cleaned up
when unity_server restarts
... | [
"Generate",
"a",
"temporary",
"file",
"that",
"would",
"not",
"live",
"beyond",
"the",
"lifetime",
"of",
"unity_server",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L394-L405 | [
"def",
"_make_temp_filename",
"(",
"prefix",
")",
":",
"temp_location",
"=",
"_get_temp_file_location",
"(",
")",
"temp_file_name",
"=",
"'/'",
".",
"join",
"(",
"[",
"temp_location",
",",
"str",
"(",
"prefix",
")",
"+",
"str",
"(",
"_uuid",
".",
"uuid4",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _pickle_to_temp_location_or_memory | If obj can be serialized directly into memory (via cloudpickle) this
will return the serialized bytes.
Otherwise, gl_pickle is attempted and it will then
generates a temporary directory serializes an object into it, returning
the directory name. This directory will not have lifespan grea... | src/unity/python/turicreate/util/__init__.py | def _pickle_to_temp_location_or_memory(obj):
'''
If obj can be serialized directly into memory (via cloudpickle) this
will return the serialized bytes.
Otherwise, gl_pickle is attempted and it will then
generates a temporary directory serializes an object into it, returning
... | def _pickle_to_temp_location_or_memory(obj):
'''
If obj can be serialized directly into memory (via cloudpickle) this
will return the serialized bytes.
Otherwise, gl_pickle is attempted and it will then
generates a temporary directory serializes an object into it, returning
... | [
"If",
"obj",
"can",
"be",
"serialized",
"directly",
"into",
"memory",
"(",
"via",
"cloudpickle",
")",
"this",
"will",
"return",
"the",
"serialized",
"bytes",
".",
"Otherwise",
"gl_pickle",
"is",
"attempted",
"and",
"it",
"will",
"then",
"generates",
"a",
"te... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L407-L430 | [
"def",
"_pickle_to_temp_location_or_memory",
"(",
"obj",
")",
":",
"from",
".",
"import",
"_cloudpickle",
"as",
"cloudpickle",
"try",
":",
"# try cloudpickle first and see if that works",
"lambda_str",
"=",
"cloudpickle",
".",
"dumps",
"(",
"obj",
")",
"return",
"lamb... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_cuda_gpus | Returns a list of dictionaries, with the following keys:
- index (integer, device index of the GPU)
- name (str, GPU name)
- memory_free (float, free memory in MiB)
- memory_total (float, total memory in MiB) | src/unity/python/turicreate/util/__init__.py | def _get_cuda_gpus():
"""
Returns a list of dictionaries, with the following keys:
- index (integer, device index of the GPU)
- name (str, GPU name)
- memory_free (float, free memory in MiB)
- memory_total (float, total memory in MiB)
"""
import subprocess
try:
output = subpr... | def _get_cuda_gpus():
"""
Returns a list of dictionaries, with the following keys:
- index (integer, device index of the GPU)
- name (str, GPU name)
- memory_free (float, free memory in MiB)
- memory_total (float, total memory in MiB)
"""
import subprocess
try:
output = subpr... | [
"Returns",
"a",
"list",
"of",
"dictionaries",
"with",
"the",
"following",
"keys",
":",
"-",
"index",
"(",
"integer",
"device",
"index",
"of",
"the",
"GPU",
")",
"-",
"name",
"(",
"str",
"GPU",
"name",
")",
"-",
"memory_free",
"(",
"float",
"free",
"mem... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L473-L505 | [
"def",
"_get_cuda_gpus",
"(",
")",
":",
"import",
"subprocess",
"try",
":",
"output",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'nvidia-smi'",
",",
"'--query-gpu=index,gpu_name,memory.free,memory.total'",
",",
"'--format=csv,noheader,nounits'",
"]",
",",
"unive... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ParameterDecorator | Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/_parameterized.py | def _ParameterDecorator(naming_type, testcases):
"""Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object.
"""
def _Apply(obj):
if isinstance(obj, type):
_ModifyClass... | def _ParameterDecorator(naming_type, testcases):
"""Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object.
"""
def _Apply(obj):
if isinstance(obj, type):
_ModifyClass... | [
"Implementation",
"of",
"the",
"parameterization",
"decorators",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/_parameterized.py#L280-L306 | [
"def",
"_ParameterDecorator",
"(",
"naming_type",
",",
"testcases",
")",
":",
"def",
"_Apply",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"type",
")",
":",
"_ModifyClass",
"(",
"obj",
",",
"list",
"(",
"testcases",
")",
"if",
"not",
"is... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_header_comment | Checks if the header-comment of the given file needs fixing. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def check_header_comment(filename):
"""Checks if the header-comment of the given file needs fixing."""
# Check input file.
name = os.path.basename( filename )
# Read content of input file.
sourcefile = open( filename, "rU" )
content = sourcefile.read()
sourcefile.close()
# Search content... | def check_header_comment(filename):
"""Checks if the header-comment of the given file needs fixing."""
# Check input file.
name = os.path.basename( filename )
# Read content of input file.
sourcefile = open( filename, "rU" )
content = sourcefile.read()
sourcefile.close()
# Search content... | [
"Checks",
"if",
"the",
"header",
"-",
"comment",
"of",
"the",
"given",
"file",
"needs",
"fixing",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L19-L36 | [
"def",
"check_header_comment",
"(",
"filename",
")",
":",
"# Check input file.",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"# Read content of input file.",
"sourcefile",
"=",
"open",
"(",
"filename",
",",
"\"rU\"",
")",
"content",
"=... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_input_files_for_variadic_seq | Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def check_input_files_for_variadic_seq(headerDir, sourceDir):
"""Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing."""
# Check input files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.pa... | def check_input_files_for_variadic_seq(headerDir, sourceDir):
"""Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing."""
# Check input files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.pa... | [
"Checks",
"if",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"variadic",
"form",
"need",
"fixing",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L39-L48 | [
"def",
"check_input_files_for_variadic_seq",
"(",
"headerDir",
",",
"sourceDir",
")",
":",
"# Check input files in include/source-directories.",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"headerDir",
",",
"\"*.hpp\"",
")",
")",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_input_files_for_numbered_seq | Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
"""Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing."""
# Check input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir,... | def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
"""Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing."""
# Check input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir,... | [
"Check",
"if",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"numbered",
"form",
"need",
"fixing",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L51-L59 | [
"def",
"check_input_files_for_numbered_seq",
"(",
"sourceDir",
",",
"suffix",
",",
"containers",
")",
":",
"# Check input files for each MPL-container type.",
"for",
"container",
"in",
"containers",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
"."... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_input_files | Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing."""
# Check the input files for containers in their variadic form.
... | def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing."""
# Check the input files for containers in their variadic form.
... | [
"Checks",
"if",
"source",
"-",
"and",
"header",
"-",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"need",
"fixing",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L62-L90 | [
"def",
"check_input_files",
"(",
"headerDir",
",",
"sourceDir",
",",
"containers",
"=",
"[",
"'vector'",
",",
"'list'",
",",
"'set'",
",",
"'map'",
"]",
",",
"seqType",
"=",
"'both'",
",",
"verbose",
"=",
"False",
")",
":",
"# Check the input files for contain... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | fix_header_comment | Fixes the header-comment of the given file. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def fix_header_comment(filename, timestamp):
"""Fixes the header-comment of the given file."""
# Fix input file.
name = os.path.basename( filename )
for line in fileinput.input( filename, inplace=1, mode="rU" ):
# If header-comment already contains anything for '$Id$', remove it.
line = ... | def fix_header_comment(filename, timestamp):
"""Fixes the header-comment of the given file."""
# Fix input file.
name = os.path.basename( filename )
for line in fileinput.input( filename, inplace=1, mode="rU" ):
# If header-comment already contains anything for '$Id$', remove it.
line = ... | [
"Fixes",
"the",
"header",
"-",
"comment",
"of",
"the",
"given",
"file",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L92-L101 | [
"def",
"fix_header_comment",
"(",
"filename",
",",
"timestamp",
")",
":",
"# Fix input file.",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"for",
"line",
"in",
"fileinput",
".",
"input",
"(",
"filename",
",",
"inplace",
"=",
"1",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | fix_input_files_for_variadic_seq | Fixes files used as input when pre-processing MPL-containers in their variadic form. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp):
"""Fixes files used as input when pre-processing MPL-containers in their variadic form."""
# Fix files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.path.join( headerDi... | def fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp):
"""Fixes files used as input when pre-processing MPL-containers in their variadic form."""
# Fix files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.path.join( headerDi... | [
"Fixes",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"variadic",
"form",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L104-L111 | [
"def",
"fix_input_files_for_variadic_seq",
"(",
"headerDir",
",",
"sourceDir",
",",
"timestamp",
")",
":",
"# Fix files in include/source-directories.",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"headerDir",
",",
"\"*.hpp\"",
")"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | fix_input_files_for_numbered_seq | Fixes files used as input when pre-processing MPL-containers in their numbered form. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def fix_input_files_for_numbered_seq(sourceDir, suffix, timestamp, containers):
"""Fixes files used as input when pre-processing MPL-containers in their numbered form."""
# Fix input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir, container... | def fix_input_files_for_numbered_seq(sourceDir, suffix, timestamp, containers):
"""Fixes files used as input when pre-processing MPL-containers in their numbered form."""
# Fix input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir, container... | [
"Fixes",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"numbered",
"form",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L114-L120 | [
"def",
"fix_input_files_for_numbered_seq",
"(",
"sourceDir",
",",
"suffix",
",",
"timestamp",
",",
"containers",
")",
":",
"# Fix input files for each MPL-container type.",
"for",
"container",
"in",
"containers",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | fix_input_files | Fixes source- and header-files used as input when pre-processing MPL-containers. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Fixes source- and header-files used as input when pre-processing MPL-containers."""
# The new modification time.
timestamp = datetime.datetime.now();
# Fix the in... | def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Fixes source- and header-files used as input when pre-processing MPL-containers."""
# The new modification time.
timestamp = datetime.datetime.now();
# Fix the in... | [
"Fixes",
"source",
"-",
"and",
"header",
"-",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L123-L138 | [
"def",
"fix_input_files",
"(",
"headerDir",
",",
"sourceDir",
",",
"containers",
"=",
"[",
"'vector'",
",",
"'list'",
",",
"'set'",
",",
"'map'",
"]",
",",
"seqType",
"=",
"'both'",
",",
"verbose",
"=",
"False",
")",
":",
"# The new modification time.",
"tim... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | to_existing_absolute_path | Converts a path into its absolute path and verifies that it exists or throws an exception. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def to_existing_absolute_path(string):
"""Converts a path into its absolute path and verifies that it exists or throws an exception."""
value = os.path.abspath(string)
if not os.path.exists( value ) or not os.path.isdir( value ):
msg = '"%r" is not a valid path to a directory.' % string
rais... | def to_existing_absolute_path(string):
"""Converts a path into its absolute path and verifies that it exists or throws an exception."""
value = os.path.abspath(string)
if not os.path.exists( value ) or not os.path.isdir( value ):
msg = '"%r" is not a valid path to a directory.' % string
rais... | [
"Converts",
"a",
"path",
"into",
"its",
"absolute",
"path",
"and",
"verifies",
"that",
"it",
"exists",
"or",
"throws",
"an",
"exception",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L141-L147 | [
"def",
"to_existing_absolute_path",
"(",
"string",
")",
":",
"value",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"string",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"value",
")",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | main | The main function. | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | def main():
"""The main function."""
# Prepare and run cmdline-parser.
cmdlineParser = argparse.ArgumentParser(
description="Fixes the input files used for pre-processing of Boost.MPL headers.")
cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true',
... | def main():
"""The main function."""
# Prepare and run cmdline-parser.
cmdlineParser = argparse.ArgumentParser(
description="Fixes the input files used for pre-processing of Boost.MPL headers.")
cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true',
... | [
"The",
"main",
"function",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L150-L201 | [
"def",
"main",
"(",
")",
":",
"# Prepare and run cmdline-parser.",
"cmdlineParser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Fixes the input files used for pre-processing of Boost.MPL headers.\"",
")",
"cmdlineParser",
".",
"add_argument",
"(",
"\"-... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | Create a :class:`ImageSimilarityModel` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature' parameter will be
extracted for modeling.
label : string
Name of the SFrame column with row labels to be used as uuid's to
identify the dat... | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | def create(dataset, label = None, feature = None, model = 'resnet-50', verbose = True,
batch_size = 64):
"""
Create a :class:`ImageSimilarityModel` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature' parameter will be
extracted for ... | def create(dataset, label = None, feature = None, model = 'resnet-50', verbose = True,
batch_size = 64):
"""
Create a :class:`ImageSimilarityModel` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature' parameter will be
extracted for ... | [
"Create",
"a",
":",
"class",
":",
"ImageSimilarityModel",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L27-L162 | [
"def",
"create",
"(",
"dataset",
",",
"label",
"=",
"None",
",",
"feature",
"=",
"None",
",",
"model",
"=",
"'resnet-50'",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"start_time",
"=",
"_time",
".",
"time",
"(",
")",
"# Chec... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ImageSimilarityModel._load_version | A function to load a previously saved ImageClassifier
instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer. | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | def _load_version(cls, state, version):
"""
A function to load a previously saved ImageClassifier
instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class wri... | def _load_version(cls, state, version):
"""
A function to load a previously saved ImageClassifier
instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class wri... | [
"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_similarity/image_similarity.py#L208-L234 | [
"def",
"_load_version",
"(",
"cls",
",",
"state",
",",
"version",
")",
":",
"_tkutl",
".",
"_model_version_check",
"(",
"version",
",",
"cls",
".",
"_PYTHON_IMAGE_SIMILARITY_VERSION",
")",
"from",
"turicreate",
".",
"toolkits",
".",
"nearest_neighbors",
"import",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ImageSimilarityModel.query | For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
----------
dataset : SFrame | SArray | turicreate.Image
Query data.
... | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | def query(self, dataset, label=None, k=5, radius=None, verbose=True, batch_size=64):
"""
For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
... | def query(self, dataset, label=None, k=5, radius=None, verbose=True, batch_size=64):
"""
For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
... | [
"For",
"each",
"image",
"retrieve",
"the",
"nearest",
"neighbors",
"from",
"the",
"model",
"s",
"stored",
"data",
".",
"In",
"general",
"the",
"query",
"dataset",
"does",
"not",
"need",
"to",
"be",
"the",
"same",
"as",
"the",
"reference",
"data",
"stored",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L295-L381 | [
"def",
"query",
"(",
"self",
",",
"dataset",
",",
"label",
"=",
"None",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"if",
"not",
"isinstance",
"(",
"dataset",
",",
"(",
"_tc... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ImageSimilarityModel.similarity_graph | Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your input dataset.
This is conceptually very similar to running `query` with the reference
set, but this method is optimized for the purpos... | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your... | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your... | [
"Construct",
"the",
"similarity",
"graph",
"on",
"the",
"reference",
"dataset",
"which",
"is",
"already",
"stored",
"in",
"the",
"model",
"to",
"find",
"the",
"top",
"k",
"similar",
"images",
"for",
"each",
"image",
"in",
"your",
"input",
"dataset",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L383-L456 | [
"def",
"similarity_graph",
"(",
"self",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"include_self_edges",
"=",
"False",
",",
"output_type",
"=",
"'SGraph'",
",",
"verbose",
"=",
"True",
")",
":",
"return",
"self",
".",
"similarity_model",
".",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ImageSimilarityModel.export_coreml | Save the model in Core ML format.
The exported model calculates the distance between a query image and
each row of the model's stored data. It does not sort and retrieve
the k nearest neighbors of the query image.
See Also
--------
save
Examples
--------... | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | def export_coreml(self, filename):
"""
Save the model in Core ML format.
The exported model calculates the distance between a query image and
each row of the model's stored data. It does not sort and retrieve
the k nearest neighbors of the query image.
See Also
-... | def export_coreml(self, filename):
"""
Save the model in Core ML format.
The exported model calculates the distance between a query image and
each row of the model's stored data. It does not sort and retrieve
the k nearest neighbors of the query image.
See Also
-... | [
"Save",
"the",
"model",
"in",
"Core",
"ML",
"format",
".",
"The",
"exported",
"model",
"calculates",
"the",
"distance",
"between",
"a",
"query",
"image",
"and",
"each",
"row",
"of",
"the",
"model",
"s",
"stored",
"data",
".",
"It",
"does",
"not",
"sort",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L458-L644 | [
"def",
"export_coreml",
"(",
"self",
",",
"filename",
")",
":",
"import",
"numpy",
"as",
"_np",
"import",
"coremltools",
"as",
"_cmt",
"from",
"coremltools",
".",
"models",
"import",
"datatypes",
"as",
"_datatypes",
",",
"neural_network",
"as",
"_neural_network"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | make_graph | Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
:returns: a tuple of (graph, undefined) | src/unity/python/turicreate/meta/asttools/visitors/graph_visitor.py | def make_graph(node, call_deps=False):
'''
Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
... | def make_graph(node, call_deps=False):
'''
Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
... | [
"Create",
"a",
"dependency",
"graph",
"from",
"an",
"ast",
"node",
".",
":",
"param",
"node",
":",
"ast",
"node",
".",
":",
"param",
"call_deps",
":",
"if",
"true",
"then",
"the",
"graph",
"will",
"create",
"a",
"cyclic",
"dependence",
"for",
"all",
"f... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/graph_visitor.py#L393-L407 | [
"def",
"make_graph",
"(",
"node",
",",
"call_deps",
"=",
"False",
")",
":",
"gen",
"=",
"GraphGen",
"(",
"call_deps",
"=",
"call_deps",
")",
"gen",
".",
"visit",
"(",
"node",
")",
"return",
"gen",
".",
"graph",
",",
"gen",
".",
"undefined"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | extract | Extract a code object from a binary pyc file.
:param binary: a sequence of bytes from a pyc file. | src/unity/python/turicreate/meta/bytecodetools/pyc_file.py | def extract(binary):
'''
Extract a code object from a binary pyc file.
:param binary: a sequence of bytes from a pyc file.
'''
if len(binary) <= 8:
raise Exception("Binary pyc must be greater than 8 bytes (got %i)" % len(binary))
magic = binary[:4]
MAGIC = get_magic()
... | def extract(binary):
'''
Extract a code object from a binary pyc file.
:param binary: a sequence of bytes from a pyc file.
'''
if len(binary) <= 8:
raise Exception("Binary pyc must be greater than 8 bytes (got %i)" % len(binary))
magic = binary[:4]
MAGIC = get_magic()
... | [
"Extract",
"a",
"code",
"object",
"from",
"a",
"binary",
"pyc",
"file",
".",
":",
"param",
"binary",
":",
"a",
"sequence",
"of",
"bytes",
"from",
"a",
"pyc",
"file",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/bytecodetools/pyc_file.py#L20-L39 | [
"def",
"extract",
"(",
"binary",
")",
":",
"if",
"len",
"(",
"binary",
")",
"<=",
"8",
":",
"raise",
"Exception",
"(",
"\"Binary pyc must be greater than 8 bytes (got %i)\"",
"%",
"len",
"(",
"binary",
")",
")",
"magic",
"=",
"binary",
"[",
":",
"4",
"]",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _VarintSize | Compute the size of a varint value. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _VarintSize(value):
"""Compute the size of a varint value."""
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <= 0x1ffffffffffff: return 7
if value ... | def _VarintSize(value):
"""Compute the size of a varint value."""
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <= 0x1ffffffffffff: return 7
if value ... | [
"Compute",
"the",
"size",
"of",
"a",
"varint",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L82-L93 | [
"def",
"_VarintSize",
"(",
"value",
")",
":",
"if",
"value",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"value",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"value",
"<=",
"0x1fffff",
":",
"return",
"3",
"if",
"value",
"<=",
"0xfffffff",
":",
"return",
"4... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _SignedVarintSize | Compute the size of a signed varint value. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _SignedVarintSize(value):
"""Compute the size of a signed varint value."""
if value < 0: return 10
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <... | def _SignedVarintSize(value):
"""Compute the size of a signed varint value."""
if value < 0: return 10
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <... | [
"Compute",
"the",
"size",
"of",
"a",
"signed",
"varint",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L96-L108 | [
"def",
"_SignedVarintSize",
"(",
"value",
")",
":",
"if",
"value",
"<",
"0",
":",
"return",
"10",
"if",
"value",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"value",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"value",
"<=",
"0x1fffff",
":",
"return",
"3",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _SimpleSizer | A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _SimpleSizer(compute_value_size):
"""A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize =... | def _SimpleSizer(compute_value_size):
"""A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize =... | [
"A",
"sizer",
"which",
"uses",
"the",
"function",
"compute_value_size",
"to",
"compute",
"the",
"size",
"of",
"each",
"value",
".",
"Typically",
"compute_value_size",
"is",
"_VarintSize",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L126-L152 | [
"def",
"_SimpleSizer",
"(",
"compute_value_size",
")",
":",
"def",
"SpecificSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"if",
"is_packed",
":",
"local_VarintSize",
"=",
"_Var... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _FixedSizer | Like _SimpleSizer except for a fixed-size field. The input is the size
of one value. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _FixedSizer(value_size):
"""Like _SimpleSizer except for a fixed-size field. The input is the size
of one value."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize = _VarintSize
def PackedFieldSize(value):
... | def _FixedSizer(value_size):
"""Like _SimpleSizer except for a fixed-size field. The input is the size
of one value."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize = _VarintSize
def PackedFieldSize(value):
... | [
"Like",
"_SimpleSizer",
"except",
"for",
"a",
"fixed",
"-",
"size",
"field",
".",
"The",
"input",
"is",
"the",
"size",
"of",
"one",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L184-L207 | [
"def",
"_FixedSizer",
"(",
"value_size",
")",
":",
"def",
"SpecificSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"if",
"is_packed",
":",
"local_VarintSize",
"=",
"_VarintSize",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | BytesSizer | Returns a sizer for a bytes field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def BytesSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a bytes field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
local_len = len
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in va... | def BytesSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a bytes field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
local_len = len
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in va... | [
"Returns",
"a",
"sizer",
"for",
"a",
"bytes",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L252-L271 | [
"def",
"BytesSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"local_len",
"=",
"len",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | GroupSizer | Returns a sizer for a group field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | [
"Returns",
"a",
"sizer",
"for",
"a",
"group",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L274-L289 | [
"def",
"GroupSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"*",
"2",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedFieldSize",
"(",
"value",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MessageSizer | Returns a sizer for a message field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def MessageSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a message field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
l... | def MessageSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a message field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
l... | [
"Returns",
"a",
"sizer",
"for",
"a",
"message",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L292-L310 | [
"def",
"MessageSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedField... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MessageSetItemSizer | Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
} | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def MessageSetItemSizer(field_number):
"""Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
static_size = (_TagSize(1) * 2 + _... | def MessageSetItemSizer(field_number):
"""Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
static_size = (_TagSize(1) * 2 + _... | [
"Returns",
"a",
"sizer",
"for",
"extensions",
"of",
"MessageSet",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L317-L336 | [
"def",
"MessageSetItemSizer",
"(",
"field_number",
")",
":",
"static_size",
"=",
"(",
"_TagSize",
"(",
"1",
")",
"*",
"2",
"+",
"_TagSize",
"(",
"2",
")",
"+",
"_VarintSize",
"(",
"field_number",
")",
"+",
"_TagSize",
"(",
"3",
")",
")",
"local_VarintSiz... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MapSizer | Returns a sizer for a map field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def MapSizer(field_descriptor, is_message_map):
"""Returns a sizer for a map field."""
# Can't look at field_descriptor.message_type._concrete_class because it may
# not have been initialized yet.
message_type = field_descriptor.message_type
message_sizer = MessageSizer(field_descriptor.number, False, False)... | def MapSizer(field_descriptor, is_message_map):
"""Returns a sizer for a map field."""
# Can't look at field_descriptor.message_type._concrete_class because it may
# not have been initialized yet.
message_type = field_descriptor.message_type
message_sizer = MessageSizer(field_descriptor.number, False, False)... | [
"Returns",
"a",
"sizer",
"for",
"a",
"map",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L343-L366 | [
"def",
"MapSizer",
"(",
"field_descriptor",
",",
"is_message_map",
")",
":",
"# Can't look at field_descriptor.message_type._concrete_class because it may",
"# not have been initialized yet.",
"message_type",
"=",
"field_descriptor",
".",
"message_type",
"message_sizer",
"=",
"Mess... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _VarintEncoder | Return an encoder for a basic varint value (does not include tag). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
def EncodeVarint(write, value):
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
value >>= 7
return write(six.int2byte(bits))
return Enc... | def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
def EncodeVarint(write, value):
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
value >>= 7
return write(six.int2byte(bits))
return Enc... | [
"Return",
"an",
"encoder",
"for",
"a",
"basic",
"varint",
"value",
"(",
"does",
"not",
"include",
"tag",
")",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L372-L384 | [
"def",
"_VarintEncoder",
"(",
")",
":",
"def",
"EncodeVarint",
"(",
"write",
",",
"value",
")",
":",
"bits",
"=",
"value",
"&",
"0x7f",
"value",
">>=",
"7",
"while",
"value",
":",
"write",
"(",
"six",
".",
"int2byte",
"(",
"0x80",
"|",
"bits",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _SignedVarintEncoder | Return an encoder for a basic signed varint value (does not include
tag). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
def EncodeSignedVarint(write, value):
if value < 0:
value += (1 << 64)
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
... | def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
def EncodeSignedVarint(write, value):
if value < 0:
value += (1 << 64)
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
... | [
"Return",
"an",
"encoder",
"for",
"a",
"basic",
"signed",
"varint",
"value",
"(",
"does",
"not",
"include",
"tag",
")",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L387-L402 | [
"def",
"_SignedVarintEncoder",
"(",
")",
":",
"def",
"EncodeSignedVarint",
"(",
"write",
",",
"value",
")",
":",
"if",
"value",
"<",
"0",
":",
"value",
"+=",
"(",
"1",
"<<",
"64",
")",
"bits",
"=",
"value",
"&",
"0x7f",
"value",
">>=",
"7",
"while",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _VarintBytes | Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return b"".join(pieces) | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return b"".join(pieces) | [
"Encode",
"the",
"given",
"integer",
"as",
"a",
"varint",
"and",
"return",
"the",
"bytes",
".",
"This",
"is",
"only",
"called",
"at",
"startup",
"time",
"so",
"it",
"doesn",
"t",
"need",
"to",
"be",
"fast",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L409-L415 | [
"def",
"_VarintBytes",
"(",
"value",
")",
":",
"pieces",
"=",
"[",
"]",
"_EncodeVarint",
"(",
"pieces",
".",
"append",
",",
"value",
")",
"return",
"b\"\"",
".",
"join",
"(",
"pieces",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _SimpleEncoder | Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_value_size: A function which computes the size of an individual
... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _SimpleEncoder(wire_type, encode_value, compute_value_size):
"""Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_v... | def _SimpleEncoder(wire_type, encode_value, compute_value_size):
"""Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_v... | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"fields",
"of",
"a",
"particular",
"type",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L428-L466 | [
"def",
"_SimpleEncoder",
"(",
"wire_type",
",",
"encode_value",
",",
"compute_value_size",
")",
":",
"def",
"SpecificEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"if",
"is_packed",
":",
"tag_bytes",
"=",
"TagBytes",
"(",
"field_... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _StructPackEncoder | Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack(). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _StructPackEncoder(wire_type, format):
"""Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack().
"""
value_size = struct.calcsize(format)
def SpecificEncoder(field_number, ... | def _StructPackEncoder(wire_type, format):
"""Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack().
"""
value_size = struct.calcsize(format)
def SpecificEncoder(field_number, ... | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"a",
"fixed",
"-",
"width",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L503-L538 | [
"def",
"_StructPackEncoder",
"(",
"wire_type",
",",
"format",
")",
":",
"value_size",
"=",
"struct",
".",
"calcsize",
"(",
"format",
")",
"def",
"SpecificEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"local_struct_pack",
"=",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _FloatingPointEncoder | Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The field's wire type, for encoding tags.
format... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def _FloatingPointEncoder(wire_type, format):
"""Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The... | def _FloatingPointEncoder(wire_type, format):
"""Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The... | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"float",
"fields",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L541-L615 | [
"def",
"_FloatingPointEncoder",
"(",
"wire_type",
",",
"format",
")",
":",
"value_size",
"=",
"struct",
".",
"calcsize",
"(",
"format",
")",
"if",
"value_size",
"==",
"4",
":",
"def",
"EncodeNonFiniteOrRaise",
"(",
"write",
",",
"value",
")",
":",
"# Remembe... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | BoolEncoder | Returns an encoder for a boolean field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def BoolEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a boolean field."""
false_byte = b'\x00'
true_byte = b'\x01'
if is_packed:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
def EncodePackedField(write, value... | def BoolEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a boolean field."""
false_byte = b'\x00'
true_byte = b'\x01'
if is_packed:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
def EncodePackedField(write, value... | [
"Returns",
"an",
"encoder",
"for",
"a",
"boolean",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L645-L679 | [
"def",
"BoolEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"false_byte",
"=",
"b'\\x00'",
"true_byte",
"=",
"b'\\x01'",
"if",
"is_packed",
":",
"tag_bytes",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | StringEncoder | Returns an encoder for a string field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def StringEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a string field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
local_len = len
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
... | def StringEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a string field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
local_len = len
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
... | [
"Returns",
"an",
"encoder",
"for",
"a",
"string",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L682-L703 | [
"def",
"StringEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
"local_EncodeVarint",
"=",
"_EncodeVarint",
"local_len",
"=",
"len",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | GroupEncoder | Returns an encoder for a group field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | [
"Returns",
"an",
"encoder",
"for",
"a",
"group",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L728-L746 | [
"def",
"GroupEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"start_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
"end_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MessageEncoder | Returns an encoder for a message field. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def MessageEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a message field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
for element in v... | def MessageEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a message field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
for element in v... | [
"Returns",
"an",
"encoder",
"for",
"a",
"message",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L749-L767 | [
"def",
"MessageEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
"local_EncodeVarint",
"=",
"_EncodeVarint",
"assert",
"not",
"is_pac... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MessageSetItemEncoder | Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
} | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def MessageSetItemEncoder(field_number):
"""Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
start_bytes = b"".join([
TagBytes(... | def MessageSetItemEncoder(field_number):
"""Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
start_bytes = b"".join([
TagBytes(... | [
"Encoder",
"for",
"extensions",
"of",
"MessageSet",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L774-L799 | [
"def",
"MessageSetItemEncoder",
"(",
"field_number",
")",
":",
"start_bytes",
"=",
"b\"\"",
".",
"join",
"(",
"[",
"TagBytes",
"(",
"1",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
",",
"TagBytes",
"(",
"2",
",",
"wire_format",
".",
"WIRETYPE_VARINT"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MapEncoder | Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N; | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | def MapEncoder(field_descriptor):
"""Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N;
"""
# Can't look at field_descriptor.message_type._concrete_class because it may
... | def MapEncoder(field_descriptor):
"""Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N;
"""
# Can't look at field_descriptor.message_type._concrete_class because it may
... | [
"Encoder",
"for",
"extensions",
"of",
"MessageSet",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L806-L826 | [
"def",
"MapEncoder",
"(",
"field_descriptor",
")",
":",
"# Can't look at field_descriptor.message_type._concrete_class because it may",
"# not have been initialized yet.",
"message_type",
"=",
"field_descriptor",
".",
"message_type",
"encode_message",
"=",
"MessageEncoder",
"(",
"f... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a Caffe model to Core ML format.
Parameters
----------
model: str | (str, str) | (str, str, str) | (str, str, dict)
A trained Caffe neural network model which can be represented as:
- Path on disk to a trained Caffe model (.caffemodel)
- A tuple of two paths, where the fir... | src/external/coremltools_wrap/coremltools/coremltools/converters/caffe/_caffe_converter.py | def convert(model, image_input_names=[], is_bgr=False,
red_bias=0.0, blue_bias=0.0, green_bias=0.0, gray_bias=0.0,
image_scale=1.0, class_labels=None, predicted_feature_name=None, model_precision=_MLMODEL_FULL_PRECISION):
"""
Convert a Caffe model to Core ML format.
Parameters
-... | def convert(model, image_input_names=[], is_bgr=False,
red_bias=0.0, blue_bias=0.0, green_bias=0.0, gray_bias=0.0,
image_scale=1.0, class_labels=None, predicted_feature_name=None, model_precision=_MLMODEL_FULL_PRECISION):
"""
Convert a Caffe model to Core ML format.
Parameters
-... | [
"Convert",
"a",
"Caffe",
"model",
"to",
"Core",
"ML",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/caffe/_caffe_converter.py#L10-L197 | [
"def",
"convert",
"(",
"model",
",",
"image_input_names",
"=",
"[",
"]",
",",
"is_bgr",
"=",
"False",
",",
"red_bias",
"=",
"0.0",
",",
"blue_bias",
"=",
"0.0",
",",
"green_bias",
"=",
"0.0",
",",
"gray_bias",
"=",
"0.0",
",",
"image_scale",
"=",
"1.0"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _set_kernel | Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model. | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_svm_common.py | def _set_kernel(model, spec):
"""
Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model.
"""
def gamma_value(model):
if(model.gamma == 'auto'):
# auto gamma value is 1/num_features
return 1/float(len(model.support_vectors_[0]))
e... | def _set_kernel(model, spec):
"""
Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model.
"""
def gamma_value(model):
if(model.gamma == 'auto'):
# auto gamma value is 1/num_features
return 1/float(len(model.support_vectors_[0]))
e... | [
"Takes",
"the",
"sklearn",
"SVM",
"model",
"and",
"returns",
"the",
"spec",
"with",
"the",
"protobuf",
"kernel",
"for",
"that",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_svm_common.py#L11-L37 | [
"def",
"_set_kernel",
"(",
"model",
",",
"spec",
")",
":",
"def",
"gamma_value",
"(",
"model",
")",
":",
"if",
"(",
"model",
".",
"gamma",
"==",
"'auto'",
")",
":",
"# auto gamma value is 1/num_features",
"return",
"1",
"/",
"float",
"(",
"len",
"(",
"mo... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SFrameBuilder.append | Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
segment : int
The segment to write this... | src/unity/python/turicreate/data_structures/sframe_builder.py | def append(self, data, segment=0):
"""
Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
... | def append(self, data, segment=0):
"""
Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
... | [
"Append",
"a",
"single",
"row",
"to",
"an",
"SFrame",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe_builder.py#L108-L129 | [
"def",
"append",
"(",
"self",
",",
"data",
",",
"segment",
"=",
"0",
")",
":",
"# Assume this case refers to an SFrame with a single column",
"if",
"not",
"hasattr",
"(",
"data",
",",
"'__iter__'",
")",
":",
"data",
"=",
"[",
"data",
"]",
"self",
".",
"_buil... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SFrameBuilder.append_multiple | Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iterables, each representing a single row.
segment : int
... | src/unity/python/turicreate/data_structures/sframe_builder.py | def append_multiple(self, data, segment=0):
"""
Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iter... | def append_multiple(self, data, segment=0):
"""
Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iter... | [
"Append",
"multiple",
"rows",
"to",
"an",
"SFrame",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe_builder.py#L131-L166 | [
"def",
"append_multiple",
"(",
"self",
",",
"data",
",",
"segment",
"=",
"0",
")",
":",
"if",
"not",
"hasattr",
"(",
"data",
",",
"'__iter__'",
")",
":",
"raise",
"TypeError",
"(",
"\"append_multiple must be passed an iterable object\"",
")",
"tmp_list",
"=",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | InstallTargetClass.update_location | If <location> is not set, sets it based on the project data. | deps/src/boost_1_68_0/tools/build/src/tools/stage.py | def update_location(self, ps):
"""If <location> is not set, sets it based on the project data."""
loc = ps.get('location')
if not loc:
loc = os.path.join(self.project().get('location'), self.name())
ps = ps.add_raw(["<location>" + loc])
return ps | def update_location(self, ps):
"""If <location> is not set, sets it based on the project data."""
loc = ps.get('location')
if not loc:
loc = os.path.join(self.project().get('location'), self.name())
ps = ps.add_raw(["<location>" + loc])
return ps | [
"If",
"<location",
">",
"is",
"not",
"set",
"sets",
"it",
"based",
"on",
"the",
"project",
"data",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/stage.py#L41-L49 | [
"def",
"update_location",
"(",
"self",
",",
"ps",
")",
":",
"loc",
"=",
"ps",
".",
"get",
"(",
"'location'",
")",
"if",
"not",
"loc",
":",
"loc",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"project",
"(",
")",
".",
"get",
"(",
"'loc... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | InstallTargetClass.targets_to_stage | Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged. | deps/src/boost_1_68_0/tools/build/src/tools/stage.py | def targets_to_stage(self, source_targets, ps):
"""Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged."""
result = []
# Traverse the dependencies, if needed.
if ps.get('install-dependencies') == ['on']:
so... | def targets_to_stage(self, source_targets, ps):
"""Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged."""
result = []
# Traverse the dependencies, if needed.
if ps.get('install-dependencies') == ['on']:
so... | [
"Given",
"the",
"list",
"of",
"source",
"targets",
"explicitly",
"passed",
"to",
"stage",
"returns",
"the",
"list",
"of",
"targets",
"which",
"must",
"be",
"staged",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/stage.py#L139-L166 | [
"def",
"targets_to_stage",
"(",
"self",
",",
"source_targets",
",",
"ps",
")",
":",
"result",
"=",
"[",
"]",
"# Traverse the dependencies, if needed.",
"if",
"ps",
".",
"get",
"(",
"'install-dependencies'",
")",
"==",
"[",
"'on'",
"]",
":",
"source_targets",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | init_logger | Initialize the logging configuration for the turicreate package.
This does not affect the root logging config. | src/unity/python/turicreate/config/__init__.py | def init_logger():
"""
Initialize the logging configuration for the turicreate package.
This does not affect the root logging config.
"""
import logging as _logging
import logging.config
# Package level logger
_logging.config.dictConfig({
'version': 1,
'disable_existing... | def init_logger():
"""
Initialize the logging configuration for the turicreate package.
This does not affect the root logging config.
"""
import logging as _logging
import logging.config
# Package level logger
_logging.config.dictConfig({
'version': 1,
'disable_existing... | [
"Initialize",
"the",
"logging",
"configuration",
"for",
"the",
"turicreate",
"package",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L34-L81 | [
"def",
"init_logger",
"(",
")",
":",
"import",
"logging",
"as",
"_logging",
"import",
"logging",
".",
"config",
"# Package level logger",
"_logging",
".",
"config",
".",
"dictConfig",
"(",
"{",
"'version'",
":",
"1",
",",
"'disable_existing_loggers'",
":",
"Fals... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_environment_config | Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum number of threads to use for parallel proce... | src/unity/python/turicreate/config/__init__.py | def get_environment_config():
"""
Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum n... | def get_environment_config():
"""
Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum n... | [
"Returns",
"all",
"the",
"Turi",
"Create",
"configuration",
"variables",
"that",
"can",
"only",
"be",
"set",
"via",
"environment",
"variables",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L145-L160 | [
"def",
"get_environment_config",
"(",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"list_globals",
"(",
"False",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | set_log_level | Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged. | src/unity/python/turicreate/config/__init__.py | def set_log_level(level):
"""
Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged.
"""
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
return unity.set_log_level(level) | def set_log_level(level):
"""
Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged.
"""
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
return unity.set_log_level(level) | [
"Sets",
"the",
"log",
"level",
".",
"Lower",
"log",
"levels",
"log",
"more",
".",
"if",
"level",
"is",
"8",
"nothing",
"is",
"logged",
".",
"If",
"level",
"is",
"0",
"everything",
"is",
"logged",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L162-L170 | [
"def",
"set_log_level",
"(",
"level",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"set_log_level",
"(",
"level",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_runtime_config | Returns all the Turi Create configuration variables that can be set
at runtime. See :py:func:`turicreate.config.set_runtime_config()` to set these
values and for documentation on the effect of each variable.
Returns
-------
Returns a dictionary of {key:value,..}
See Also
--------
set_r... | src/unity/python/turicreate/config/__init__.py | def get_runtime_config():
"""
Returns all the Turi Create configuration variables that can be set
at runtime. See :py:func:`turicreate.config.set_runtime_config()` to set these
values and for documentation on the effect of each variable.
Returns
-------
Returns a dictionary of {key:value,..... | def get_runtime_config():
"""
Returns all the Turi Create configuration variables that can be set
at runtime. See :py:func:`turicreate.config.set_runtime_config()` to set these
values and for documentation on the effect of each variable.
Returns
-------
Returns a dictionary of {key:value,..... | [
"Returns",
"all",
"the",
"Turi",
"Create",
"configuration",
"variables",
"that",
"can",
"be",
"set",
"at",
"runtime",
".",
"See",
":",
"py",
":",
"func",
":",
"turicreate",
".",
"config",
".",
"set_runtime_config",
"()",
"to",
"set",
"these",
"values",
"an... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L173-L189 | [
"def",
"get_runtime_config",
"(",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"list_globals",
"(",
"True",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | set_runtime_config | Configures system behavior at runtime. These configuration values are also
read from environment variables at program startup if available. See
:py:func:`turicreate.config.get_runtime_config()` to get the current values for
each variable.
Note that defaults may change across versions and the names
... | src/unity/python/turicreate/config/__init__.py | def set_runtime_config(name, value):
"""
Configures system behavior at runtime. These configuration values are also
read from environment variables at program startup if available. See
:py:func:`turicreate.config.get_runtime_config()` to get the current values for
each variable.
Note that defau... | def set_runtime_config(name, value):
"""
Configures system behavior at runtime. These configuration values are also
read from environment variables at program startup if available. See
:py:func:`turicreate.config.get_runtime_config()` to get the current values for
each variable.
Note that defau... | [
"Configures",
"system",
"behavior",
"at",
"runtime",
".",
"These",
"configuration",
"values",
"are",
"also",
"read",
"from",
"environment",
"variables",
"at",
"program",
"startup",
"if",
"available",
".",
"See",
":",
"py",
":",
"func",
":",
"turicreate",
".",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L191-L306 | [
"def",
"set_runtime_config",
"(",
"name",
",",
"value",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"ret",
"=",
"unity",
".",
"set_global",
"(",
"name",
",",
"value... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | load_sgraph | Load SGraph from text file or previously saved SGraph binary.
Parameters
----------
filename : string
Location of the file. Can be a local path or a remote URL.
format : {'binary', 'snap', 'csv', 'tsv'}, optional
Format to of the file to load.
- 'binary': native graph format o... | src/unity/python/turicreate/data_structures/sgraph.py | def load_sgraph(filename, format='binary', delimiter='auto'):
"""
Load SGraph from text file or previously saved SGraph binary.
Parameters
----------
filename : string
Location of the file. Can be a local path or a remote URL.
format : {'binary', 'snap', 'csv', 'tsv'}, optional
... | def load_sgraph(filename, format='binary', delimiter='auto'):
"""
Load SGraph from text file or previously saved SGraph binary.
Parameters
----------
filename : string
Location of the file. Can be a local path or a remote URL.
format : {'binary', 'snap', 'csv', 'tsv'}, optional
... | [
"Load",
"SGraph",
"from",
"text",
"file",
"or",
"previously",
"saved",
"SGraph",
"binary",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1153-L1221 | [
"def",
"load_sgraph",
"(",
"filename",
",",
"format",
"=",
"'binary'",
",",
"delimiter",
"=",
"'auto'",
")",
":",
"if",
"not",
"format",
"in",
"[",
"'binary'",
",",
"'snap'",
",",
"'csv'",
",",
"'tsv'",
"]",
":",
"raise",
"ValueError",
"(",
"'Invalid for... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _vertex_list_to_dataframe | Convert a list of vertices into dataframe. | src/unity/python/turicreate/data_structures/sgraph.py | def _vertex_list_to_dataframe(ls, id_column_name):
"""
Convert a list of vertices into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
df = pd.DataFrame({id_column_name: [v.... | def _vertex_list_to_dataframe(ls, id_column_name):
"""
Convert a list of vertices into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
df = pd.DataFrame({id_column_name: [v.... | [
"Convert",
"a",
"list",
"of",
"vertices",
"into",
"dataframe",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1229-L1238 | [
"def",
"_vertex_list_to_dataframe",
"(",
"ls",
",",
"id_column_name",
")",
":",
"assert",
"HAS_PANDAS",
",",
"'Cannot use dataframe because Pandas is not available or version is too low.'",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
"set",
"(",
"v",
".... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _vertex_list_to_sframe | Convert a list of vertices into an SFrame. | src/unity/python/turicreate/data_structures/sgraph.py | def _vertex_list_to_sframe(ls, id_column_name):
"""
Convert a list of vertices into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[id_column_name] = [v.vid for v in ls]
for c in cols:
sf[c] = [v.att... | def _vertex_list_to_sframe(ls, id_column_name):
"""
Convert a list of vertices into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[id_column_name] = [v.vid for v in ls]
for c in cols:
sf[c] = [v.att... | [
"Convert",
"a",
"list",
"of",
"vertices",
"into",
"an",
"SFrame",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1240-L1260 | [
"def",
"_vertex_list_to_sframe",
"(",
"ls",
",",
"id_column_name",
")",
":",
"sf",
"=",
"SFrame",
"(",
")",
"if",
"type",
"(",
"ls",
")",
"==",
"list",
":",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
"set",
"(",
"v",
".",
"attr",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _edge_list_to_dataframe | Convert a list of edges into dataframe. | src/unity/python/turicreate/data_structures/sgraph.py | def _edge_list_to_dataframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(e.attr.keys()) for e in ls))
df = pd.DataFrame({
... | def _edge_list_to_dataframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(e.attr.keys()) for e in ls))
df = pd.DataFrame({
... | [
"Convert",
"a",
"list",
"of",
"edges",
"into",
"dataframe",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1262-L1273 | [
"def",
"_edge_list_to_dataframe",
"(",
"ls",
",",
"src_column_name",
",",
"dst_column_name",
")",
":",
"assert",
"HAS_PANDAS",
",",
"'Cannot use dataframe because Pandas is not available or version is too low.'",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _edge_list_to_sframe | Convert a list of edges into an SFrame. | src/unity/python/turicreate/data_structures/sgraph.py | def _edge_list_to_sframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[src_column_name] = [e.src_vid for e in ls]
sf[dst_column_name] = [... | def _edge_list_to_sframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[src_column_name] = [e.src_vid for e in ls]
sf[dst_column_name] = [... | [
"Convert",
"a",
"list",
"of",
"edges",
"into",
"an",
"SFrame",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1275-L1295 | [
"def",
"_edge_list_to_sframe",
"(",
"ls",
",",
"src_column_name",
",",
"dst_column_name",
")",
":",
"sf",
"=",
"SFrame",
"(",
")",
"if",
"type",
"(",
"ls",
")",
"==",
"list",
":",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
"set",
"(",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _dataframe_to_vertex_list | Convert dataframe into list of vertices, assuming that vertex ids are stored in _VID_COLUMN. | src/unity/python/turicreate/data_structures/sgraph.py | def _dataframe_to_vertex_list(df):
"""
Convert dataframe into list of vertices, assuming that vertex ids are stored in _VID_COLUMN.
"""
cols = df.columns
if len(cols):
assert _VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _VID_COLUMN
df = df[cols].T
ret = [V... | def _dataframe_to_vertex_list(df):
"""
Convert dataframe into list of vertices, assuming that vertex ids are stored in _VID_COLUMN.
"""
cols = df.columns
if len(cols):
assert _VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _VID_COLUMN
df = df[cols].T
ret = [V... | [
"Convert",
"dataframe",
"into",
"list",
"of",
"vertices",
"assuming",
"that",
"vertex",
"ids",
"are",
"stored",
"in",
"_VID_COLUMN",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1297-L1308 | [
"def",
"_dataframe_to_vertex_list",
"(",
"df",
")",
":",
"cols",
"=",
"df",
".",
"columns",
"if",
"len",
"(",
"cols",
")",
":",
"assert",
"_VID_COLUMN",
"in",
"cols",
",",
"\"Vertex DataFrame must contain column %s\"",
"%",
"_VID_COLUMN",
"df",
"=",
"df",
"[",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _dataframe_to_edge_list | Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively. | src/unity/python/turicreate/data_structures/sgraph.py | def _dataframe_to_edge_list(df):
"""
Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively.
"""
cols = df.columns
if len(cols):
assert _SRC_VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _SRC... | def _dataframe_to_edge_list(df):
"""
Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively.
"""
cols = df.columns
if len(cols):
assert _SRC_VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _SRC... | [
"Convert",
"dataframe",
"into",
"list",
"of",
"edges",
"assuming",
"that",
"source",
"and",
"target",
"ids",
"are",
"stored",
"in",
"_SRC_VID_COLUMN",
"and",
"_DST_VID_COLUMN",
"respectively",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1311-L1323 | [
"def",
"_dataframe_to_edge_list",
"(",
"df",
")",
":",
"cols",
"=",
"df",
".",
"columns",
"if",
"len",
"(",
"cols",
")",
":",
"assert",
"_SRC_VID_COLUMN",
"in",
"cols",
",",
"\"Vertex DataFrame must contain column %s\"",
"%",
"_SRC_VID_COLUMN",
"assert",
"_DST_VID... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _vertex_data_to_sframe | Convert data into a vertex data sframe. Using vid_field to identify the id
column. The returned sframe will have id column name '__id'. | src/unity/python/turicreate/data_structures/sgraph.py | def _vertex_data_to_sframe(data, vid_field):
"""
Convert data into a vertex data sframe. Using vid_field to identify the id
column. The returned sframe will have id column name '__id'.
"""
if isinstance(data, SFrame):
# '__id' already in the sframe, and it is ok to not specify vid_field
... | def _vertex_data_to_sframe(data, vid_field):
"""
Convert data into a vertex data sframe. Using vid_field to identify the id
column. The returned sframe will have id column name '__id'.
"""
if isinstance(data, SFrame):
# '__id' already in the sframe, and it is ok to not specify vid_field
... | [
"Convert",
"data",
"into",
"a",
"vertex",
"data",
"sframe",
".",
"Using",
"vid_field",
"to",
"identify",
"the",
"id",
"column",
".",
"The",
"returned",
"sframe",
"will",
"have",
"id",
"column",
"name",
"__id",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1326-L1368 | [
"def",
"_vertex_data_to_sframe",
"(",
"data",
",",
"vid_field",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"SFrame",
")",
":",
"# '__id' already in the sframe, and it is ok to not specify vid_field",
"if",
"vid_field",
"is",
"None",
"and",
"_VID_COLUMN",
"in",
"d... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _edge_data_to_sframe | Convert data into an edge data sframe. Using src_field and dst_field to
identify the source and target id column. The returned sframe will have id
column name '__src_id', '__dst_id' | src/unity/python/turicreate/data_structures/sgraph.py | def _edge_data_to_sframe(data, src_field, dst_field):
"""
Convert data into an edge data sframe. Using src_field and dst_field to
identify the source and target id column. The returned sframe will have id
column name '__src_id', '__dst_id'
"""
if isinstance(data, SFrame):
# '__src_vid' a... | def _edge_data_to_sframe(data, src_field, dst_field):
"""
Convert data into an edge data sframe. Using src_field and dst_field to
identify the source and target id column. The returned sframe will have id
column name '__src_id', '__dst_id'
"""
if isinstance(data, SFrame):
# '__src_vid' a... | [
"Convert",
"data",
"into",
"an",
"edge",
"data",
"sframe",
".",
"Using",
"src_field",
"and",
"dst_field",
"to",
"identify",
"the",
"source",
"and",
"target",
"id",
"column",
".",
"The",
"returned",
"sframe",
"will",
"have",
"id",
"column",
"name",
"__src_id"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1371-L1424 | [
"def",
"_edge_data_to_sframe",
"(",
"data",
",",
"src_field",
",",
"dst_field",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"SFrame",
")",
":",
"# '__src_vid' and '__dst_vid' already in the sframe, and",
"# it is ok to not specify src_field and dst_field",
"if",
"src_fi... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.get_vertices | get_vertices(self, ids=list(), fields={}, format='sframe')
Return a collection of vertices and their attributes.
Parameters
----------
ids : list [int | float | str] or SArray
List of vertex IDs to retrieve. Only vertices in this list will be
returned. Also acce... | src/unity/python/turicreate/data_structures/sgraph.py | def get_vertices(self, ids=[], fields={}, format='sframe'):
"""
get_vertices(self, ids=list(), fields={}, format='sframe')
Return a collection of vertices and their attributes.
Parameters
----------
ids : list [int | float | str] or SArray
List of vertex IDs... | def get_vertices(self, ids=[], fields={}, format='sframe'):
"""
get_vertices(self, ids=list(), fields={}, format='sframe')
Return a collection of vertices and their attributes.
Parameters
----------
ids : list [int | float | str] or SArray
List of vertex IDs... | [
"get_vertices",
"(",
"self",
"ids",
"=",
"list",
"()",
"fields",
"=",
"{}",
"format",
"=",
"sframe",
")",
"Return",
"a",
"collection",
"of",
"vertices",
"and",
"their",
"attributes",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L387-L478 | [
"def",
"get_vertices",
"(",
"self",
",",
"ids",
"=",
"[",
"]",
",",
"fields",
"=",
"{",
"}",
",",
"format",
"=",
"'sframe'",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"ids",
")",
":",
"ids",
"=",
"[",
"ids",
"]",
"if",
"type",
"(",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.get_edges | get_edges(self, src_ids=list(), dst_ids=list(), fields={}, format='sframe')
Return a collection of edges and their attributes. This function is used
to find edges by vertex IDs, filter on edge attributes, or list in-out
neighbors of vertex sets.
Parameters
----------
src... | src/unity/python/turicreate/data_structures/sgraph.py | def get_edges(self, src_ids=[], dst_ids=[], fields={}, format='sframe'):
"""
get_edges(self, src_ids=list(), dst_ids=list(), fields={}, format='sframe')
Return a collection of edges and their attributes. This function is used
to find edges by vertex IDs, filter on edge attributes, or lis... | def get_edges(self, src_ids=[], dst_ids=[], fields={}, format='sframe'):
"""
get_edges(self, src_ids=list(), dst_ids=list(), fields={}, format='sframe')
Return a collection of edges and their attributes. This function is used
to find edges by vertex IDs, filter on edge attributes, or lis... | [
"get_edges",
"(",
"self",
"src_ids",
"=",
"list",
"()",
"dst_ids",
"=",
"list",
"()",
"fields",
"=",
"{}",
"format",
"=",
"sframe",
")",
"Return",
"a",
"collection",
"of",
"edges",
"and",
"their",
"attributes",
".",
"This",
"function",
"is",
"used",
"to"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L480-L587 | [
"def",
"get_edges",
"(",
"self",
",",
"src_ids",
"=",
"[",
"]",
",",
"dst_ids",
"=",
"[",
"]",
",",
"fields",
"=",
"{",
"}",
",",
"format",
"=",
"'sframe'",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"src_ids",
")",
":",
"src_ids",
"=",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.add_vertices | Add vertices to the SGraph. Vertices should be input as a list of
:class:`~turicreate.Vertex` objects, an :class:`~turicreate.SFrame`, or a
pandas DataFrame. If vertices are specified by SFrame or DataFrame,
``vid_field`` specifies which column contains the vertex ID. Remaining
columns a... | src/unity/python/turicreate/data_structures/sgraph.py | def add_vertices(self, vertices, vid_field=None):
"""
Add vertices to the SGraph. Vertices should be input as a list of
:class:`~turicreate.Vertex` objects, an :class:`~turicreate.SFrame`, or a
pandas DataFrame. If vertices are specified by SFrame or DataFrame,
``vid_field`` spec... | def add_vertices(self, vertices, vid_field=None):
"""
Add vertices to the SGraph. Vertices should be input as a list of
:class:`~turicreate.Vertex` objects, an :class:`~turicreate.SFrame`, or a
pandas DataFrame. If vertices are specified by SFrame or DataFrame,
``vid_field`` spec... | [
"Add",
"vertices",
"to",
"the",
"SGraph",
".",
"Vertices",
"should",
"be",
"input",
"as",
"a",
"list",
"of",
":",
"class",
":",
"~turicreate",
".",
"Vertex",
"objects",
"an",
":",
"class",
":",
"~turicreate",
".",
"SFrame",
"or",
"a",
"pandas",
"DataFram... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L589-L652 | [
"def",
"add_vertices",
"(",
"self",
",",
"vertices",
",",
"vid_field",
"=",
"None",
")",
":",
"sf",
"=",
"_vertex_data_to_sframe",
"(",
"vertices",
",",
"vid_field",
")",
"with",
"cython_context",
"(",
")",
":",
"proxy",
"=",
"self",
".",
"__proxy__",
".",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.add_edges | Add edges to the SGraph. Edges should be input as a list of
:class:`~turicreate.Edge` objects, an :class:`~turicreate.SFrame`, or a
Pandas DataFrame. If the new edges are in an SFrame or DataFrame, then
``src_field`` and ``dst_field`` are required to specify the columns that
contain the ... | src/unity/python/turicreate/data_structures/sgraph.py | def add_edges(self, edges, src_field=None, dst_field=None):
"""
Add edges to the SGraph. Edges should be input as a list of
:class:`~turicreate.Edge` objects, an :class:`~turicreate.SFrame`, or a
Pandas DataFrame. If the new edges are in an SFrame or DataFrame, then
``src_field``... | def add_edges(self, edges, src_field=None, dst_field=None):
"""
Add edges to the SGraph. Edges should be input as a list of
:class:`~turicreate.Edge` objects, an :class:`~turicreate.SFrame`, or a
Pandas DataFrame. If the new edges are in an SFrame or DataFrame, then
``src_field``... | [
"Add",
"edges",
"to",
"the",
"SGraph",
".",
"Edges",
"should",
"be",
"input",
"as",
"a",
"list",
"of",
":",
"class",
":",
"~turicreate",
".",
"Edge",
"objects",
"an",
":",
"class",
":",
"~turicreate",
".",
"SFrame",
"or",
"a",
"Pandas",
"DataFrame",
".... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L654-L724 | [
"def",
"add_edges",
"(",
"self",
",",
"edges",
",",
"src_field",
"=",
"None",
",",
"dst_field",
"=",
"None",
")",
":",
"sf",
"=",
"_edge_data_to_sframe",
"(",
"edges",
",",
"src_field",
",",
"dst_field",
")",
"with",
"cython_context",
"(",
")",
":",
"pro... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.select_fields | Return a new SGraph with only the selected fields. Other fields are
discarded, while fields that do not exist in the SGraph are ignored.
Parameters
----------
fields : string | list [string]
A single field name or a list of field names to select.
Returns
---... | src/unity/python/turicreate/data_structures/sgraph.py | def select_fields(self, fields):
"""
Return a new SGraph with only the selected fields. Other fields are
discarded, while fields that do not exist in the SGraph are ignored.
Parameters
----------
fields : string | list [string]
A single field name or a list o... | def select_fields(self, fields):
"""
Return a new SGraph with only the selected fields. Other fields are
discarded, while fields that do not exist in the SGraph are ignored.
Parameters
----------
fields : string | list [string]
A single field name or a list o... | [
"Return",
"a",
"new",
"SGraph",
"with",
"only",
"the",
"selected",
"fields",
".",
"Other",
"fields",
"are",
"discarded",
"while",
"fields",
"that",
"do",
"not",
"exist",
"in",
"the",
"SGraph",
"are",
"ignored",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L811-L866 | [
"def",
"select_fields",
"(",
"self",
",",
"fields",
")",
":",
"if",
"(",
"type",
"(",
"fields",
")",
"is",
"str",
")",
":",
"fields",
"=",
"[",
"fields",
"]",
"if",
"not",
"isinstance",
"(",
"fields",
",",
"list",
")",
"or",
"not",
"all",
"(",
"t... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.triple_apply | Apply a transform function to each edge and its associated source and
target vertices in parallel. Each edge is visited once and in parallel.
Modification to vertex data is protected by lock. The effect on the
returned SGraph is equivalent to the following pseudocode:
>>> PARALLEL FOR (... | src/unity/python/turicreate/data_structures/sgraph.py | def triple_apply(self, triple_apply_fn, mutated_fields, input_fields=None):
'''
Apply a transform function to each edge and its associated source and
target vertices in parallel. Each edge is visited once and in parallel.
Modification to vertex data is protected by lock. The effect on th... | def triple_apply(self, triple_apply_fn, mutated_fields, input_fields=None):
'''
Apply a transform function to each edge and its associated source and
target vertices in parallel. Each edge is visited once and in parallel.
Modification to vertex data is protected by lock. The effect on th... | [
"Apply",
"a",
"transform",
"function",
"to",
"each",
"edge",
"and",
"its",
"associated",
"source",
"and",
"target",
"vertices",
"in",
"parallel",
".",
"Each",
"edge",
"is",
"visited",
"once",
"and",
"in",
"parallel",
".",
"Modification",
"to",
"vertex",
"dat... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L868-L1012 | [
"def",
"triple_apply",
"(",
"self",
",",
"triple_apply_fn",
",",
"mutated_fields",
",",
"input_fields",
"=",
"None",
")",
":",
"assert",
"inspect",
".",
"isfunction",
"(",
"triple_apply_fn",
")",
",",
"\"Input must be a function\"",
"if",
"not",
"(",
"type",
"("... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.save | Save the SGraph to disk. If the graph is saved in binary format, the
graph can be re-loaded using the :py:func:`load_sgraph` method.
Alternatively, the SGraph can be saved in JSON format for a
human-readable and portable representation.
Parameters
----------
filename : s... | src/unity/python/turicreate/data_structures/sgraph.py | def save(self, filename, format='auto'):
"""
Save the SGraph to disk. If the graph is saved in binary format, the
graph can be re-loaded using the :py:func:`load_sgraph` method.
Alternatively, the SGraph can be saved in JSON format for a
human-readable and portable representation... | def save(self, filename, format='auto'):
"""
Save the SGraph to disk. If the graph is saved in binary format, the
graph can be re-loaded using the :py:func:`load_sgraph` method.
Alternatively, the SGraph can be saved in JSON format for a
human-readable and portable representation... | [
"Save",
"the",
"SGraph",
"to",
"disk",
".",
"If",
"the",
"graph",
"is",
"saved",
"in",
"binary",
"format",
"the",
"graph",
"can",
"be",
"re",
"-",
"loaded",
"using",
"the",
":",
"py",
":",
"func",
":",
"load_sgraph",
"method",
".",
"Alternatively",
"th... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1014-L1061 | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"format",
"=",
"'auto'",
")",
":",
"if",
"format",
"is",
"'auto'",
":",
"if",
"filename",
".",
"endswith",
"(",
"(",
"'.json'",
",",
"'.json.gz'",
")",
")",
":",
"format",
"=",
"'json'",
"else",
":",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SGraph.get_neighborhood | Retrieve the graph neighborhood around a set of vertices, ignoring edge
directions. Note that setting radius greater than two often results in a
time-consuming query for a very large subgraph.
Parameters
----------
ids : list [int | float | str]
List of target vertex... | src/unity/python/turicreate/data_structures/sgraph.py | def get_neighborhood(self, ids, radius=1, full_subgraph=True):
"""
Retrieve the graph neighborhood around a set of vertices, ignoring edge
directions. Note that setting radius greater than two often results in a
time-consuming query for a very large subgraph.
Parameters
... | def get_neighborhood(self, ids, radius=1, full_subgraph=True):
"""
Retrieve the graph neighborhood around a set of vertices, ignoring edge
directions. Note that setting radius greater than two often results in a
time-consuming query for a very large subgraph.
Parameters
... | [
"Retrieve",
"the",
"graph",
"neighborhood",
"around",
"a",
"set",
"of",
"vertices",
"ignoring",
"edge",
"directions",
".",
"Note",
"that",
"setting",
"radius",
"greater",
"than",
"two",
"often",
"results",
"in",
"a",
"time",
"-",
"consuming",
"query",
"for",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1063-L1145 | [
"def",
"get_neighborhood",
"(",
"self",
",",
"ids",
",",
"radius",
"=",
"1",
",",
"full_subgraph",
"=",
"True",
")",
":",
"verts",
"=",
"ids",
"## find the vertices within radius (and the path edges)",
"for",
"i",
"in",
"range",
"(",
"radius",
")",
":",
"edges... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | Create a (binary or multi-class) classifier model of type
:class:`~turicreate.boosted_trees_classifier.BoostedTreesClassifier` using
gradient boosted trees (sometimes known as GBMs).
Parameters
----------
dataset : SFrame
A training dataset containing feature columns and a target column.
... | src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py | def create(dataset, target,
features=None, max_iterations=10,
validation_set='auto',
class_weights = None,
max_depth=6, step_size=0.3,
min_loss_reduction=0.0, min_child_weight=0.1,
row_subsample=1.0, column_subsample=1.0,
verbose=True,
... | def create(dataset, target,
features=None, max_iterations=10,
validation_set='auto',
class_weights = None,
max_depth=6, step_size=0.3,
min_loss_reduction=0.0, min_child_weight=0.1,
row_subsample=1.0, column_subsample=1.0,
verbose=True,
... | [
"Create",
"a",
"(",
"binary",
"or",
"multi",
"-",
"class",
")",
"classifier",
"model",
"of",
"type",
":",
"class",
":",
"~turicreate",
".",
"boosted_trees_classifier",
".",
"BoostedTreesClassifier",
"using",
"gradient",
"boosted",
"trees",
"(",
"sometimes",
"kno... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py#L450-L638 | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"features",
"=",
"None",
",",
"max_iterations",
"=",
"10",
",",
"validation_set",
"=",
"'auto'",
",",
"class_weights",
"=",
"None",
",",
"max_depth",
"=",
"6",
",",
"step_size",
"=",
"0.3",
",",
"min_l... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | BoostedTreesClassifier.classify | Return a classification, for each example in the ``dataset``, using the
trained boosted trees model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
Parameters
----------
dataset : SFrame
Dataset of n... | src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained boosted trees model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
P... | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained boosted trees model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
P... | [
"Return",
"a",
"classification",
"for",
"each",
"example",
"in",
"the",
"dataset",
"using",
"the",
"trained",
"boosted",
"trees",
"model",
".",
"The",
"output",
"SFrame",
"contains",
"predictions",
"as",
"class",
"labels",
"(",
"0",
"or",
"1",
")",
"and",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py#L365-L413 | [
"def",
"classify",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"return",
"super",
"(",
"BoostedTreesClassifier",
",",
"self",
")",
".",
"classify",
"(",
"dataset",
",",
"missing_value_action",
"=",
"missing_value_action",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | BoostedTreesClassifier.export_coreml | Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml("MyModel.mlmodel") | src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py | def export_coreml(self, filename):
"""
Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml("MyModel.mlmodel")
"""
from ... | def export_coreml(self, filename):
"""
Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml("MyModel.mlmodel")
"""
from ... | [
"Export",
"the",
"model",
"in",
"Core",
"ML",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py#L423-L448 | [
"def",
"export_coreml",
"(",
"self",
",",
"filename",
")",
":",
"from",
"turicreate",
".",
"toolkits",
"import",
"_coreml_utils",
"display_name",
"=",
"\"boosted trees classifier\"",
"short_description",
"=",
"_coreml_utils",
".",
"_mlmodel_short_description",
"(",
"dis... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | GraphAnalyticsModel._get | Return the value for the queried field.
Get the value of a given field. The list of all queryable fields is
documented in the beginning of the model class.
>>> out = m._get('graph')
Parameters
----------
field : string
Name of the field to be retrieved.
... | src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py | def _get(self, field):
"""
Return the value for the queried field.
Get the value of a given field. The list of all queryable fields is
documented in the beginning of the model class.
>>> out = m._get('graph')
Parameters
----------
field : string
... | def _get(self, field):
"""
Return the value for the queried field.
Get the value of a given field. The list of all queryable fields is
documented in the beginning of the model class.
>>> out = m._get('graph')
Parameters
----------
field : string
... | [
"Return",
"the",
"value",
"for",
"the",
"queried",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py#L31-L53 | [
"def",
"_get",
"(",
"self",
",",
"field",
")",
":",
"if",
"field",
"in",
"self",
".",
"_list_fields",
"(",
")",
":",
"return",
"self",
".",
"__proxy__",
".",
"get",
"(",
"field",
")",
"else",
":",
"raise",
"KeyError",
"(",
"'Key \\\"%s\\\" not in model. ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | GraphAnalyticsModel._describe_fields | Return a dictionary for the class fields description.
Fields should NOT be wrapped by _precomputed_field, if necessary | src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py | def _describe_fields(cls):
"""
Return a dictionary for the class fields description.
Fields should NOT be wrapped by _precomputed_field, if necessary
"""
dispatch_table = {
'ShortestPathModel': 'sssp',
'GraphColoringModel': 'graph_coloring',
'P... | def _describe_fields(cls):
"""
Return a dictionary for the class fields description.
Fields should NOT be wrapped by _precomputed_field, if necessary
"""
dispatch_table = {
'ShortestPathModel': 'sssp',
'GraphColoringModel': 'graph_coloring',
'P... | [
"Return",
"a",
"dictionary",
"for",
"the",
"class",
"fields",
"description",
".",
"Fields",
"should",
"NOT",
"be",
"wrapped",
"by",
"_precomputed_field",
"if",
"necessary"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py#L56-L76 | [
"def",
"_describe_fields",
"(",
"cls",
")",
":",
"dispatch_table",
"=",
"{",
"'ShortestPathModel'",
":",
"'sssp'",
",",
"'GraphColoringModel'",
":",
"'graph_coloring'",
",",
"'PagerankModel'",
":",
"'pagerank'",
",",
"'ConnectedComponentsModel'",
":",
"'connected_compon... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | GraphAnalyticsModel._get_summary_struct | Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of list of tuples)
A list of summary sections... | src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | [
"Returns",
"a",
"structured",
"description",
"of",
"the",
"model",
"including",
"(",
"where",
"relevant",
")",
"the",
"schema",
"of",
"the",
"training",
"data",
"description",
"of",
"the",
"training",
"data",
"training",
"statistics",
"and",
"model",
"hyperparam... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py#L90-L130 | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"g",
"=",
"self",
".",
"graph",
"section_titles",
"=",
"[",
"'Graph'",
"]",
"graph_summary",
"=",
"[",
"(",
"k",
",",
"_precomputed_field",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"six",
".... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.