repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_convolution1d | def convert_convolution1d(builder, layer, input_names, output_names, keras_layer):
"""
Convert convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get... | python | def convert_convolution1d(builder, layer, input_names, output_names, keras_layer):
"""
Convert convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get... | [
"def",
"convert_convolution1d",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"# Get input and output names",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"[",
"0",
"]",
",",
"output_names",
"[",... | Convert convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"convolution",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L386-L449 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_separable_convolution | def convert_separable_convolution(builder, layer, input_names, output_names, keras_layer):
"""
Convert separable convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.... | python | def convert_separable_convolution(builder, layer, input_names, output_names, keras_layer):
"""
Convert separable convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.... | [
"def",
"convert_separable_convolution",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"_check_data_format",
"(",
"keras_layer",
")",
"# Get input and output names",
"input_name",
",",
"output_name",
"=",
"(",
"inp... | Convert separable convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"separable",
"convolution",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L451-L529 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_batchnorm | def convert_batchnorm(builder, layer, input_names, output_names, keras_layer):
"""
Convert a Batch Normalization layer.
Parameters
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get input and output names
i... | python | def convert_batchnorm(builder, layer, input_names, output_names, keras_layer):
"""
Convert a Batch Normalization layer.
Parameters
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get input and output names
i... | [
"def",
"convert_batchnorm",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"# Get input and output names",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"[",
"0",
"]",
",",
"output_names",
"[",
"... | Convert a Batch Normalization layer.
Parameters
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"Batch",
"Normalization",
"layer",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L531-L581 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_flatten | def convert_flatten(builder, layer, input_names, output_names, keras_layer):
"""
Convert a flatten layer from keras to coreml.
----------
Parameters
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
input_name, ou... | python | def convert_flatten(builder, layer, input_names, output_names, keras_layer):
"""
Convert a flatten layer from keras to coreml.
----------
Parameters
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
input_name, ou... | [
"def",
"convert_flatten",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"[",
"0",
"]",
",",
"output_names",
"[",
"0",
"]",
")",
"# blob_order ==... | Convert a flatten layer from keras to coreml.
----------
Parameters
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"flatten",
"layer",
"from",
"keras",
"to",
"coreml",
".",
"----------",
"Parameters",
"keras_layer",
":",
"layer",
"A",
"keras",
"layer",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L584-L619 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_merge | def convert_merge(builder, layer, input_names, output_names, keras_layer):
"""
Convert concat layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get input and ou... | python | def convert_merge(builder, layer, input_names, output_names, keras_layer):
"""
Convert concat layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get input and ou... | [
"def",
"convert_merge",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"# Get input and output names",
"output_name",
"=",
"output_names",
"[",
"0",
"]",
"mode",
"=",
"_get_elementwise_name_from_keras_layer",
"(",
... | Convert concat layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"concat",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L621-L638 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_pooling | def convert_pooling(builder, layer, input_names, output_names, keras_layer):
"""
Convert pooling layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
_check_data_for... | python | def convert_pooling(builder, layer, input_names, output_names, keras_layer):
"""
Convert pooling layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
_check_data_for... | [
"def",
"convert_pooling",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"_check_data_format",
"(",
"keras_layer",
")",
"# Get input and output names",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"... | Convert pooling layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"pooling",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L640-L729 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_padding | def convert_padding(builder, layer, input_names, output_names, keras_layer):
"""
Convert padding layer from keras to coreml.
Keras only supports zero padding at this time.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural n... | python | def convert_padding(builder, layer, input_names, output_names, keras_layer):
"""
Convert padding layer from keras to coreml.
Keras only supports zero padding at this time.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural n... | [
"def",
"convert_padding",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"_check_data_format",
"(",
"keras_layer",
")",
"# Get input and output names",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"... | Convert padding layer from keras to coreml.
Keras only supports zero padding at this time.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"padding",
"layer",
"from",
"keras",
"to",
"coreml",
".",
"Keras",
"only",
"supports",
"zero",
"padding",
"at",
"this",
"time",
".",
"Parameters",
"----------",
"keras_layer",
":",
"layer",
"A",
"keras",
"layer",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L731-L782 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_cropping | def convert_cropping(builder, layer, input_names, output_names, keras_layer):
"""
Convert padding layer from keras to coreml.
Keras only supports zero padding at this time.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural ... | python | def convert_cropping(builder, layer, input_names, output_names, keras_layer):
"""
Convert padding layer from keras to coreml.
Keras only supports zero padding at this time.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural ... | [
"def",
"convert_cropping",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"_check_data_format",
"(",
"keras_layer",
")",
"# Get input and output names",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
... | Convert padding layer from keras to coreml.
Keras only supports zero padding at this time.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"padding",
"layer",
"from",
"keras",
"to",
"coreml",
".",
"Keras",
"only",
"supports",
"zero",
"padding",
"at",
"this",
"time",
".",
"Parameters",
"----------",
"keras_layer",
":",
"layer",
"A",
"keras",
"layer",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L784-L835 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_upsample | def convert_upsample(builder, layer, input_names, output_names, keras_layer):
"""
Convert convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
_check_dat... | python | def convert_upsample(builder, layer, input_names, output_names, keras_layer):
"""
Convert convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
_check_dat... | [
"def",
"convert_upsample",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"_check_data_format",
"(",
"keras_layer",
")",
"# Get input and output names",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
... | Convert convolution layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"convolution",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L837-L880 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_permute | def convert_permute(builder, layer, input_names, output_names, keras_layer):
"""
Convert a softmax layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
input_name, o... | python | def convert_permute(builder, layer, input_names, output_names, keras_layer):
"""
Convert a softmax layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
input_name, o... | [
"def",
"convert_permute",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"[",
"0",
"]",
",",
"output_names",
"[",
"0",
"]",
")",
"keras_dims",
... | Convert a softmax layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"softmax",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L882-L916 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_simple_rnn | def convert_simple_rnn(builder, layer, input_names, output_names, keras_layer):
"""
Convert an SimpleRNN layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get i... | python | def convert_simple_rnn(builder, layer, input_names, output_names, keras_layer):
"""
Convert an SimpleRNN layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
# Get i... | [
"def",
"convert_simple_rnn",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"# Get input and output names",
"hidden_size",
"=",
"keras_layer",
".",
"units",
"input_size",
"=",
"keras_layer",
".",
"input_shape",
"... | Convert an SimpleRNN layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"an",
"SimpleRNN",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L951-L995 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_lstm | def convert_lstm(builder, layer, input_names, output_names, keras_layer):
"""
Convert an LSTM layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
hidden_size = ker... | python | def convert_lstm(builder, layer, input_names, output_names, keras_layer):
"""
Convert an LSTM layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
hidden_size = ker... | [
"def",
"convert_lstm",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"hidden_size",
"=",
"keras_layer",
".",
"units",
"input_size",
"=",
"keras_layer",
".",
"input_shape",
"[",
"-",
"1",
"]",
"output_all",... | Convert an LSTM layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"an",
"LSTM",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L997-L1055 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_gru | def convert_gru(builder, layer, input_names, output_names, keras_layer):
"""
Convert a GRU layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
hidden_size = keras_... | python | def convert_gru(builder, layer, input_names, output_names, keras_layer):
"""
Convert a GRU layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
hidden_size = keras_... | [
"def",
"convert_gru",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"hidden_size",
"=",
"keras_layer",
".",
"units",
"input_size",
"=",
"keras_layer",
".",
"input_shape",
"[",
"-",
"1",
"]",
"output_all",
... | Convert a GRU layer from keras to coreml.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"GRU",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L1057-L1112 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py | convert_bidirectional | def convert_bidirectional(builder, layer, input_names, output_names, keras_layer):
"""
Convert a bidirectional layer from keras to coreml.
Currently assumes the units are LSTMs.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A n... | python | def convert_bidirectional(builder, layer, input_names, output_names, keras_layer):
"""
Convert a bidirectional layer from keras to coreml.
Currently assumes the units are LSTMs.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A n... | [
"def",
"convert_bidirectional",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"input_size",
"=",
"keras_layer",
".",
"input_shape",
"[",
"-",
"1",
"]",
"lstm_layer",
"=",
"keras_layer",
".",
"forward_layer",... | Convert a bidirectional layer from keras to coreml.
Currently assumes the units are LSTMs.
Parameters
----------
keras_layer: layer
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"bidirectional",
"layer",
"from",
"keras",
"to",
"coreml",
".",
"Currently",
"assumes",
"the",
"units",
"are",
"LSTMs",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L1114-L1232 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/simple_instructions.py | SimpleInstructions.SLICE_0 | def SLICE_0(self, instr):
'obj[:]'
value = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=None, step=None, upper=None, **kw)
subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Load(), **kw)
self.ast_stack.append(subscr... | python | def SLICE_0(self, instr):
'obj[:]'
value = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=None, step=None, upper=None, **kw)
subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Load(), **kw)
self.ast_stack.append(subscr... | [
"def",
"SLICE_0",
"(",
"self",
",",
"instr",
")",
":",
"value",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
"kw",
"=",
"dict",
"(",
"lineno",
"=",
"instr",
".",
"lineno",
",",
"col_offset",
"=",
"0",
")",
"slice",
"=",
"_ast",
".",
"Slic... | obj[:] | [
"obj",
"[",
":",
"]"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L723-L731 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/simple_instructions.py | SimpleInstructions.STORE_SLICE_1 | def STORE_SLICE_1(self, instr):
'obj[lower:] = expr'
lower = self.ast_stack.pop()
value = self.ast_stack.pop()
expr = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=lower, step=None, upper=None, **kw)
subscr = _ast.Subs... | python | def STORE_SLICE_1(self, instr):
'obj[lower:] = expr'
lower = self.ast_stack.pop()
value = self.ast_stack.pop()
expr = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=lower, step=None, upper=None, **kw)
subscr = _ast.Subs... | [
"def",
"STORE_SLICE_1",
"(",
"self",
",",
"instr",
")",
":",
"lower",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
"value",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
"expr",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
... | obj[lower:] = expr | [
"obj",
"[",
"lower",
":",
"]",
"=",
"expr"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L802-L813 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/simple_instructions.py | SimpleInstructions.STORE_SLICE_3 | def STORE_SLICE_3(self, instr):
'obj[lower:upper] = expr'
upper = self.ast_stack.pop()
lower = self.ast_stack.pop()
value = self.ast_stack.pop()
expr = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=lower, step... | python | def STORE_SLICE_3(self, instr):
'obj[lower:upper] = expr'
upper = self.ast_stack.pop()
lower = self.ast_stack.pop()
value = self.ast_stack.pop()
expr = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=lower, step... | [
"def",
"STORE_SLICE_3",
"(",
"self",
",",
"instr",
")",
":",
"upper",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
"lower",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
"value",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
... | obj[lower:upper] = expr | [
"obj",
"[",
"lower",
":",
"upper",
"]",
"=",
"expr"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L829-L849 | train |
apple/turicreate | src/unity/python/turicreate/meta/decompiler/simple_instructions.py | SimpleInstructions.DELETE_SLICE_0 | def DELETE_SLICE_0(self, instr):
'obj[:] = expr'
value = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=None, step=None, upper=None, **kw)
subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Del(), **kw)
delete = _ast.D... | python | def DELETE_SLICE_0(self, instr):
'obj[:] = expr'
value = self.ast_stack.pop()
kw = dict(lineno=instr.lineno, col_offset=0)
slice = _ast.Slice(lower=None, step=None, upper=None, **kw)
subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Del(), **kw)
delete = _ast.D... | [
"def",
"DELETE_SLICE_0",
"(",
"self",
",",
"instr",
")",
":",
"value",
"=",
"self",
".",
"ast_stack",
".",
"pop",
"(",
")",
"kw",
"=",
"dict",
"(",
"lineno",
"=",
"instr",
".",
"lineno",
",",
"col_offset",
"=",
"0",
")",
"slice",
"=",
"_ast",
".",
... | obj[:] = expr | [
"obj",
"[",
":",
"]",
"=",
"expr"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L851-L860 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/item_content_recommender.py | create | def create(item_data, item_id,
observation_data = None,
user_id = None, target = None,
weights = 'auto',
similarity_metrics = 'auto',
item_data_transform = 'auto',
max_item_neighborhood_size = 64, verbose=True):
"""Create a content-based recommender... | python | def create(item_data, item_id,
observation_data = None,
user_id = None, target = None,
weights = 'auto',
similarity_metrics = 'auto',
item_data_transform = 'auto',
max_item_neighborhood_size = 64, verbose=True):
"""Create a content-based recommender... | [
"def",
"create",
"(",
"item_data",
",",
"item_id",
",",
"observation_data",
"=",
"None",
",",
"user_id",
"=",
"None",
",",
"target",
"=",
"None",
",",
"weights",
"=",
"'auto'",
",",
"similarity_metrics",
"=",
"'auto'",
",",
"item_data_transform",
"=",
"'auto... | Create a content-based recommender model in which the similarity
between the items recommended is determined by the content of
those items rather than learned from user interaction data.
The similarity score between two items is calculated by first
computing the similarity between the item data for eac... | [
"Create",
"a",
"content",
"-",
"based",
"recommender",
"model",
"in",
"which",
"the",
"similarity",
"between",
"the",
"items",
"recommended",
"is",
"determined",
"by",
"the",
"content",
"of",
"those",
"items",
"rather",
"than",
"learned",
"from",
"user",
"inte... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/item_content_recommender.py#L20-L255 | train |
apple/turicreate | src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py | lhs | def lhs(node):
'''
Return a set of symbols in `node` that are assigned.
:param node: ast node
:returns: set of strings.
'''
gen = ConditionalSymbolVisitor()
if isinstance(node, (list, tuple)):
gen.visit_list(node)
else:
gen.visit(node)
return gen.lhs | python | def lhs(node):
'''
Return a set of symbols in `node` that are assigned.
:param node: ast node
:returns: set of strings.
'''
gen = ConditionalSymbolVisitor()
if isinstance(node, (list, tuple)):
gen.visit_list(node)
else:
gen.visit(node)
return gen.lhs | [
"def",
"lhs",
"(",
"node",
")",
":",
"gen",
"=",
"ConditionalSymbolVisitor",
"(",
")",
"if",
"isinstance",
"(",
"node",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"gen",
".",
"visit_list",
"(",
"node",
")",
"else",
":",
"gen",
".",
"visit",
"("... | Return a set of symbols in `node` that are assigned.
:param node: ast node
:returns: set of strings. | [
"Return",
"a",
"set",
"of",
"symbols",
"in",
"node",
"that",
"are",
"assigned",
".",
":",
"param",
"node",
":",
"ast",
"node",
":",
"returns",
":",
"set",
"of",
"strings",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py#L363-L377 | train |
apple/turicreate | src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py | conditional_lhs | def conditional_lhs(node):
'''
Group outputs into conditional and stable
:param node: ast node
:returns: tuple of (conditional, stable)
'''
gen = ConditionalSymbolVisitor()
gen.visit(node)
return gen.cond_lhs, gen.stable_lhs | python | def conditional_lhs(node):
'''
Group outputs into conditional and stable
:param node: ast node
:returns: tuple of (conditional, stable)
'''
gen = ConditionalSymbolVisitor()
gen.visit(node)
return gen.cond_lhs, gen.stable_lhs | [
"def",
"conditional_lhs",
"(",
"node",
")",
":",
"gen",
"=",
"ConditionalSymbolVisitor",
"(",
")",
"gen",
".",
"visit",
"(",
"node",
")",
"return",
"gen",
".",
"cond_lhs",
",",
"gen",
".",
"stable_lhs"
] | Group outputs into conditional and stable
:param node: ast node
:returns: tuple of (conditional, stable) | [
"Group",
"outputs",
"into",
"conditional",
"and",
"stable",
":",
"param",
"node",
":",
"ast",
"node",
":",
"returns",
":",
"tuple",
"of",
"(",
"conditional",
"stable",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py#L395-L406 | train |
apple/turicreate | src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py | conditional_symbols | def conditional_symbols(node):
'''
Group lhs and rhs into conditional, stable and undefined
:param node: ast node
:returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined
'''
gen = ConditionalSymbolVisitor()
gen.visit(node)
lhs = gen.cond_lhs,... | python | def conditional_symbols(node):
'''
Group lhs and rhs into conditional, stable and undefined
:param node: ast node
:returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined
'''
gen = ConditionalSymbolVisitor()
gen.visit(node)
lhs = gen.cond_lhs,... | [
"def",
"conditional_symbols",
"(",
"node",
")",
":",
"gen",
"=",
"ConditionalSymbolVisitor",
"(",
")",
"gen",
".",
"visit",
"(",
"node",
")",
"lhs",
"=",
"gen",
".",
"cond_lhs",
",",
"gen",
".",
"stable_lhs",
"rhs",
"=",
"gen",
".",
"cond_rhs",
",",
"g... | Group lhs and rhs into conditional, stable and undefined
:param node: ast node
:returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined | [
"Group",
"lhs",
"and",
"rhs",
"into",
"conditional",
"stable",
"and",
"undefined",
":",
"param",
"node",
":",
"ast",
"node",
":",
"returns",
":",
"tuple",
"of",
"(",
"conditional_lhs",
"stable_lhs",
")",
"(",
"conditional_rhs",
"stable_rhs",
")",
"undefined"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py#L409-L423 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/wrapper/rabit.py | _loadlib | def _loadlib(lib='standard'):
"""Load rabit library."""
global _LIB
if _LIB is not None:
warnings.warn('rabit.int call was ignored because it has'\
' already been initialized', level=2)
return
if lib == 'standard':
_LIB = ctypes.cdll.LoadLibrary(WRAPPER_... | python | def _loadlib(lib='standard'):
"""Load rabit library."""
global _LIB
if _LIB is not None:
warnings.warn('rabit.int call was ignored because it has'\
' already been initialized', level=2)
return
if lib == 'standard':
_LIB = ctypes.cdll.LoadLibrary(WRAPPER_... | [
"def",
"_loadlib",
"(",
"lib",
"=",
"'standard'",
")",
":",
"global",
"_LIB",
"if",
"_LIB",
"is",
"not",
"None",
":",
"warnings",
".",
"warn",
"(",
"'rabit.int call was ignored because it has'",
"' already been initialized'",
",",
"level",
"=",
"2",
")",
"return... | Load rabit library. | [
"Load",
"rabit",
"library",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L25-L42 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/wrapper/rabit.py | init | def init(args=None, lib='standard'):
"""Intialize the rabit module, call this once before using anything.
Parameters
----------
args: list of str, optional
The list of arguments used to initialized the rabit
usually you need to pass in sys.argv.
Defaults to sys.argv when it is N... | python | def init(args=None, lib='standard'):
"""Intialize the rabit module, call this once before using anything.
Parameters
----------
args: list of str, optional
The list of arguments used to initialized the rabit
usually you need to pass in sys.argv.
Defaults to sys.argv when it is N... | [
"def",
"init",
"(",
"args",
"=",
"None",
",",
"lib",
"=",
"'standard'",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"sys",
".",
"argv",
"_loadlib",
"(",
"lib",
")",
"arr",
"=",
"(",
"ctypes",
".",
"c_char_p",
"*",
"len",
"(",
"args",
... | Intialize the rabit module, call this once before using anything.
Parameters
----------
args: list of str, optional
The list of arguments used to initialized the rabit
usually you need to pass in sys.argv.
Defaults to sys.argv when it is None.
lib: {'standard', 'mock', 'mpi'}
... | [
"Intialize",
"the",
"rabit",
"module",
"call",
"this",
"once",
"before",
"using",
"anything",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L56-L73 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/wrapper/rabit.py | tracker_print | def tracker_print(msg):
"""Print message to the tracker.
This function can be used to communicate the information of
the progress to the tracker
Parameters
----------
msg : str
The message to be printed to tracker.
"""
if not isinstance(msg, str):
msg = str(msg)
_LI... | python | def tracker_print(msg):
"""Print message to the tracker.
This function can be used to communicate the information of
the progress to the tracker
Parameters
----------
msg : str
The message to be printed to tracker.
"""
if not isinstance(msg, str):
msg = str(msg)
_LI... | [
"def",
"tracker_print",
"(",
"msg",
")",
":",
"if",
"not",
"isinstance",
"(",
"msg",
",",
"str",
")",
":",
"msg",
"=",
"str",
"(",
"msg",
")",
"_LIB",
".",
"RabitTrackerPrint",
"(",
"ctypes",
".",
"c_char_p",
"(",
"msg",
")",
".",
"encode",
"(",
"'... | Print message to the tracker.
This function can be used to communicate the information of
the progress to the tracker
Parameters
----------
msg : str
The message to be printed to tracker. | [
"Print",
"message",
"to",
"the",
"tracker",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L105-L118 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/wrapper/rabit.py | allreduce | def allreduce(data, op, prepare_fun=None):
"""Perform allreduce, return the result.
Parameters
----------
data: numpy array
Input data.
op: int
Reduction operators, can be MIN, MAX, SUM, BITOR
prepare_fun: function
Lazy preprocessing function, if it is not None, prepare_... | python | def allreduce(data, op, prepare_fun=None):
"""Perform allreduce, return the result.
Parameters
----------
data: numpy array
Input data.
op: int
Reduction operators, can be MIN, MAX, SUM, BITOR
prepare_fun: function
Lazy preprocessing function, if it is not None, prepare_... | [
"def",
"allreduce",
"(",
"data",
",",
"op",
",",
"prepare_fun",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"np",
".",
"ndarray",
")",
":",
"raise",
"Exception",
"(",
"'allreduce only takes in numpy.ndarray'",
")",
"buf",
"=",
"data... | Perform allreduce, return the result.
Parameters
----------
data: numpy array
Input data.
op: int
Reduction operators, can be MIN, MAX, SUM, BITOR
prepare_fun: function
Lazy preprocessing function, if it is not None, prepare_fun(data)
will be called by the function b... | [
"Perform",
"allreduce",
"return",
"the",
"result",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L183-L226 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/wrapper/rabit.py | _load_model | def _load_model(ptr, length):
"""
Internal function used by the module,
unpickle a model from a buffer specified by ptr, length
Arguments:
ptr: ctypes.POINTER(ctypes._char)
pointer to the memory region of buffer
length: int
the length of buffer
"""
data = ... | python | def _load_model(ptr, length):
"""
Internal function used by the module,
unpickle a model from a buffer specified by ptr, length
Arguments:
ptr: ctypes.POINTER(ctypes._char)
pointer to the memory region of buffer
length: int
the length of buffer
"""
data = ... | [
"def",
"_load_model",
"(",
"ptr",
",",
"length",
")",
":",
"data",
"=",
"(",
"ctypes",
".",
"c_char",
"*",
"length",
")",
".",
"from_address",
"(",
"ctypes",
".",
"addressof",
"(",
"ptr",
".",
"contents",
")",
")",
"return",
"pickle",
".",
"loads",
"... | Internal function used by the module,
unpickle a model from a buffer specified by ptr, length
Arguments:
ptr: ctypes.POINTER(ctypes._char)
pointer to the memory region of buffer
length: int
the length of buffer | [
"Internal",
"function",
"used",
"by",
"the",
"module",
"unpickle",
"a",
"model",
"from",
"a",
"buffer",
"specified",
"by",
"ptr",
"length",
"Arguments",
":",
"ptr",
":",
"ctypes",
".",
"POINTER",
"(",
"ctypes",
".",
"_char",
")",
"pointer",
"to",
"the",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L229-L240 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/wrapper/rabit.py | load_checkpoint | def load_checkpoint(with_local=False):
"""Load latest check point.
Parameters
----------
with_local: bool, optional
whether the checkpoint contains local model
Returns
-------
tuple : tuple
if with_local: return (version, gobal_model, local_model)
else return (versi... | python | def load_checkpoint(with_local=False):
"""Load latest check point.
Parameters
----------
with_local: bool, optional
whether the checkpoint contains local model
Returns
-------
tuple : tuple
if with_local: return (version, gobal_model, local_model)
else return (versi... | [
"def",
"load_checkpoint",
"(",
"with_local",
"=",
"False",
")",
":",
"gptr",
"=",
"ctypes",
".",
"POINTER",
"(",
"ctypes",
".",
"c_char",
")",
"(",
")",
"global_len",
"=",
"ctypes",
".",
"c_ulong",
"(",
")",
"if",
"with_local",
":",
"lptr",
"=",
"ctype... | Load latest check point.
Parameters
----------
with_local: bool, optional
whether the checkpoint contains local model
Returns
-------
tuple : tuple
if with_local: return (version, gobal_model, local_model)
else return (version, gobal_model)
if returned version =... | [
"Load",
"latest",
"check",
"point",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L242-L281 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/wrapper/rabit.py | checkpoint | def checkpoint(global_model, local_model=None):
"""Checkpoint the model.
This means we finished a stage of execution.
Every time we call check point, there is a version number which will increase by one.
Parameters
----------
global_model: anytype that can be pickled
globally shared mo... | python | def checkpoint(global_model, local_model=None):
"""Checkpoint the model.
This means we finished a stage of execution.
Every time we call check point, there is a version number which will increase by one.
Parameters
----------
global_model: anytype that can be pickled
globally shared mo... | [
"def",
"checkpoint",
"(",
"global_model",
",",
"local_model",
"=",
"None",
")",
":",
"sglobal",
"=",
"pickle",
".",
"dumps",
"(",
"global_model",
")",
"if",
"local_model",
"is",
"None",
":",
"_LIB",
".",
"RabitCheckPoint",
"(",
"sglobal",
",",
"len",
"(",
... | Checkpoint the model.
This means we finished a stage of execution.
Every time we call check point, there is a version number which will increase by one.
Parameters
----------
global_model: anytype that can be pickled
globally shared model/state when calling this function,
the calle... | [
"Checkpoint",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L283-L314 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py | stack_annotations | def stack_annotations(annotations_sarray):
"""
Converts object detection annotations (ground truth or predictions) to
stacked format (an `SFrame` where each row is one object instance).
Parameters
----------
annotations_sarray: SArray
An `SArray` with unstacked predictions, exactly form... | python | def stack_annotations(annotations_sarray):
"""
Converts object detection annotations (ground truth or predictions) to
stacked format (an `SFrame` where each row is one object instance).
Parameters
----------
annotations_sarray: SArray
An `SArray` with unstacked predictions, exactly form... | [
"def",
"stack_annotations",
"(",
"annotations_sarray",
")",
":",
"_raise_error_if_not_sarray",
"(",
"annotations_sarray",
",",
"variable_name",
"=",
"'annotations_sarray'",
")",
"sf",
"=",
"_tc",
".",
"SFrame",
"(",
"{",
"'annotations'",
":",
"annotations_sarray",
"}"... | Converts object detection annotations (ground truth or predictions) to
stacked format (an `SFrame` where each row is one object instance).
Parameters
----------
annotations_sarray: SArray
An `SArray` with unstacked predictions, exactly formatted as the
annotations column when training a... | [
"Converts",
"object",
"detection",
"annotations",
"(",
"ground",
"truth",
"or",
"predictions",
")",
"to",
"stacked",
"format",
"(",
"an",
"SFrame",
"where",
"each",
"row",
"is",
"one",
"object",
"instance",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py#L14-L63 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py | unstack_annotations | def unstack_annotations(annotations_sframe, num_rows=None):
"""
Converts object detection annotations (ground truth or predictions) to
unstacked format (an `SArray` where each element is a list of object
instances).
Parameters
----------
annotations_sframe: SFrame
An `SFrame` with s... | python | def unstack_annotations(annotations_sframe, num_rows=None):
"""
Converts object detection annotations (ground truth or predictions) to
unstacked format (an `SArray` where each element is a list of object
instances).
Parameters
----------
annotations_sframe: SFrame
An `SFrame` with s... | [
"def",
"unstack_annotations",
"(",
"annotations_sframe",
",",
"num_rows",
"=",
"None",
")",
":",
"_raise_error_if_not_sframe",
"(",
"annotations_sframe",
",",
"variable_name",
"=",
"\"annotations_sframe\"",
")",
"cols",
"=",
"[",
"'label'",
",",
"'type'",
",",
"'coo... | Converts object detection annotations (ground truth or predictions) to
unstacked format (an `SArray` where each element is a list of object
instances).
Parameters
----------
annotations_sframe: SFrame
An `SFrame` with stacked predictions, produced by the
`stack_annotations` function... | [
"Converts",
"object",
"detection",
"annotations",
"(",
"ground",
"truth",
"or",
"predictions",
")",
"to",
"unstacked",
"format",
"(",
"an",
"SArray",
"where",
"each",
"element",
"is",
"a",
"list",
"of",
"object",
"instances",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/util/_output_formats.py#L66-L148 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/ranking_factorization_recommender.py | create | def create(observation_data,
user_id='user_id', item_id='item_id', target=None,
user_data=None, item_data=None,
num_factors=32,
regularization=1e-9,
linear_regularization=1e-9,
side_data_factorization=True,
ranking_regularization=0.25,
... | python | def create(observation_data,
user_id='user_id', item_id='item_id', target=None,
user_data=None, item_data=None,
num_factors=32,
regularization=1e-9,
linear_regularization=1e-9,
side_data_factorization=True,
ranking_regularization=0.25,
... | [
"def",
"create",
"(",
"observation_data",
",",
"user_id",
"=",
"'user_id'",
",",
"item_id",
"=",
"'item_id'",
",",
"target",
"=",
"None",
",",
"user_data",
"=",
"None",
",",
"item_data",
"=",
"None",
",",
"num_factors",
"=",
"32",
",",
"regularization",
"=... | Create a RankingFactorizationRecommender that learns latent factors for each
user and item and uses them to make rating predictions.
Parameters
----------
observation_data : SFrame
The dataset to use for training the model. It must contain a column of
user ids and a column of item ids. ... | [
"Create",
"a",
"RankingFactorizationRecommender",
"that",
"learns",
"latent",
"factors",
"for",
"each",
"user",
"and",
"item",
"and",
"uses",
"them",
"to",
"make",
"rating",
"predictions",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/ranking_factorization_recommender.py#L19-L270 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/mlmodel/docs/preprocess.py | preprocess | def preprocess():
"splits _sources/reference.rst into separate files"
text = open("./_sources/reference.rst", "r").read()
os.remove("./_sources/reference.rst")
if not os.path.exists("./_sources/reference"):
os.makedirs("./_sources/reference")
def pairwise(iterable):
"s -> (s0, s1)... | python | def preprocess():
"splits _sources/reference.rst into separate files"
text = open("./_sources/reference.rst", "r").read()
os.remove("./_sources/reference.rst")
if not os.path.exists("./_sources/reference"):
os.makedirs("./_sources/reference")
def pairwise(iterable):
"s -> (s0, s1)... | [
"def",
"preprocess",
"(",
")",
":",
"text",
"=",
"open",
"(",
"\"./_sources/reference.rst\"",
",",
"\"r\"",
")",
".",
"read",
"(",
")",
"os",
".",
"remove",
"(",
"\"./_sources/reference.rst\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"\"... | splits _sources/reference.rst into separate files | [
"splits",
"_sources",
"/",
"reference",
".",
"rst",
"into",
"separate",
"files"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/mlmodel/docs/preprocess.py#L6-L29 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py | PackTag | def PackTag(field_number, wire_type):
"""Returns an unsigned 32-bit integer that encodes the field number and
wire type information in standard protocol message wire format.
Args:
field_number: Expected to be an integer in the range [1, 1 << 29)
wire_type: One of the WIRETYPE_* constants.
"""
if not ... | python | def PackTag(field_number, wire_type):
"""Returns an unsigned 32-bit integer that encodes the field number and
wire type information in standard protocol message wire format.
Args:
field_number: Expected to be an integer in the range [1, 1 << 29)
wire_type: One of the WIRETYPE_* constants.
"""
if not ... | [
"def",
"PackTag",
"(",
"field_number",
",",
"wire_type",
")",
":",
"if",
"not",
"0",
"<=",
"wire_type",
"<=",
"_WIRETYPE_MAX",
":",
"raise",
"message",
".",
"EncodeError",
"(",
"'Unknown wire type: %d'",
"%",
"wire_type",
")",
"return",
"(",
"field_number",
"<... | Returns an unsigned 32-bit integer that encodes the field number and
wire type information in standard protocol message wire format.
Args:
field_number: Expected to be an integer in the range [1, 1 << 29)
wire_type: One of the WIRETYPE_* constants. | [
"Returns",
"an",
"unsigned",
"32",
"-",
"bit",
"integer",
"that",
"encodes",
"the",
"field",
"number",
"and",
"wire",
"type",
"information",
"in",
"standard",
"protocol",
"message",
"wire",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py#L80-L90 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py | _VarUInt64ByteSizeNoTag | def _VarUInt64ByteSizeNoTag(uint64):
"""Returns the number of bytes required to serialize a single varint
using boundary value comparisons. (unrolled loop optimization -WPierce)
uint64 must be unsigned.
"""
if uint64 <= 0x7f: return 1
if uint64 <= 0x3fff: return 2
if uint64 <= 0x1fffff: return 3
if uint... | python | def _VarUInt64ByteSizeNoTag(uint64):
"""Returns the number of bytes required to serialize a single varint
using boundary value comparisons. (unrolled loop optimization -WPierce)
uint64 must be unsigned.
"""
if uint64 <= 0x7f: return 1
if uint64 <= 0x3fff: return 2
if uint64 <= 0x1fffff: return 3
if uint... | [
"def",
"_VarUInt64ByteSizeNoTag",
"(",
"uint64",
")",
":",
"if",
"uint64",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"uint64",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"uint64",
"<=",
"0x1fffff",
":",
"return",
"3",
"if",
"uint64",
"<=",
"0xfffffff",
":",... | Returns the number of bytes required to serialize a single varint
using boundary value comparisons. (unrolled loop optimization -WPierce)
uint64 must be unsigned. | [
"Returns",
"the",
"number",
"of",
"bytes",
"required",
"to",
"serialize",
"a",
"single",
"varint",
"using",
"boundary",
"value",
"comparisons",
".",
"(",
"unrolled",
"loop",
"optimization",
"-",
"WPierce",
")",
"uint64",
"must",
"be",
"unsigned",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/wire_format.py#L232-L248 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/style_transfer/_utils.py | _seconds_as_string | def _seconds_as_string(seconds):
"""
Returns seconds as a human-friendly string, e.g. '1d 4h 47m 41s'
"""
TIME_UNITS = [('s', 60), ('m', 60), ('h', 24), ('d', None)]
unit_strings = []
cur = max(int(seconds), 1)
for suffix, size in TIME_UNITS:
if size is not None:
cur, res... | python | def _seconds_as_string(seconds):
"""
Returns seconds as a human-friendly string, e.g. '1d 4h 47m 41s'
"""
TIME_UNITS = [('s', 60), ('m', 60), ('h', 24), ('d', None)]
unit_strings = []
cur = max(int(seconds), 1)
for suffix, size in TIME_UNITS:
if size is not None:
cur, res... | [
"def",
"_seconds_as_string",
"(",
"seconds",
")",
":",
"TIME_UNITS",
"=",
"[",
"(",
"'s'",
",",
"60",
")",
",",
"(",
"'m'",
",",
"60",
")",
",",
"(",
"'h'",
",",
"24",
")",
",",
"(",
"'d'",
",",
"None",
")",
"]",
"unit_strings",
"=",
"[",
"]",
... | Returns seconds as a human-friendly string, e.g. '1d 4h 47m 41s' | [
"Returns",
"seconds",
"as",
"a",
"human",
"-",
"friendly",
"string",
"e",
".",
"g",
".",
"1d",
"4h",
"47m",
"41s"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/_utils.py#L10-L24 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py | _get_converter_module | def _get_converter_module(sk_obj):
"""
Returns the module holding the conversion functions for a
particular model).
"""
try:
cv_idx = _converter_lookup[sk_obj.__class__]
except KeyError:
raise ValueError(
"Transformer '%s' not supported; supported transformers are... | python | def _get_converter_module(sk_obj):
"""
Returns the module holding the conversion functions for a
particular model).
"""
try:
cv_idx = _converter_lookup[sk_obj.__class__]
except KeyError:
raise ValueError(
"Transformer '%s' not supported; supported transformers are... | [
"def",
"_get_converter_module",
"(",
"sk_obj",
")",
":",
"try",
":",
"cv_idx",
"=",
"_converter_lookup",
"[",
"sk_obj",
".",
"__class__",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"\"Transformer '%s' not supported; supported transformers are %s.\"",
"%... | Returns the module holding the conversion functions for a
particular model). | [
"Returns",
"the",
"module",
"holding",
"the",
"conversion",
"functions",
"for",
"a",
"particular",
"model",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py#L87-L100 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py | _convert_sklearn_model | def _convert_sklearn_model(input_sk_obj, input_features = None,
output_feature_names = None, class_labels = None):
"""
Converts a generic sklearn pipeline, transformer, classifier, or regressor
into an coreML specification.
"""
if not(HAS_SKLEARN):
raise RuntimeErr... | python | def _convert_sklearn_model(input_sk_obj, input_features = None,
output_feature_names = None, class_labels = None):
"""
Converts a generic sklearn pipeline, transformer, classifier, or regressor
into an coreML specification.
"""
if not(HAS_SKLEARN):
raise RuntimeErr... | [
"def",
"_convert_sklearn_model",
"(",
"input_sk_obj",
",",
"input_features",
"=",
"None",
",",
"output_feature_names",
"=",
"None",
",",
"class_labels",
"=",
"None",
")",
":",
"if",
"not",
"(",
"HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-lear... | Converts a generic sklearn pipeline, transformer, classifier, or regressor
into an coreML specification. | [
"Converts",
"a",
"generic",
"sklearn",
"pipeline",
"transformer",
"classifier",
"or",
"regressor",
"into",
"an",
"coreML",
"specification",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter_internal.py#L109-L324 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py | TreeEnsembleBase.set_default_prediction_value | def set_default_prediction_value(self, values):
"""
Set the default prediction value(s).
The values given here form the base prediction value that the values
at activated leaves are added to. If values is a scalar, then
the output of the tree must also be 1 dimensional; otherwi... | python | def set_default_prediction_value(self, values):
"""
Set the default prediction value(s).
The values given here form the base prediction value that the values
at activated leaves are added to. If values is a scalar, then
the output of the tree must also be 1 dimensional; otherwi... | [
"def",
"set_default_prediction_value",
"(",
"self",
",",
"values",
")",
":",
"if",
"type",
"(",
"values",
")",
"is",
"not",
"list",
":",
"values",
"=",
"[",
"float",
"(",
"values",
")",
"]",
"self",
".",
"tree_parameters",
".",
"numPredictionDimensions",
"... | Set the default prediction value(s).
The values given here form the base prediction value that the values
at activated leaves are added to. If values is a scalar, then
the output of the tree must also be 1 dimensional; otherwise, values
must be a list with length matching the dimension... | [
"Set",
"the",
"default",
"prediction",
"value",
"(",
"s",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L36-L55 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py | TreeEnsembleBase.set_post_evaluation_transform | def set_post_evaluation_transform(self, value):
r"""
Set the post processing transform applied after the prediction value
from the tree ensemble.
Parameters
----------
value: str
A value denoting the transform applied. Possible values are:
- "... | python | def set_post_evaluation_transform(self, value):
r"""
Set the post processing transform applied after the prediction value
from the tree ensemble.
Parameters
----------
value: str
A value denoting the transform applied. Possible values are:
- "... | [
"def",
"set_post_evaluation_transform",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"tree_spec",
".",
"postEvaluationTransform",
"=",
"_TreeEnsemble_pb2",
".",
"TreeEnsemblePostEvaluationTransform",
".",
"Value",
"(",
"value",
")"
] | r"""
Set the post processing transform applied after the prediction value
from the tree ensemble.
Parameters
----------
value: str
A value denoting the transform applied. Possible values are:
- "NoTransform" (default). Do not apply a transform.
... | [
"r",
"Set",
"the",
"post",
"processing",
"transform",
"applied",
"after",
"the",
"prediction",
"value",
"from",
"the",
"tree",
"ensemble",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L57-L97 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py | TreeEnsembleBase.add_branch_node | def add_branch_node(self, tree_id, node_id, feature_index, feature_value,
branch_mode, true_child_id, false_child_id, relative_hit_rate = None,
missing_value_tracks_true_child = False):
"""
Add a branch node to the tree ensemble.
Parameters
----------
tre... | python | def add_branch_node(self, tree_id, node_id, feature_index, feature_value,
branch_mode, true_child_id, false_child_id, relative_hit_rate = None,
missing_value_tracks_true_child = False):
"""
Add a branch node to the tree ensemble.
Parameters
----------
tre... | [
"def",
"add_branch_node",
"(",
"self",
",",
"tree_id",
",",
"node_id",
",",
"feature_index",
",",
"feature_value",
",",
"branch_mode",
",",
"true_child_id",
",",
"false_child_id",
",",
"relative_hit_rate",
"=",
"None",
",",
"missing_value_tracks_true_child",
"=",
"F... | Add a branch node to the tree ensemble.
Parameters
----------
tree_id: int
ID of the tree to add the node to.
node_id: int
ID of the node within the tree.
feature_index: int
Index of the feature in the input being split on.
feature_... | [
"Add",
"a",
"branch",
"node",
"to",
"the",
"tree",
"ensemble",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L99-L186 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py | TreeEnsembleBase.add_leaf_node | def add_leaf_node(self, tree_id, node_id, values, relative_hit_rate = None):
"""
Add a leaf node to the tree ensemble.
Parameters
----------
tree_id: int
ID of the tree to add the node to.
node_id: int
ID of the node within the tree.
val... | python | def add_leaf_node(self, tree_id, node_id, values, relative_hit_rate = None):
"""
Add a leaf node to the tree ensemble.
Parameters
----------
tree_id: int
ID of the tree to add the node to.
node_id: int
ID of the node within the tree.
val... | [
"def",
"add_leaf_node",
"(",
"self",
",",
"tree_id",
",",
"node_id",
",",
"values",
",",
"relative_hit_rate",
"=",
"None",
")",
":",
"spec_node",
"=",
"self",
".",
"tree_parameters",
".",
"nodes",
".",
"add",
"(",
")",
"spec_node",
".",
"treeId",
"=",
"t... | Add a leaf node to the tree ensemble.
Parameters
----------
tree_id: int
ID of the tree to add the node to.
node_id: int
ID of the node within the tree.
values: [float | int | list | dict]
Value(s) at the leaf node to add to the prediction w... | [
"Add",
"a",
"leaf",
"node",
"to",
"the",
"tree",
"ensemble",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/tree_ensemble.py#L188-L235 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | create | def create (raw_properties = []):
""" Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one.
"""
assert (is_iterable_typed(raw_properties, property.Property)
or is_iterable_typed(raw_properties, basestring))
# FIXME: propagate to caller... | python | def create (raw_properties = []):
""" Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one.
"""
assert (is_iterable_typed(raw_properties, property.Property)
or is_iterable_typed(raw_properties, basestring))
# FIXME: propagate to caller... | [
"def",
"create",
"(",
"raw_properties",
"=",
"[",
"]",
")",
":",
"assert",
"(",
"is_iterable_typed",
"(",
"raw_properties",
",",
"property",
".",
"Property",
")",
"or",
"is_iterable_typed",
"(",
"raw_properties",
",",
"basestring",
")",
")",
"# FIXME: propagate ... | Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one. | [
"Creates",
"a",
"new",
"PropertySet",
"instance",
"for",
"the",
"given",
"raw",
"properties",
"or",
"returns",
"an",
"already",
"existing",
"one",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L36-L61 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | create_with_validation | def create_with_validation (raw_properties):
""" Creates new 'PropertySet' instances after checking
that all properties are valid and converting implicit
properties into gristed form.
"""
assert is_iterable_typed(raw_properties, basestring)
properties = [property.create_from_string(s) fo... | python | def create_with_validation (raw_properties):
""" Creates new 'PropertySet' instances after checking
that all properties are valid and converting implicit
properties into gristed form.
"""
assert is_iterable_typed(raw_properties, basestring)
properties = [property.create_from_string(s) fo... | [
"def",
"create_with_validation",
"(",
"raw_properties",
")",
":",
"assert",
"is_iterable_typed",
"(",
"raw_properties",
",",
"basestring",
")",
"properties",
"=",
"[",
"property",
".",
"create_from_string",
"(",
"s",
")",
"for",
"s",
"in",
"raw_properties",
"]",
... | Creates new 'PropertySet' instances after checking
that all properties are valid and converting implicit
properties into gristed form. | [
"Creates",
"new",
"PropertySet",
"instances",
"after",
"checking",
"that",
"all",
"properties",
"are",
"valid",
"and",
"converting",
"implicit",
"properties",
"into",
"gristed",
"form",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L63-L72 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | create_from_user_input | def create_from_user_input(raw_properties, jamfile_module, location):
"""Creates a property-set from the input given by the user, in the
context of 'jamfile-module' at 'location'"""
assert is_iterable_typed(raw_properties, basestring)
assert isinstance(jamfile_module, basestring)
assert isinstance(l... | python | def create_from_user_input(raw_properties, jamfile_module, location):
"""Creates a property-set from the input given by the user, in the
context of 'jamfile-module' at 'location'"""
assert is_iterable_typed(raw_properties, basestring)
assert isinstance(jamfile_module, basestring)
assert isinstance(l... | [
"def",
"create_from_user_input",
"(",
"raw_properties",
",",
"jamfile_module",
",",
"location",
")",
":",
"assert",
"is_iterable_typed",
"(",
"raw_properties",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"jamfile_module",
",",
"basestring",
")",
"assert",
"... | Creates a property-set from the input given by the user, in the
context of 'jamfile-module' at 'location | [
"Creates",
"a",
"property",
"-",
"set",
"from",
"the",
"input",
"given",
"by",
"the",
"user",
"in",
"the",
"context",
"of",
"jamfile",
"-",
"module",
"at",
"location"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L79-L94 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | refine_from_user_input | def refine_from_user_input(parent_requirements, specification, jamfile_module,
location):
"""Refines requirements with requirements provided by the user.
Specially handles "-<property>value" syntax in specification
to remove given requirements.
- parent-requirements -- prope... | python | def refine_from_user_input(parent_requirements, specification, jamfile_module,
location):
"""Refines requirements with requirements provided by the user.
Specially handles "-<property>value" syntax in specification
to remove given requirements.
- parent-requirements -- prope... | [
"def",
"refine_from_user_input",
"(",
"parent_requirements",
",",
"specification",
",",
"jamfile_module",
",",
"location",
")",
":",
"assert",
"isinstance",
"(",
"parent_requirements",
",",
"PropertySet",
")",
"assert",
"is_iterable_typed",
"(",
"specification",
",",
... | Refines requirements with requirements provided by the user.
Specially handles "-<property>value" syntax in specification
to remove given requirements.
- parent-requirements -- property-set object with requirements
to refine
- specification -- string list of requirements provided by the use
... | [
"Refines",
"requirements",
"with",
"requirements",
"provided",
"by",
"the",
"user",
".",
"Specially",
"handles",
"-",
"<property",
">",
"value",
"syntax",
"in",
"specification",
"to",
"remove",
"given",
"requirements",
".",
"-",
"parent",
"-",
"requirements",
"-... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L97-L140 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.base | def base (self):
""" Returns properties that are neither incidental nor free.
"""
result = [p for p in self.lazy_properties
if not(p.feature.incidental or p.feature.free)]
result.extend(self.base_)
return result | python | def base (self):
""" Returns properties that are neither incidental nor free.
"""
result = [p for p in self.lazy_properties
if not(p.feature.incidental or p.feature.free)]
result.extend(self.base_)
return result | [
"def",
"base",
"(",
"self",
")",
":",
"result",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"lazy_properties",
"if",
"not",
"(",
"p",
".",
"feature",
".",
"incidental",
"or",
"p",
".",
"feature",
".",
"free",
")",
"]",
"result",
".",
"extend",
... | Returns properties that are neither incidental nor free. | [
"Returns",
"properties",
"that",
"are",
"neither",
"incidental",
"nor",
"free",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L264-L270 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.free | def free (self):
""" Returns free properties which are not dependency properties.
"""
result = [p for p in self.lazy_properties
if not p.feature.incidental and p.feature.free]
result.extend(self.free_)
return result | python | def free (self):
""" Returns free properties which are not dependency properties.
"""
result = [p for p in self.lazy_properties
if not p.feature.incidental and p.feature.free]
result.extend(self.free_)
return result | [
"def",
"free",
"(",
"self",
")",
":",
"result",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"lazy_properties",
"if",
"not",
"p",
".",
"feature",
".",
"incidental",
"and",
"p",
".",
"feature",
".",
"free",
"]",
"result",
".",
"extend",
"(",
"self"... | Returns free properties which are not dependency properties. | [
"Returns",
"free",
"properties",
"which",
"are",
"not",
"dependency",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L272-L278 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.dependency | def dependency (self):
""" Returns dependency properties.
"""
result = [p for p in self.lazy_properties if p.feature.dependency]
result.extend(self.dependency_)
return self.dependency_ | python | def dependency (self):
""" Returns dependency properties.
"""
result = [p for p in self.lazy_properties if p.feature.dependency]
result.extend(self.dependency_)
return self.dependency_ | [
"def",
"dependency",
"(",
"self",
")",
":",
"result",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"lazy_properties",
"if",
"p",
".",
"feature",
".",
"dependency",
"]",
"result",
".",
"extend",
"(",
"self",
".",
"dependency_",
")",
"return",
"self",
... | Returns dependency properties. | [
"Returns",
"dependency",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L283-L288 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.non_dependency | def non_dependency (self):
""" Returns properties that are not dependencies.
"""
result = [p for p in self.lazy_properties if not p.feature.dependency]
result.extend(self.non_dependency_)
return result | python | def non_dependency (self):
""" Returns properties that are not dependencies.
"""
result = [p for p in self.lazy_properties if not p.feature.dependency]
result.extend(self.non_dependency_)
return result | [
"def",
"non_dependency",
"(",
"self",
")",
":",
"result",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"lazy_properties",
"if",
"not",
"p",
".",
"feature",
".",
"dependency",
"]",
"result",
".",
"extend",
"(",
"self",
".",
"non_dependency_",
")",
"ret... | Returns properties that are not dependencies. | [
"Returns",
"properties",
"that",
"are",
"not",
"dependencies",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L290-L295 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.incidental | def incidental (self):
""" Returns incidental properties.
"""
result = [p for p in self.lazy_properties if p.feature.incidental]
result.extend(self.incidental_)
return result | python | def incidental (self):
""" Returns incidental properties.
"""
result = [p for p in self.lazy_properties if p.feature.incidental]
result.extend(self.incidental_)
return result | [
"def",
"incidental",
"(",
"self",
")",
":",
"result",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"lazy_properties",
"if",
"p",
".",
"feature",
".",
"incidental",
"]",
"result",
".",
"extend",
"(",
"self",
".",
"incidental_",
")",
"return",
"result"
... | Returns incidental properties. | [
"Returns",
"incidental",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L307-L312 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.refine | def refine (self, requirements):
""" Refines this set's properties using the requirements passed as an argument.
"""
assert isinstance(requirements, PropertySet)
if requirements not in self.refined_:
r = property.refine(self.all_, requirements.all_)
self.refined_... | python | def refine (self, requirements):
""" Refines this set's properties using the requirements passed as an argument.
"""
assert isinstance(requirements, PropertySet)
if requirements not in self.refined_:
r = property.refine(self.all_, requirements.all_)
self.refined_... | [
"def",
"refine",
"(",
"self",
",",
"requirements",
")",
":",
"assert",
"isinstance",
"(",
"requirements",
",",
"PropertySet",
")",
"if",
"requirements",
"not",
"in",
"self",
".",
"refined_",
":",
"r",
"=",
"property",
".",
"refine",
"(",
"self",
".",
"al... | Refines this set's properties using the requirements passed as an argument. | [
"Refines",
"this",
"set",
"s",
"properties",
"using",
"the",
"requirements",
"passed",
"as",
"an",
"argument",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L314-L323 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.target_path | def target_path (self):
""" Computes the target path that should be used for
target with these properties.
Returns a tuple of
- the computed path
- if the path is relative to build directory, a value of
'true'.
"""
if not self.t... | python | def target_path (self):
""" Computes the target path that should be used for
target with these properties.
Returns a tuple of
- the computed path
- if the path is relative to build directory, a value of
'true'.
"""
if not self.t... | [
"def",
"target_path",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"target_path_",
":",
"# The <location> feature can be used to explicitly",
"# change the location of generated targets",
"l",
"=",
"self",
".",
"get",
"(",
"'<location>'",
")",
"if",
"l",
":",
"c... | Computes the target path that should be used for
target with these properties.
Returns a tuple of
- the computed path
- if the path is relative to build directory, a value of
'true'. | [
"Computes",
"the",
"target",
"path",
"that",
"should",
"be",
"used",
"for",
"target",
"with",
"these",
"properties",
".",
"Returns",
"a",
"tuple",
"of",
"-",
"the",
"computed",
"path",
"-",
"if",
"the",
"path",
"is",
"relative",
"to",
"build",
"directory",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L395-L439 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.add | def add (self, ps):
""" Creates a new property set containing the properties in this one,
plus the ones of the property set passed as argument.
"""
assert isinstance(ps, PropertySet)
if ps not in self.added_:
self.added_[ps] = create(self.all_ + ps.all())
... | python | def add (self, ps):
""" Creates a new property set containing the properties in this one,
plus the ones of the property set passed as argument.
"""
assert isinstance(ps, PropertySet)
if ps not in self.added_:
self.added_[ps] = create(self.all_ + ps.all())
... | [
"def",
"add",
"(",
"self",
",",
"ps",
")",
":",
"assert",
"isinstance",
"(",
"ps",
",",
"PropertySet",
")",
"if",
"ps",
"not",
"in",
"self",
".",
"added_",
":",
"self",
".",
"added_",
"[",
"ps",
"]",
"=",
"create",
"(",
"self",
".",
"all_",
"+",
... | Creates a new property set containing the properties in this one,
plus the ones of the property set passed as argument. | [
"Creates",
"a",
"new",
"property",
"set",
"containing",
"the",
"properties",
"in",
"this",
"one",
"plus",
"the",
"ones",
"of",
"the",
"property",
"set",
"passed",
"as",
"argument",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L441-L448 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.get | def get (self, feature):
""" Returns all values of 'feature'.
"""
if type(feature) == type([]):
feature = feature[0]
if not isinstance(feature, b2.build.feature.Feature):
feature = b2.build.feature.get(feature)
assert isinstance(feature, b2.build.feature.F... | python | def get (self, feature):
""" Returns all values of 'feature'.
"""
if type(feature) == type([]):
feature = feature[0]
if not isinstance(feature, b2.build.feature.Feature):
feature = b2.build.feature.get(feature)
assert isinstance(feature, b2.build.feature.F... | [
"def",
"get",
"(",
"self",
",",
"feature",
")",
":",
"if",
"type",
"(",
"feature",
")",
"==",
"type",
"(",
"[",
"]",
")",
":",
"feature",
"=",
"feature",
"[",
"0",
"]",
"if",
"not",
"isinstance",
"(",
"feature",
",",
"b2",
".",
"build",
".",
"f... | Returns all values of 'feature'. | [
"Returns",
"all",
"values",
"of",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L457-L474 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property_set.py | PropertySet.get_properties | def get_properties(self, feature):
"""Returns all contained properties associated with 'feature'"""
if not isinstance(feature, b2.build.feature.Feature):
feature = b2.build.feature.get(feature)
assert isinstance(feature, b2.build.feature.Feature)
result = []
for p in... | python | def get_properties(self, feature):
"""Returns all contained properties associated with 'feature'"""
if not isinstance(feature, b2.build.feature.Feature):
feature = b2.build.feature.get(feature)
assert isinstance(feature, b2.build.feature.Feature)
result = []
for p in... | [
"def",
"get_properties",
"(",
"self",
",",
"feature",
")",
":",
"if",
"not",
"isinstance",
"(",
"feature",
",",
"b2",
".",
"build",
".",
"feature",
".",
"Feature",
")",
":",
"feature",
"=",
"b2",
".",
"build",
".",
"feature",
".",
"get",
"(",
"featur... | Returns all contained properties associated with 'feature | [
"Returns",
"all",
"contained",
"properties",
"associated",
"with",
"feature"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property_set.py#L477-L487 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _create | def _create(observation_data,
user_id='user_id', item_id='item_id', target=None,
user_data=None, item_data=None,
ranking=True,
verbose=True):
"""
A unified interface for training recommender models. Based on simple
characteristics of the data, a type of model is s... | python | def _create(observation_data,
user_id='user_id', item_id='item_id', target=None,
user_data=None, item_data=None,
ranking=True,
verbose=True):
"""
A unified interface for training recommender models. Based on simple
characteristics of the data, a type of model is s... | [
"def",
"_create",
"(",
"observation_data",
",",
"user_id",
"=",
"'user_id'",
",",
"item_id",
"=",
"'item_id'",
",",
"target",
"=",
"None",
",",
"user_data",
"=",
"None",
",",
"item_data",
"=",
"None",
",",
"ranking",
"=",
"True",
",",
"verbose",
"=",
"Tr... | A unified interface for training recommender models. Based on simple
characteristics of the data, a type of model is selected and trained. The
trained model can be used to predict ratings and make recommendations.
To use specific options of a desired model, use the ``create`` function
of the correspond... | [
"A",
"unified",
"interface",
"for",
"training",
"recommender",
"models",
".",
"Based",
"on",
"simple",
"characteristics",
"of",
"the",
"data",
"a",
"type",
"of",
"model",
"is",
"selected",
"and",
"trained",
".",
"The",
"trained",
"model",
"can",
"be",
"used"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L24-L175 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | compare_models | def compare_models(dataset, models, model_names=None, user_sample=1.0,
metric='auto',
target=None,
exclude_known_for_precision_recall=True,
make_plot=False,
verbose=True,
**kwargs):
"""
Compare the ... | python | def compare_models(dataset, models, model_names=None, user_sample=1.0,
metric='auto',
target=None,
exclude_known_for_precision_recall=True,
make_plot=False,
verbose=True,
**kwargs):
"""
Compare the ... | [
"def",
"compare_models",
"(",
"dataset",
",",
"models",
",",
"model_names",
"=",
"None",
",",
"user_sample",
"=",
"1.0",
",",
"metric",
"=",
"'auto'",
",",
"target",
"=",
"None",
",",
"exclude_known_for_precision_recall",
"=",
"True",
",",
"make_plot",
"=",
... | Compare the prediction or recommendation performance of recommender models
on a common test dataset.
Models that are trained to predict ratings are compared separately from
models that are trained without target ratings. The ratings prediction
models are compared on root-mean-squared error, and the re... | [
"Compare",
"the",
"prediction",
"or",
"recommendation",
"performance",
"of",
"recommender",
"models",
"on",
"a",
"common",
"test",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L177-L328 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | precision_recall_by_user | def precision_recall_by_user(observed_user_items,
recommendations,
cutoffs=[10]):
"""
Compute precision and recall at a given cutoff for each user. In information
retrieval terms, precision represents the ratio of relevant, retrieved items
to the... | python | def precision_recall_by_user(observed_user_items,
recommendations,
cutoffs=[10]):
"""
Compute precision and recall at a given cutoff for each user. In information
retrieval terms, precision represents the ratio of relevant, retrieved items
to the... | [
"def",
"precision_recall_by_user",
"(",
"observed_user_items",
",",
"recommendations",
",",
"cutoffs",
"=",
"[",
"10",
"]",
")",
":",
"assert",
"type",
"(",
"observed_user_items",
")",
"==",
"_SFrame",
"assert",
"type",
"(",
"recommendations",
")",
"==",
"_SFram... | Compute precision and recall at a given cutoff for each user. In information
retrieval terms, precision represents the ratio of relevant, retrieved items
to the number of relevant items. Recall represents the ratio of relevant,
retrieved items to the number of relevant items.
Let :math:`p_k` be a vecto... | [
"Compute",
"precision",
"and",
"recall",
"at",
"a",
"given",
"cutoff",
"for",
"each",
"user",
".",
"In",
"information",
"retrieval",
"terms",
"precision",
"represents",
"the",
"ratio",
"of",
"relevant",
"retrieved",
"items",
"to",
"the",
"number",
"of",
"relev... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L331-L427 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | random_split_by_user | def random_split_by_user(dataset,
user_id='user_id',
item_id='item_id',
max_num_users=1000,
item_test_proportion=.2,
random_seed=0):
"""Create a recommender-friendly train-test split of the p... | python | def random_split_by_user(dataset,
user_id='user_id',
item_id='item_id',
max_num_users=1000,
item_test_proportion=.2,
random_seed=0):
"""Create a recommender-friendly train-test split of the p... | [
"def",
"random_split_by_user",
"(",
"dataset",
",",
"user_id",
"=",
"'user_id'",
",",
"item_id",
"=",
"'item_id'",
",",
"max_num_users",
"=",
"1000",
",",
"item_test_proportion",
"=",
".2",
",",
"random_seed",
"=",
"0",
")",
":",
"assert",
"user_id",
"in",
"... | Create a recommender-friendly train-test split of the provided data set.
The test dataset is generated by first choosing `max_num_users` out of the
total number of users in `dataset`. Then, for each of the chosen test users,
a portion of the user's items (determined by `item_test_proportion`) is
random... | [
"Create",
"a",
"recommender",
"-",
"friendly",
"train",
"-",
"test",
"split",
"of",
"the",
"provided",
"data",
"set",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L430-L508 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender._list_fields | def _list_fields(self):
"""
Get the current settings of the model. The keys depend on the type of
model.
Returns
-------
out : list
A list of fields that can be queried using the ``get`` method.
"""
response = self.__proxy__.list_fields()
... | python | def _list_fields(self):
"""
Get the current settings of the model. The keys depend on the type of
model.
Returns
-------
out : list
A list of fields that can be queried using the ``get`` method.
"""
response = self.__proxy__.list_fields()
... | [
"def",
"_list_fields",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"__proxy__",
".",
"list_fields",
"(",
")",
"return",
"[",
"s",
"for",
"s",
"in",
"response",
"[",
"'value'",
"]",
"if",
"not",
"s",
".",
"startswith",
"(",
"\"_\"",
")",
"]"
... | Get the current settings of the model. The keys depend on the type of
model.
Returns
-------
out : list
A list of fields that can be queried using the ``get`` method. | [
"Get",
"the",
"current",
"settings",
"of",
"the",
"model",
".",
"The",
"keys",
"depend",
"on",
"the",
"type",
"of",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L543-L555 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender._get_summary_struct | 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... | python | 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",
")",
":",
"stats",
"=",
"self",
".",
"_list_fields",
"(",
")",
"options",
"=",
"self",
".",
"_get_current_options",
"(",
")",
"section_titles",
"=",
"[",
"]",
"sections",
"=",
"[",
"]",
"observation_columns",
"=",
... | 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... | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L634-L782 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender._set_current_options | def _set_current_options(self, options):
"""
Set current options for a model.
Parameters
----------
options : dict
A dictionary of the desired option settings. The key should be the name
of the option and each value is the desired value of the option.
... | python | def _set_current_options(self, options):
"""
Set current options for a model.
Parameters
----------
options : dict
A dictionary of the desired option settings. The key should be the name
of the option and each value is the desired value of the option.
... | [
"def",
"_set_current_options",
"(",
"self",
",",
"options",
")",
":",
"opts",
"=",
"self",
".",
"_get_current_options",
"(",
")",
"opts",
".",
"update",
"(",
"options",
")",
"response",
"=",
"self",
".",
"__proxy__",
".",
"set_current_options",
"(",
"opts",
... | Set current options for a model.
Parameters
----------
options : dict
A dictionary of the desired option settings. The key should be the name
of the option and each value is the desired value of the option. | [
"Set",
"current",
"options",
"for",
"a",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L804-L818 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.__prepare_dataset_parameter | def __prepare_dataset_parameter(self, dataset):
"""
Processes the dataset parameter for type correctness.
Returns it as an SFrame.
"""
# Translate the dataset argument into the proper type
if not isinstance(dataset, _SFrame):
def raise_dataset_type_exception(... | python | def __prepare_dataset_parameter(self, dataset):
"""
Processes the dataset parameter for type correctness.
Returns it as an SFrame.
"""
# Translate the dataset argument into the proper type
if not isinstance(dataset, _SFrame):
def raise_dataset_type_exception(... | [
"def",
"__prepare_dataset_parameter",
"(",
"self",
",",
"dataset",
")",
":",
"# Translate the dataset argument into the proper type",
"if",
"not",
"isinstance",
"(",
"dataset",
",",
"_SFrame",
")",
":",
"def",
"raise_dataset_type_exception",
"(",
")",
":",
"raise",
"T... | Processes the dataset parameter for type correctness.
Returns it as an SFrame. | [
"Processes",
"the",
"dataset",
"parameter",
"for",
"type",
"correctness",
".",
"Returns",
"it",
"as",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L820-L843 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender._get_data_schema | def _get_data_schema(self):
"""
Returns a dictionary of (column : type) for the data used in the
model.
"""
if not hasattr(self, "_data_schema"):
response = self.__proxy__.get_data_schema()
self._data_schema = {k : _turicreate._cython.cy_flexible_type.py... | python | def _get_data_schema(self):
"""
Returns a dictionary of (column : type) for the data used in the
model.
"""
if not hasattr(self, "_data_schema"):
response = self.__proxy__.get_data_schema()
self._data_schema = {k : _turicreate._cython.cy_flexible_type.py... | [
"def",
"_get_data_schema",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_data_schema\"",
")",
":",
"response",
"=",
"self",
".",
"__proxy__",
".",
"get_data_schema",
"(",
")",
"self",
".",
"_data_schema",
"=",
"{",
"k",
":",
"_turi... | Returns a dictionary of (column : type) for the data used in the
model. | [
"Returns",
"a",
"dictionary",
"of",
"(",
"column",
":",
"type",
")",
"for",
"the",
"data",
"used",
"in",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L845-L857 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.predict | def predict(self, dataset,
new_observation_data=None, new_user_data=None, new_item_data=None):
"""
Return a score prediction for the user ids and item ids in the provided
data set.
Parameters
----------
dataset : SFrame
Dataset in the same for... | python | def predict(self, dataset,
new_observation_data=None, new_user_data=None, new_item_data=None):
"""
Return a score prediction for the user ids and item ids in the provided
data set.
Parameters
----------
dataset : SFrame
Dataset in the same for... | [
"def",
"predict",
"(",
"self",
",",
"dataset",
",",
"new_observation_data",
"=",
"None",
",",
"new_user_data",
"=",
"None",
",",
"new_item_data",
"=",
"None",
")",
":",
"if",
"new_observation_data",
"is",
"None",
":",
"new_observation_data",
"=",
"_SFrame",
"(... | Return a score prediction for the user ids and item ids in the provided
data set.
Parameters
----------
dataset : SFrame
Dataset in the same form used for training.
new_observation_data : SFrame, optional
``new_observation_data`` gives additional observa... | [
"Return",
"a",
"score",
"prediction",
"for",
"the",
"user",
"ids",
"and",
"item",
"ids",
"in",
"the",
"provided",
"data",
"set",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L859-L925 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.get_similar_items | def get_similar_items(self, items=None, k=10, verbose=False):
"""
Get the k most similar items for each item in items.
Each type of recommender has its own model for the similarity
between items. For example, the item_similarity_recommender will
return the most similar items acc... | python | def get_similar_items(self, items=None, k=10, verbose=False):
"""
Get the k most similar items for each item in items.
Each type of recommender has its own model for the similarity
between items. For example, the item_similarity_recommender will
return the most similar items acc... | [
"def",
"get_similar_items",
"(",
"self",
",",
"items",
"=",
"None",
",",
"k",
"=",
"10",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"items",
"is",
"None",
":",
"get_all_items",
"=",
"True",
"items",
"=",
"_SArray",
"(",
")",
"else",
":",
"get_all_... | Get the k most similar items for each item in items.
Each type of recommender has its own model for the similarity
between items. For example, the item_similarity_recommender will
return the most similar items according to the user-chosen
similarity; the factorization_recommender will r... | [
"Get",
"the",
"k",
"most",
"similar",
"items",
"for",
"each",
"item",
"in",
"items",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L927-L988 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.get_similar_users | def get_similar_users(self, users=None, k=10):
"""Get the k most similar users for each entry in `users`.
Each type of recommender has its own model for the similarity
between users. For example, the factorization_recommender will
return the nearest users based on the cosine similarity
... | python | def get_similar_users(self, users=None, k=10):
"""Get the k most similar users for each entry in `users`.
Each type of recommender has its own model for the similarity
between users. For example, the factorization_recommender will
return the nearest users based on the cosine similarity
... | [
"def",
"get_similar_users",
"(",
"self",
",",
"users",
"=",
"None",
",",
"k",
"=",
"10",
")",
":",
"if",
"users",
"is",
"None",
":",
"get_all_users",
"=",
"True",
"users",
"=",
"_SArray",
"(",
")",
"else",
":",
"get_all_users",
"=",
"False",
"if",
"i... | Get the k most similar users for each entry in `users`.
Each type of recommender has its own model for the similarity
between users. For example, the factorization_recommender will
return the nearest users based on the cosine similarity
between latent user factors. (This method is not ... | [
"Get",
"the",
"k",
"most",
"similar",
"users",
"for",
"each",
"entry",
"in",
"users",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L990-L1053 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.recommend | def recommend(self, users=None, k=10, exclude=None, items=None,
new_observation_data=None, new_user_data=None, new_item_data=None,
exclude_known=True, diversity=0, random_seed=None,
verbose=True):
"""
Recommend the ``k`` highest scored items for each... | python | def recommend(self, users=None, k=10, exclude=None, items=None,
new_observation_data=None, new_user_data=None, new_item_data=None,
exclude_known=True, diversity=0, random_seed=None,
verbose=True):
"""
Recommend the ``k`` highest scored items for each... | [
"def",
"recommend",
"(",
"self",
",",
"users",
"=",
"None",
",",
"k",
"=",
"10",
",",
"exclude",
"=",
"None",
",",
"items",
"=",
"None",
",",
"new_observation_data",
"=",
"None",
",",
"new_user_data",
"=",
"None",
",",
"new_item_data",
"=",
"None",
","... | Recommend the ``k`` highest scored items for each user.
Parameters
----------
users : SArray, SFrame, or list, optional
Users or observation queries for which to make recommendations.
For list, SArray, and single-column inputs, this is simply a set
of user I... | [
"Recommend",
"the",
"k",
"highest",
"scored",
"items",
"for",
"each",
"user",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1056-L1308 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.recommend_from_interactions | def recommend_from_interactions(
self, observed_items, k=10, exclude=None, items=None,
new_user_data=None, new_item_data=None,
exclude_known=True, diversity=0, random_seed=None,
verbose=True):
"""
Recommend the ``k`` highest scored items based on the
... | python | def recommend_from_interactions(
self, observed_items, k=10, exclude=None, items=None,
new_user_data=None, new_item_data=None,
exclude_known=True, diversity=0, random_seed=None,
verbose=True):
"""
Recommend the ``k`` highest scored items based on the
... | [
"def",
"recommend_from_interactions",
"(",
"self",
",",
"observed_items",
",",
"k",
"=",
"10",
",",
"exclude",
"=",
"None",
",",
"items",
"=",
"None",
",",
"new_user_data",
"=",
"None",
",",
"new_item_data",
"=",
"None",
",",
"exclude_known",
"=",
"True",
... | Recommend the ``k`` highest scored items based on the
interactions given in `observed_items.`
Parameters
----------
observed_items : SArray, SFrame, or list
A list/SArray of items to use to make recommendations, or
an SFrame of items and optionally ratings and/or... | [
"Recommend",
"the",
"k",
"highest",
"scored",
"items",
"based",
"on",
"the",
"interactions",
"given",
"in",
"observed_items",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1310-L1470 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.evaluate_precision_recall | def evaluate_precision_recall(self, dataset, cutoffs=list(range(1,11,1))+list(range(11,50,5)),
skip_set=None, exclude_known=True,
verbose=True, **kwargs):
"""
Compute a model's precision and recall scores for a particular dataset.
... | python | def evaluate_precision_recall(self, dataset, cutoffs=list(range(1,11,1))+list(range(11,50,5)),
skip_set=None, exclude_known=True,
verbose=True, **kwargs):
"""
Compute a model's precision and recall scores for a particular dataset.
... | [
"def",
"evaluate_precision_recall",
"(",
"self",
",",
"dataset",
",",
"cutoffs",
"=",
"list",
"(",
"range",
"(",
"1",
",",
"11",
",",
"1",
")",
")",
"+",
"list",
"(",
"range",
"(",
"11",
",",
"50",
",",
"5",
")",
")",
",",
"skip_set",
"=",
"None"... | Compute a model's precision and recall scores for a particular dataset.
Parameters
----------
dataset : SFrame
An SFrame in the same format as the one used during training.
This will be compared to the model's recommendations, which exclude
the (user, item) p... | [
"Compute",
"a",
"model",
"s",
"precision",
"and",
"recall",
"scores",
"for",
"a",
"particular",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1492-L1574 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.evaluate_rmse | def evaluate_rmse(self, dataset, target):
"""
Evaluate the prediction error for each user-item pair in the given data
set.
Parameters
----------
dataset : SFrame
An SFrame in the same format as the one used during training.
target : str
T... | python | def evaluate_rmse(self, dataset, target):
"""
Evaluate the prediction error for each user-item pair in the given data
set.
Parameters
----------
dataset : SFrame
An SFrame in the same format as the one used during training.
target : str
T... | [
"def",
"evaluate_rmse",
"(",
"self",
",",
"dataset",
",",
"target",
")",
":",
"assert",
"target",
"in",
"dataset",
".",
"column_names",
"(",
")",
",",
"'Provided dataset must contain a target column with the same \\\n name as the target used during training.'",
... | Evaluate the prediction error for each user-item pair in the given data
set.
Parameters
----------
dataset : SFrame
An SFrame in the same format as the one used during training.
target : str
The name of the target rating column in `dataset`.
Ret... | [
"Evaluate",
"the",
"prediction",
"error",
"for",
"each",
"user",
"-",
"item",
"pair",
"in",
"the",
"given",
"data",
"set",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1576-L1635 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.evaluate | def evaluate(self, dataset, metric='auto',
exclude_known_for_precision_recall=True,
target=None,
verbose=True, **kwargs):
r"""
Evaluate the model's ability to make rating predictions or
recommendations.
If the model is trained to predic... | python | def evaluate(self, dataset, metric='auto',
exclude_known_for_precision_recall=True,
target=None,
verbose=True, **kwargs):
r"""
Evaluate the model's ability to make rating predictions or
recommendations.
If the model is trained to predic... | [
"def",
"evaluate",
"(",
"self",
",",
"dataset",
",",
"metric",
"=",
"'auto'",
",",
"exclude_known_for_precision_recall",
"=",
"True",
",",
"target",
"=",
"None",
",",
"verbose",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"dat... | r"""
Evaluate the model's ability to make rating predictions or
recommendations.
If the model is trained to predict a particular target, the
default metric used for model comparison is root-mean-squared error
(RMSE). Suppose :math:`y` and :math:`\widehat{y}` are vectors of lengt... | [
"r",
"Evaluate",
"the",
"model",
"s",
"ability",
"to",
"make",
"rating",
"predictions",
"or",
"recommendations",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1637-L1761 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender._get_popularity_baseline | def _get_popularity_baseline(self):
"""
Returns a new popularity model matching the data set this model was
trained with. Can be used for comparison purposes.
"""
response = self.__proxy__.get_popularity_baseline()
from .popularity_recommender import PopularityRecommen... | python | def _get_popularity_baseline(self):
"""
Returns a new popularity model matching the data set this model was
trained with. Can be used for comparison purposes.
"""
response = self.__proxy__.get_popularity_baseline()
from .popularity_recommender import PopularityRecommen... | [
"def",
"_get_popularity_baseline",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"__proxy__",
".",
"get_popularity_baseline",
"(",
")",
"from",
".",
"popularity_recommender",
"import",
"PopularityRecommender",
"return",
"PopularityRecommender",
"(",
"response",
... | Returns a new popularity model matching the data set this model was
trained with. Can be used for comparison purposes. | [
"Returns",
"a",
"new",
"popularity",
"model",
"matching",
"the",
"data",
"set",
"this",
"model",
"was",
"trained",
"with",
".",
"Can",
"be",
"used",
"for",
"comparison",
"purposes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1763-L1772 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender._get_item_intersection_info | def _get_item_intersection_info(self, item_pairs):
"""
For a collection of item -> item pairs, returns information about the
users in that intersection.
Parameters
----------
item_pairs : 2-column SFrame of two item columns, or a list of
(item_1, item_2) tupl... | python | def _get_item_intersection_info(self, item_pairs):
"""
For a collection of item -> item pairs, returns information about the
users in that intersection.
Parameters
----------
item_pairs : 2-column SFrame of two item columns, or a list of
(item_1, item_2) tupl... | [
"def",
"_get_item_intersection_info",
"(",
"self",
",",
"item_pairs",
")",
":",
"if",
"type",
"(",
"item_pairs",
")",
"is",
"list",
":",
"if",
"not",
"all",
"(",
"type",
"(",
"t",
")",
"in",
"[",
"list",
",",
"tuple",
"]",
"and",
"len",
"(",
"t",
"... | For a collection of item -> item pairs, returns information about the
users in that intersection.
Parameters
----------
item_pairs : 2-column SFrame of two item columns, or a list of
(item_1, item_2) tuples.
Returns
-------
out : SFrame
A ... | [
"For",
"a",
"collection",
"of",
"item",
"-",
">",
"item",
"pairs",
"returns",
"information",
"about",
"the",
"users",
"in",
"that",
"intersection",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1774-L1809 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/recommender/util.py | _Recommender.export_coreml | def export_coreml(self, filename):
"""
Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml('myModel.mlmodel')
"""
print... | python | def export_coreml(self, filename):
"""
Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml('myModel.mlmodel')
"""
print... | [
"def",
"export_coreml",
"(",
"self",
",",
"filename",
")",
":",
"print",
"(",
"'This model is exported as a custom Core ML model. In order to use it in your\\n'",
"'application, you must also include \"libRecommender.dylib\". For additional\\n'",
"'details see:\\n'",
"'https://apple.github... | 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') | [
"Export",
"the",
"model",
"in",
"Core",
"ML",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L1811-L1830 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/regression/random_forest_regression.py | RandomForestRegression.evaluate | def evaluate(self, dataset, metric='auto', missing_value_action='auto'):
"""
Evaluate the model on the given dataset.
Parameters
----------
dataset : SFrame
Dataset in the same format used for training. The columns names and
types of the dataset must be ... | python | def evaluate(self, dataset, metric='auto', missing_value_action='auto'):
"""
Evaluate the model on the given dataset.
Parameters
----------
dataset : SFrame
Dataset in the same format used for training. The columns names and
types of the dataset must be ... | [
"def",
"evaluate",
"(",
"self",
",",
"dataset",
",",
"metric",
"=",
"'auto'",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"_raise_error_evaluation_metric_is_valid",
"(",
"metric",
",",
"[",
"'auto'",
",",
"'rmse'",
",",
"'max_error'",
"]",
")",
"retu... | Evaluate the model on the given dataset.
Parameters
----------
dataset : SFrame
Dataset in the same format used for training. The columns names and
types of the dataset must be the same as that used in training.
metric : str, optional
Name of the ev... | [
"Evaluate",
"the",
"model",
"on",
"the",
"given",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/random_forest_regression.py#L179-L228 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/regression/random_forest_regression.py | RandomForestRegression.predict | def predict(self, dataset, missing_value_action='auto'):
"""
Predict the target column of the given dataset.
The target column is provided during
:func:`~turicreate.random_forest_regression.create`. If the target column is in the
`dataset` it will be ignored.
Parameters... | python | def predict(self, dataset, missing_value_action='auto'):
"""
Predict the target column of the given dataset.
The target column is provided during
:func:`~turicreate.random_forest_regression.create`. If the target column is in the
`dataset` it will be ignored.
Parameters... | [
"def",
"predict",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"return",
"super",
"(",
"RandomForestRegression",
",",
"self",
")",
".",
"predict",
"(",
"dataset",
",",
"output_type",
"=",
"'margin'",
",",
"missing_value_ac... | Predict the target column of the given dataset.
The target column is provided during
:func:`~turicreate.random_forest_regression.create`. If the target column is in the
`dataset` it will be ignored.
Parameters
----------
dataset : SFrame
A dataset that has the... | [
"Predict",
"the",
"target",
"column",
"of",
"the",
"given",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/random_forest_regression.py#L230-L272 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/feature_vectorizer.py | create_feature_vectorizer | def create_feature_vectorizer(input_features, output_feature_name,
known_size_map = {}):
"""
Creates a feature vectorizer from input features, return the spec for
a feature vectorizer that puts everything into a single array of length
equal to the total size of all the inpu... | python | def create_feature_vectorizer(input_features, output_feature_name,
known_size_map = {}):
"""
Creates a feature vectorizer from input features, return the spec for
a feature vectorizer that puts everything into a single array of length
equal to the total size of all the inpu... | [
"def",
"create_feature_vectorizer",
"(",
"input_features",
",",
"output_feature_name",
",",
"known_size_map",
"=",
"{",
"}",
")",
":",
"spec",
"=",
"_Model_pb2",
".",
"Model",
"(",
")",
"spec",
".",
"specificationVersion",
"=",
"SPECIFICATION_VERSION",
"input_featur... | Creates a feature vectorizer from input features, return the spec for
a feature vectorizer that puts everything into a single array of length
equal to the total size of all the input features. Returns a 2-tuple
`(spec, num_dimension)`
Parameters
----------
input_features: [list of 2-tuples]
... | [
"Creates",
"a",
"feature",
"vectorizer",
"from",
"input",
"features",
"return",
"the",
"spec",
"for",
"a",
"feature",
"vectorizer",
"that",
"puts",
"everything",
"into",
"a",
"single",
"array",
"of",
"length",
"equal",
"to",
"the",
"total",
"size",
"of",
"al... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/feature_vectorizer.py#L15-L94 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/predef/tools/ci/common.py | utils.query_boost_version | def query_boost_version(boost_root):
'''
Read in the Boost version from a given boost_root.
'''
boost_version = None
if os.path.exists(os.path.join(boost_root,'Jamroot')):
with codecs.open(os.path.join(boost_root,'Jamroot'), 'r', 'utf-8') as f:
for lin... | python | def query_boost_version(boost_root):
'''
Read in the Boost version from a given boost_root.
'''
boost_version = None
if os.path.exists(os.path.join(boost_root,'Jamroot')):
with codecs.open(os.path.join(boost_root,'Jamroot'), 'r', 'utf-8') as f:
for lin... | [
"def",
"query_boost_version",
"(",
"boost_root",
")",
":",
"boost_version",
"=",
"None",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"boost_root",
",",
"'Jamroot'",
")",
")",
":",
"with",
"codecs",
".",
"open",
"("... | Read in the Boost version from a given boost_root. | [
"Read",
"in",
"the",
"Boost",
"version",
"from",
"a",
"given",
"boost_root",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L421-L435 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/predef/tools/ci/common.py | utils.git_clone | def git_clone(sub_repo, branch, commit = None, cwd = None, no_submodules = False):
'''
This clone mimicks the way Travis-CI clones a project's repo. So far
Travis-CI is the most limiting in the sense of only fetching partial
history of the repo.
'''
if not cwd:
... | python | def git_clone(sub_repo, branch, commit = None, cwd = None, no_submodules = False):
'''
This clone mimicks the way Travis-CI clones a project's repo. So far
Travis-CI is the most limiting in the sense of only fetching partial
history of the repo.
'''
if not cwd:
... | [
"def",
"git_clone",
"(",
"sub_repo",
",",
"branch",
",",
"commit",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"no_submodules",
"=",
"False",
")",
":",
"if",
"not",
"cwd",
":",
"cwd",
"=",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
"root_dir",
"=",
... | This clone mimicks the way Travis-CI clones a project's repo. So far
Travis-CI is the most limiting in the sense of only fetching partial
history of the repo. | [
"This",
"clone",
"mimicks",
"the",
"way",
"Travis",
"-",
"CI",
"clones",
"a",
"project",
"s",
"repo",
".",
"So",
"far",
"Travis",
"-",
"CI",
"is",
"the",
"most",
"limiting",
"in",
"the",
"sense",
"of",
"only",
"fetching",
"partial",
"history",
"of",
"t... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L438-L471 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/predef/tools/ci/common.py | ci_travis.install_toolset | def install_toolset(self, toolset):
'''
Installs specific toolset on CI system.
'''
info = toolset_info[toolset]
if sys.platform.startswith('linux'):
os.chdir(self.work_dir)
if 'ppa' in info:
for ppa in info['ppa']:
util... | python | def install_toolset(self, toolset):
'''
Installs specific toolset on CI system.
'''
info = toolset_info[toolset]
if sys.platform.startswith('linux'):
os.chdir(self.work_dir)
if 'ppa' in info:
for ppa in info['ppa']:
util... | [
"def",
"install_toolset",
"(",
"self",
",",
"toolset",
")",
":",
"info",
"=",
"toolset_info",
"[",
"toolset",
"]",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'linux'",
")",
":",
"os",
".",
"chdir",
"(",
"self",
".",
"work_dir",
")",
"if",
... | Installs specific toolset on CI system. | [
"Installs",
"specific",
"toolset",
"on",
"CI",
"system",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/common.py#L683-L709 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/svm_classifier.py | create | def create(dataset, target, features=None,
penalty=1.0, solver='auto',
feature_rescaling=True,
convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'],
lbfgs_memory_level = _DEFAULT_SOLVER_OPTIONS['lbfgs_memory_level'],
max_iterations = _DEFAULT_SOLVER_OPTIONS['max_iterations'],
... | python | def create(dataset, target, features=None,
penalty=1.0, solver='auto',
feature_rescaling=True,
convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'],
lbfgs_memory_level = _DEFAULT_SOLVER_OPTIONS['lbfgs_memory_level'],
max_iterations = _DEFAULT_SOLVER_OPTIONS['max_iterations'],
... | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"features",
"=",
"None",
",",
"penalty",
"=",
"1.0",
",",
"solver",
"=",
"'auto'",
",",
"feature_rescaling",
"=",
"True",
",",
"convergence_threshold",
"=",
"_DEFAULT_SOLVER_OPTIONS",
"[",
"'convergence_thresh... | Create a :class:`~turicreate.svm_classifier.SVMClassifier` to predict the class of a binary
target variable based on a model of which side of a hyperplane the example
falls on. In addition to standard numeric and categorical types, features
can also be extracted automatically from list- or dictionary-type S... | [
"Create",
"a",
":",
"class",
":",
"~turicreate",
".",
"svm_classifier",
".",
"SVMClassifier",
"to",
"predict",
"the",
"class",
"of",
"a",
"binary",
"target",
"variable",
"based",
"on",
"a",
"model",
"of",
"which",
"side",
"of",
"a",
"hyperplane",
"the",
"e... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/svm_classifier.py#L27-L226 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/svm_classifier.py | SVMClassifier.classify | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained SVM model. The output SFrame contains predictions
as class labels (0 or 1) associated with the the example.
Parameters
----------... | python | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained SVM model. The output SFrame contains predictions
as class labels (0 or 1) associated with the the example.
Parameters
----------... | [
"def",
"classify",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"return",
"super",
"(",
"SVMClassifier",
",",
"self",
")",
".",
"classify",
"(",
"dataset",
",",
"missing_value_action",
"=",
"missing_value_action",
")"
] | Return a classification, for each example in the ``dataset``, using the
trained SVM model. The output SFrame contains predictions
as class labels (0 or 1) associated with the the example.
Parameters
----------
dataset : SFrame
Dataset of new observations. Must includ... | [
"Return",
"a",
"classification",
"for",
"each",
"example",
"in",
"the",
"dataset",
"using",
"the",
"trained",
"SVM",
"model",
".",
"The",
"output",
"SFrame",
"contains",
"predictions",
"as",
"class",
"labels",
"(",
"0",
"or",
"1",
")",
"associated",
"with",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/svm_classifier.py#L521-L566 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py | _get_layer_converter_fn | def _get_layer_converter_fn(layer, add_custom_layers = False):
"""Get the right converter function for Keras
"""
layer_type = type(layer)
if layer_type in _KERAS_LAYER_REGISTRY:
convert_func = _KERAS_LAYER_REGISTRY[layer_type]
if convert_func is _layers2.convert_activation:
a... | python | def _get_layer_converter_fn(layer, add_custom_layers = False):
"""Get the right converter function for Keras
"""
layer_type = type(layer)
if layer_type in _KERAS_LAYER_REGISTRY:
convert_func = _KERAS_LAYER_REGISTRY[layer_type]
if convert_func is _layers2.convert_activation:
a... | [
"def",
"_get_layer_converter_fn",
"(",
"layer",
",",
"add_custom_layers",
"=",
"False",
")",
":",
"layer_type",
"=",
"type",
"(",
"layer",
")",
"if",
"layer_type",
"in",
"_KERAS_LAYER_REGISTRY",
":",
"convert_func",
"=",
"_KERAS_LAYER_REGISTRY",
"[",
"layer_type",
... | Get the right converter function for Keras | [
"Get",
"the",
"right",
"converter",
"function",
"for",
"Keras"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py#L117-L131 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py | _load_keras_model | def _load_keras_model(model_network_path, model_weight_path, custom_objects=None):
"""Load a keras model from disk
Parameters
----------
model_network_path: str
Path where the model network path is (json file)
model_weight_path: str
Path where the model network weights are (hd5 fil... | python | def _load_keras_model(model_network_path, model_weight_path, custom_objects=None):
"""Load a keras model from disk
Parameters
----------
model_network_path: str
Path where the model network path is (json file)
model_weight_path: str
Path where the model network weights are (hd5 fil... | [
"def",
"_load_keras_model",
"(",
"model_network_path",
",",
"model_weight_path",
",",
"custom_objects",
"=",
"None",
")",
":",
"from",
"keras",
".",
"models",
"import",
"model_from_json",
"import",
"json",
"# Load the model network",
"json_file",
"=",
"open",
"(",
"... | Load a keras model from disk
Parameters
----------
model_network_path: str
Path where the model network path is (json file)
model_weight_path: str
Path where the model network weights are (hd5 file)
custom_objects:
A dictionary of layers or other custom classes
or ... | [
"Load",
"a",
"keras",
"model",
"from",
"disk"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras2_converter.py#L134-L168 | train |
apple/turicreate | src/unity/python/turicreate/visualization/_plot.py | Plot.show | def show(self):
"""
A method for displaying the Plot object
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visualization.set_target` (defaults to 'auto').
... | python | def show(self):
"""
A method for displaying the Plot object
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visualization.set_target` (defaults to 'auto').
... | [
"def",
"show",
"(",
"self",
")",
":",
"global",
"_target",
"display",
"=",
"False",
"try",
":",
"if",
"_target",
"==",
"'auto'",
"and",
"get_ipython",
"(",
")",
".",
"__class__",
".",
"__name__",
"==",
"\"ZMQInteractiveShell\"",
":",
"self",
".",
"_repr_ja... | A method for displaying the Plot object
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visualization.set_target` (defaults to 'auto').
Examples
--------
... | [
"A",
"method",
"for",
"displaying",
"the",
"Plot",
"object"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/_plot.py#L104-L142 | train |
apple/turicreate | src/unity/python/turicreate/visualization/_plot.py | Plot.save | def save(self, filepath):
"""
A method for saving the Plot object in a vega representation
Parameters
----------
filepath: string
The destination filepath where the plot object must be saved as.
The extension of this filepath determines what format the pl... | python | def save(self, filepath):
"""
A method for saving the Plot object in a vega representation
Parameters
----------
filepath: string
The destination filepath where the plot object must be saved as.
The extension of this filepath determines what format the pl... | [
"def",
"save",
"(",
"self",
",",
"filepath",
")",
":",
"if",
"type",
"(",
"filepath",
")",
"!=",
"str",
":",
"raise",
"ValueError",
"(",
"\"filepath provided is not a string\"",
")",
"if",
"filepath",
".",
"endswith",
"(",
"\".json\"",
")",
":",
"# save as v... | A method for saving the Plot object in a vega representation
Parameters
----------
filepath: string
The destination filepath where the plot object must be saved as.
The extension of this filepath determines what format the plot will
be saved as. Currently sup... | [
"A",
"method",
"for",
"saving",
"the",
"Plot",
"object",
"in",
"a",
"vega",
"representation"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/_plot.py#L144-L248 | train |
apple/turicreate | src/external/xgboost/subtree/rabit/tracker/rabit_demo.py | mthread_submit | def mthread_submit(nslave, worker_args, worker_envs):
"""
customized submit script, that submit nslave jobs, each must contain args as parameter
note this can be a lambda function containing additional parameters in input
Parameters
nslave number of slave process to start up
args... | python | def mthread_submit(nslave, worker_args, worker_envs):
"""
customized submit script, that submit nslave jobs, each must contain args as parameter
note this can be a lambda function containing additional parameters in input
Parameters
nslave number of slave process to start up
args... | [
"def",
"mthread_submit",
"(",
"nslave",
",",
"worker_args",
",",
"worker_envs",
")",
":",
"procs",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"(",
"nslave",
")",
":",
"procs",
"[",
"i",
"]",
"=",
"Thread",
"(",
"target",
"=",
"exec_cmd",
",",
"args",
... | customized submit script, that submit nslave jobs, each must contain args as parameter
note this can be a lambda function containing additional parameters in input
Parameters
nslave number of slave process to start up
args arguments to launch each job
this usually includes th... | [
"customized",
"submit",
"script",
"that",
"submit",
"nslave",
"jobs",
"each",
"must",
"contain",
"args",
"as",
"parameter",
"note",
"this",
"can",
"be",
"a",
"lambda",
"function",
"containing",
"additional",
"parameters",
"in",
"input",
"Parameters",
"nslave",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_demo.py#L78-L93 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py | _get_value | def _get_value(scikit_value, mode = 'regressor', scaling = 1.0, n_classes = 2, tree_index = 0):
""" Get the right value from the scikit-tree
"""
# Regression
if mode == 'regressor':
return scikit_value[0] * scaling
# Binary classification
if n_classes == 2:
# Decision tree
... | python | def _get_value(scikit_value, mode = 'regressor', scaling = 1.0, n_classes = 2, tree_index = 0):
""" Get the right value from the scikit-tree
"""
# Regression
if mode == 'regressor':
return scikit_value[0] * scaling
# Binary classification
if n_classes == 2:
# Decision tree
... | [
"def",
"_get_value",
"(",
"scikit_value",
",",
"mode",
"=",
"'regressor'",
",",
"scaling",
"=",
"1.0",
",",
"n_classes",
"=",
"2",
",",
"tree_index",
"=",
"0",
")",
":",
"# Regression",
"if",
"mode",
"==",
"'regressor'",
":",
"return",
"scikit_value",
"[",... | Get the right value from the scikit-tree | [
"Get",
"the",
"right",
"value",
"from",
"the",
"scikit",
"-",
"tree"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L16-L42 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py | _recurse | def _recurse(coreml_tree, scikit_tree, tree_id, node_id, scaling = 1.0, mode = 'regressor',
n_classes = 2, tree_index = 0):
"""Traverse through the tree and append to the tree spec.
"""
if not(HAS_SKLEARN):
raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disab... | python | def _recurse(coreml_tree, scikit_tree, tree_id, node_id, scaling = 1.0, mode = 'regressor',
n_classes = 2, tree_index = 0):
"""Traverse through the tree and append to the tree spec.
"""
if not(HAS_SKLEARN):
raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disab... | [
"def",
"_recurse",
"(",
"coreml_tree",
",",
"scikit_tree",
",",
"tree_id",
",",
"node_id",
",",
"scaling",
"=",
"1.0",
",",
"mode",
"=",
"'regressor'",
",",
"n_classes",
"=",
"2",
",",
"tree_index",
"=",
"0",
")",
":",
"if",
"not",
"(",
"HAS_SKLEARN",
... | Traverse through the tree and append to the tree spec. | [
"Traverse",
"through",
"the",
"tree",
"and",
"append",
"to",
"the",
"tree",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L44-L77 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py | convert_tree_ensemble | def convert_tree_ensemble(model, input_features,
output_features = ('predicted_class', float),
mode = 'regressor',
base_prediction = None,
class_labels = None,
post_evaluation_transform = No... | python | def convert_tree_ensemble(model, input_features,
output_features = ('predicted_class', float),
mode = 'regressor',
base_prediction = None,
class_labels = None,
post_evaluation_transform = No... | [
"def",
"convert_tree_ensemble",
"(",
"model",
",",
"input_features",
",",
"output_features",
"=",
"(",
"'predicted_class'",
",",
"float",
")",
",",
"mode",
"=",
"'regressor'",
",",
"base_prediction",
"=",
"None",
",",
"class_labels",
"=",
"None",
",",
"post_eval... | Convert a generic tree regressor model to the protobuf spec.
This currently supports:
* Decision tree regression
* Gradient boosted tree regression
* Random forest regression
* Decision tree classifier.
* Gradient boosted tree classifier.
* Random forest classifier.
-------... | [
"Convert",
"a",
"generic",
"tree",
"regressor",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_tree_ensemble.py#L97-L199 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py | _vgg16_data_prep | def _vgg16_data_prep(batch):
"""
Takes images scaled to [0, 1] and returns them appropriately scaled and
mean-subtracted for VGG-16
"""
from mxnet import nd
mean = nd.array([123.68, 116.779, 103.939], ctx=batch.context)
return nd.broadcast_sub(255 * batch, mean.reshape((-1, 1, 1))) | python | def _vgg16_data_prep(batch):
"""
Takes images scaled to [0, 1] and returns them appropriately scaled and
mean-subtracted for VGG-16
"""
from mxnet import nd
mean = nd.array([123.68, 116.779, 103.939], ctx=batch.context)
return nd.broadcast_sub(255 * batch, mean.reshape((-1, 1, 1))) | [
"def",
"_vgg16_data_prep",
"(",
"batch",
")",
":",
"from",
"mxnet",
"import",
"nd",
"mean",
"=",
"nd",
".",
"array",
"(",
"[",
"123.68",
",",
"116.779",
",",
"103.939",
"]",
",",
"ctx",
"=",
"batch",
".",
"context",
")",
"return",
"nd",
".",
"broadca... | Takes images scaled to [0, 1] and returns them appropriately scaled and
mean-subtracted for VGG-16 | [
"Takes",
"images",
"scaled",
"to",
"[",
"0",
"1",
"]",
"and",
"returns",
"them",
"appropriately",
"scaled",
"and",
"mean",
"-",
"subtracted",
"for",
"VGG",
"-",
"16"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L26-L33 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py | create | def create(style_dataset, content_dataset, style_feature=None,
content_feature=None, max_iterations=None, model='resnet-16',
verbose=True, batch_size = 6, **kwargs):
"""
Create a :class:`StyleTransfer` model.
Parameters
----------
style_dataset: SFrame
Input style images. Th... | python | def create(style_dataset, content_dataset, style_feature=None,
content_feature=None, max_iterations=None, model='resnet-16',
verbose=True, batch_size = 6, **kwargs):
"""
Create a :class:`StyleTransfer` model.
Parameters
----------
style_dataset: SFrame
Input style images. Th... | [
"def",
"create",
"(",
"style_dataset",
",",
"content_dataset",
",",
"style_feature",
"=",
"None",
",",
"content_feature",
"=",
"None",
",",
"max_iterations",
"=",
"None",
",",
"model",
"=",
"'resnet-16'",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
... | Create a :class:`StyleTransfer` model.
Parameters
----------
style_dataset: SFrame
Input style images. The columns named by the ``style_feature`` parameters will
be extracted for training the model.
content_dataset : SFrame
Input content images. The columns named by the ``conte... | [
"Create",
"a",
":",
"class",
":",
"StyleTransfer",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L35-L402 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py | StyleTransfer._canonize_content_input | def _canonize_content_input(self, dataset, single_style):
"""
Takes input and returns tuple of the input in canonical form (SFrame)
along with an unpack callback function that can be applied to
prediction results to "undo" the canonization.
"""
unpack = lambda x: x
... | python | def _canonize_content_input(self, dataset, single_style):
"""
Takes input and returns tuple of the input in canonical form (SFrame)
along with an unpack callback function that can be applied to
prediction results to "undo" the canonization.
"""
unpack = lambda x: x
... | [
"def",
"_canonize_content_input",
"(",
"self",
",",
"dataset",
",",
"single_style",
")",
":",
"unpack",
"=",
"lambda",
"x",
":",
"x",
"if",
"isinstance",
"(",
"dataset",
",",
"_tc",
".",
"SArray",
")",
":",
"dataset",
"=",
"_tc",
".",
"SFrame",
"(",
"{... | Takes input and returns tuple of the input in canonical form (SFrame)
along with an unpack callback function that can be applied to
prediction results to "undo" the canonization. | [
"Takes",
"input",
"and",
"returns",
"tuple",
"of",
"the",
"input",
"in",
"canonical",
"form",
"(",
"SFrame",
")",
"along",
"with",
"an",
"unpack",
"callback",
"function",
"that",
"can",
"be",
"applied",
"to",
"prediction",
"results",
"to",
"undo",
"the",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L542-L557 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py | StyleTransfer.stylize | def stylize(self, images, style=None, verbose=True, max_size=800, batch_size = 4):
"""
Stylize an SFrame of Images given a style index or a list of
styles.
Parameters
----------
images : SFrame | Image
A dataset that has the same content image column that was... | python | def stylize(self, images, style=None, verbose=True, max_size=800, batch_size = 4):
"""
Stylize an SFrame of Images given a style index or a list of
styles.
Parameters
----------
images : SFrame | Image
A dataset that has the same content image column that was... | [
"def",
"stylize",
"(",
"self",
",",
"images",
",",
"style",
"=",
"None",
",",
"verbose",
"=",
"True",
",",
"max_size",
"=",
"800",
",",
"batch_size",
"=",
"4",
")",
":",
"if",
"(",
"batch_size",
"<",
"1",
")",
":",
"raise",
"_ToolkitError",
"(",
"\... | Stylize an SFrame of Images given a style index or a list of
styles.
Parameters
----------
images : SFrame | Image
A dataset that has the same content image column that was used
during training.
style : int or list, optional
The selected styl... | [
"Stylize",
"an",
"SFrame",
"of",
"Images",
"given",
"a",
"style",
"index",
"or",
"a",
"list",
"of",
"styles",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L559-L754 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py | StyleTransfer.export_coreml | def export_coreml(self, path, image_shape=(256, 256),
include_flexible_shape=True):
"""
Save the model in Core ML format. The Core ML model takes an image of
fixed size, and a style index inputs and produces an output
of an image of fixed size
Parameters
-------... | python | def export_coreml(self, path, image_shape=(256, 256),
include_flexible_shape=True):
"""
Save the model in Core ML format. The Core ML model takes an image of
fixed size, and a style index inputs and produces an output
of an image of fixed size
Parameters
-------... | [
"def",
"export_coreml",
"(",
"self",
",",
"path",
",",
"image_shape",
"=",
"(",
"256",
",",
"256",
")",
",",
"include_flexible_shape",
"=",
"True",
")",
":",
"import",
"mxnet",
"as",
"_mx",
"from",
".",
".",
"_mxnet",
".",
"_mxnet_to_coreml",
"import",
"... | Save the model in Core ML format. The Core ML model takes an image of
fixed size, and a style index inputs and produces an output
of an image of fixed size
Parameters
----------
path : string
A string to the path for saving the Core ML model.
image_shape: tu... | [
"Save",
"the",
"model",
"in",
"Core",
"ML",
"format",
".",
"The",
"Core",
"ML",
"model",
"takes",
"an",
"image",
"of",
"fixed",
"size",
"and",
"a",
"style",
"index",
"inputs",
"and",
"produces",
"an",
"output",
"of",
"an",
"image",
"of",
"fixed",
"size... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L770-L874 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py | StyleTransfer.get_styles | def get_styles(self, style=None):
"""
Returns SFrame of style images used for training the model
Parameters
----------
style: int or list, optional
The selected style or list of styles to return. If `None`, all
styles will be returned
See Also
... | python | def get_styles(self, style=None):
"""
Returns SFrame of style images used for training the model
Parameters
----------
style: int or list, optional
The selected style or list of styles to return. If `None`, all
styles will be returned
See Also
... | [
"def",
"get_styles",
"(",
"self",
",",
"style",
"=",
"None",
")",
":",
"style",
",",
"_",
"=",
"self",
".",
"_style_input_check",
"(",
"style",
")",
"return",
"self",
".",
"styles",
".",
"filter_by",
"(",
"style",
",",
"self",
".",
"_index_column",
")"... | Returns SFrame of style images used for training the model
Parameters
----------
style: int or list, optional
The selected style or list of styles to return. If `None`, all
styles will be returned
See Also
--------
stylize
Examples
... | [
"Returns",
"SFrame",
"of",
"style",
"images",
"used",
"for",
"training",
"the",
"model"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/style_transfer/style_transfer.py#L876-L911 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_mxnet_converter.py | convert | def convert(model, input_shape, class_labels=None, mode=None,
preprocessor_args=None, builder=None, verbose=True):
"""Convert an MXNet model to the protobuf spec.
Parameters
----------
model: MXNet model
A trained MXNet neural network model.
input_shape: list of tuples
... | python | def convert(model, input_shape, class_labels=None, mode=None,
preprocessor_args=None, builder=None, verbose=True):
"""Convert an MXNet model to the protobuf spec.
Parameters
----------
model: MXNet model
A trained MXNet neural network model.
input_shape: list of tuples
... | [
"def",
"convert",
"(",
"model",
",",
"input_shape",
",",
"class_labels",
"=",
"None",
",",
"mode",
"=",
"None",
",",
"preprocessor_args",
"=",
"None",
",",
"builder",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"... | Convert an MXNet model to the protobuf spec.
Parameters
----------
model: MXNet model
A trained MXNet neural network model.
input_shape: list of tuples
A list of (name, shape) tuples, defining the input names and their
shapes. The list also serves to define the desired order of... | [
"Convert",
"an",
"MXNet",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_mxnet_converter.py#L127-L272 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_util.py | load_model | def load_model(model_path):
"""Load a libsvm model from a path on disk.
This currently supports:
* C-SVC
* NU-SVC
* Epsilon-SVR
* NU-SVR
Parameters
----------
model_path: str
Path on disk where the libsvm model representation is.
Returns
-------
model: ... | python | def load_model(model_path):
"""Load a libsvm model from a path on disk.
This currently supports:
* C-SVC
* NU-SVC
* Epsilon-SVR
* NU-SVR
Parameters
----------
model_path: str
Path on disk where the libsvm model representation is.
Returns
-------
model: ... | [
"def",
"load_model",
"(",
"model_path",
")",
":",
"if",
"not",
"(",
"HAS_LIBSVM",
")",
":",
"raise",
"RuntimeError",
"(",
"'libsvm not found. libsvm conversion API is disabled.'",
")",
"from",
"svmutil",
"import",
"svm_load_model",
"# From libsvm",
"import",
"os",
"if... | Load a libsvm model from a path on disk.
This currently supports:
* C-SVC
* NU-SVC
* Epsilon-SVR
* NU-SVR
Parameters
----------
model_path: str
Path on disk where the libsvm model representation is.
Returns
-------
model: libsvm_model
A model of the... | [
"Load",
"a",
"libsvm",
"model",
"from",
"a",
"path",
"on",
"disk",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_util.py#L8-L34 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.