partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _interpretations_class.short_text__str | Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def short_text__str(self, column_name, output_column_prefix):
"""
Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts.
"""
from ._ngram_counter import NGramCounter
from ._tfidf import TFIDF
return [NGramCounter(features=[column_name... | def short_text__str(self, column_name, output_column_prefix):
"""
Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts.
"""
from ._ngram_counter import NGramCounter
from ._tfidf import TFIDF
return [NGramCounter(features=[column_name... | [
"Transforms",
"short",
"text",
"into",
"a",
"dictionary",
"of",
"TFIDF",
"-",
"weighted",
"3",
"-",
"gram",
"character",
"counts",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L224-L241 | [
"def",
"short_text__str",
"(",
"self",
",",
"column_name",
",",
"output_column_prefix",
")",
":",
"from",
".",
"_ngram_counter",
"import",
"NGramCounter",
"from",
".",
"_tfidf",
"import",
"TFIDF",
"return",
"[",
"NGramCounter",
"(",
"features",
"=",
"[",
"column... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _interpretations_class.categorical__int | Interprets an integer column as a categorical variable. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def categorical__int(self, column_name, output_column_prefix):
"""
Interprets an integer column as a categorical variable.
"""
return [_ColumnFunctionTransformation(
features = [column_name],
output_column_prefix = output_column_prefix,
transform_func... | def categorical__int(self, column_name, output_column_prefix):
"""
Interprets an integer column as a categorical variable.
"""
return [_ColumnFunctionTransformation(
features = [column_name],
output_column_prefix = output_column_prefix,
transform_func... | [
"Interprets",
"an",
"integer",
"column",
"as",
"a",
"categorical",
"variable",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L283-L292 | [
"def",
"categorical__int",
"(",
"self",
",",
"column_name",
",",
"output_column_prefix",
")",
":",
"return",
"[",
"_ColumnFunctionTransformation",
"(",
"features",
"=",
"[",
"column_name",
"]",
",",
"output_column_prefix",
"=",
"output_column_prefix",
",",
"transform_... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | AutoVectorizer._setup_from_data | Sets up the content transforms. | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def _setup_from_data(self, data):
"""
Sets up the content transforms.
"""
fitted_state = {}
_raise_error_if_not_of_type(data, [_SFrame])
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
... | def _setup_from_data(self, data):
"""
Sets up the content transforms.
"""
fitted_state = {}
_raise_error_if_not_of_type(data, [_SFrame])
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
... | [
"Sets",
"up",
"the",
"content",
"transforms",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L550-L619 | [
"def",
"_setup_from_data",
"(",
"self",
",",
"data",
")",
":",
"fitted_state",
"=",
"{",
"}",
"_raise_error_if_not_of_type",
"(",
"data",
",",
"[",
"_SFrame",
"]",
")",
"feature_columns",
"=",
"_internal_utils",
".",
"get_column_names",
"(",
"data",
",",
"self... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | AutoVectorizer.fit | Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_transform | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def fit(self, data):
"""
Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_tr... | def fit(self, data):
"""
Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_tr... | [
"Fits",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L621-L643 | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_setup_from_data",
"(",
"data",
")",
"self",
".",
"transform_chain",
".",
"fit",
"(",
"data",
")",
"self",
".",
"__proxy__",
".",
"update",
"(",
"{",
"\"fitted\"",
":",
"True",
"}",
")",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | AutoVectorizer.fit_transform | Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
A transformed SFrame.
... | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def fit_transform(self, data):
"""
Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out... | def fit_transform(self, data):
"""
Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out... | [
"Fits",
"and",
"transforms",
"the",
"SFrame",
"data",
"using",
"a",
"fitted",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L645-L671 | [
"def",
"fit_transform",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_setup_from_data",
"(",
"data",
")",
"ret",
"=",
"self",
".",
"transform_chain",
".",
"fit_transform",
"(",
"data",
")",
"self",
".",
"__proxy__",
".",
"update",
"(",
"{",
"\"fitte... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | AutoVectorizer.transform | Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
A transformed SFrame.
See Also
... | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def transform(self, data):
"""
Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
... | def transform(self, data):
"""
Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
... | [
"Transform",
"the",
"SFrame",
"data",
"using",
"a",
"fitted",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L673-L699 | [
"def",
"transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"transform_chain",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"`transform()` method called before `fit` or `fit_transform`.\"",
")",
"return",
"self",
".",
"transform_chain",
".",
"tr... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | AutoVectorizer._get_summary_struct | Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of list of tuples)
A list of summary sections... | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | [
"Returns",
"a",
"structured",
"description",
"of",
"the",
"model",
"including",
"(",
"where",
"relevant",
")",
"the",
"schema",
"of",
"the",
"training",
"data",
"description",
"of",
"the",
"training",
"data",
"training",
"statistics",
"and",
"model",
"hyperparam... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L702-L761 | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"sections",
"=",
"[",
"]",
"fields",
"=",
"[",
"]",
"_features",
"=",
"_precomputed_field",
"(",
"_internal_utils",
".",
"pretty_print_list",
"(",
"self",
".",
"features",
")",
")",
"_exclude",
"=",
"_prec... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | AutoVectorizer._save_impl | Save the model as a directory, which can be loaded with the
:py:func:`~turicreate.load_model` method.
Parameters
----------
pickler : GLPickler
An opened GLPickle archive (Do not close the archive).
See Also
--------
turicreate.load_model
Ex... | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | def _save_impl(self, pickler):
"""
Save the model as a directory, which can be loaded with the
:py:func:`~turicreate.load_model` method.
Parameters
----------
pickler : GLPickler
An opened GLPickle archive (Do not close the archive).
See Also
... | def _save_impl(self, pickler):
"""
Save the model as a directory, which can be loaded with the
:py:func:`~turicreate.load_model` method.
Parameters
----------
pickler : GLPickler
An opened GLPickle archive (Do not close the archive).
See Also
... | [
"Save",
"the",
"model",
"as",
"a",
"directory",
"which",
"can",
"be",
"loaded",
"with",
"the",
":",
"py",
":",
"func",
":",
"~turicreate",
".",
"load_model",
"method",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L796-L815 | [
"def",
"_save_impl",
"(",
"self",
",",
"pickler",
")",
":",
"pickler",
".",
"dump",
"(",
"(",
"self",
".",
"__proxy__",
".",
"state",
",",
"self",
".",
"_exclude",
",",
"self",
".",
"_features",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Mox.CreateMock | Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def CreateMock(self, class_to_mock):
"""Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be.
"""
new_mock = MockObject(class_to_mock)
self._mock_objects.append(new_moc... | def CreateMock(self, class_to_mock):
"""Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be.
"""
new_mock = MockObject(class_to_mock)
self._mock_objects.append(new_moc... | [
"Create",
"a",
"new",
"mock",
"object",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L164-L177 | [
"def",
"CreateMock",
"(",
"self",
",",
"class_to_mock",
")",
":",
"new_mock",
"=",
"MockObject",
"(",
"class_to_mock",
")",
"self",
".",
"_mock_objects",
".",
"append",
"(",
"new_mock",
")",
"return",
"new_mock"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Mox.StubOutWithMock | Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting use_mock_anything to True.
Args:
obj: A Python object (class, mod... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def StubOutWithMock(self, obj, attr_name, use_mock_anything=False):
"""Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting u... | def StubOutWithMock(self, obj, attr_name, use_mock_anything=False):
"""Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting u... | [
"Replace",
"a",
"method",
"attribute",
"etc",
".",
"with",
"a",
"Mock",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L208-L228 | [
"def",
"StubOutWithMock",
"(",
"self",
",",
"obj",
",",
"attr_name",
",",
"use_mock_anything",
"=",
"False",
")",
":",
"attr_to_replace",
"=",
"getattr",
"(",
"obj",
",",
"attr_name",
")",
"if",
"type",
"(",
"attr_to_replace",
")",
"in",
"self",
".",
"_USE... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MockAnything._Verify | Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def _Verify(self):
"""Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue.
"""
# If the list of expected calls is not empty, raise an exception
if self._expected_calls_queue:
# The la... | def _Verify(self):
"""Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue.
"""
# If the list of expected calls is not empty, raise an exception
if self._expected_calls_queue:
# The la... | [
"Verify",
"that",
"all",
"of",
"the",
"expected",
"calls",
"have",
"been",
"made",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L331-L347 | [
"def",
"_Verify",
"(",
"self",
")",
":",
"# If the list of expected calls is not empty, raise an exception",
"if",
"self",
".",
"_expected_calls_queue",
":",
"# The last MultipleTimesGroup is not popped from the queue.",
"if",
"(",
"len",
"(",
"self",
".",
"_expected_calls_queu... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MockMethod._VerifyMethodCall | Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def _VerifyMethodCall(self):
"""Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected.
"""
expected = self._PopNextMethod()
# Loo... | def _VerifyMethodCall(self):
"""Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected.
"""
expected = self._PopNextMethod()
# Loo... | [
"Verify",
"the",
"called",
"method",
"is",
"expected",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L588-L613 | [
"def",
"_VerifyMethodCall",
"(",
"self",
")",
":",
"expected",
"=",
"self",
".",
"_PopNextMethod",
"(",
")",
"# Loop here, because we might have a MethodGroup followed by another",
"# group.",
"while",
"isinstance",
"(",
"expected",
",",
"MethodGroup",
")",
":",
"expect... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MockMethod.GetPossibleGroup | Returns a possible group from the end of the call queue or None if no
other methods are on the stack. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def GetPossibleGroup(self):
"""Returns a possible group from the end of the call queue or None if no
other methods are on the stack.
"""
# Remove this method from the tail of the queue so we can add it to a group.
this_method = self._call_queue.pop()
assert this_method == self
# Determine ... | def GetPossibleGroup(self):
"""Returns a possible group from the end of the call queue or None if no
other methods are on the stack.
"""
# Remove this method from the tail of the queue so we can add it to a group.
this_method = self._call_queue.pop()
assert this_method == self
# Determine ... | [
"Returns",
"a",
"possible",
"group",
"from",
"the",
"end",
"of",
"the",
"call",
"queue",
"or",
"None",
"if",
"no",
"other",
"methods",
"are",
"on",
"the",
"stack",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L645-L662 | [
"def",
"GetPossibleGroup",
"(",
"self",
")",
":",
"# Remove this method from the tail of the queue so we can add it to a group.",
"this_method",
"=",
"self",
".",
"_call_queue",
".",
"pop",
"(",
")",
"assert",
"this_method",
"==",
"self",
"# Determine if the tail of the queue... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MockMethod._CheckAndCreateNewGroup | Checks if the last method (a possible group) is an instance of our
group_class. Adds the current method to this group or creates a new one.
Args:
group_name: the name of the group.
group_class: the class used to create instance of this new group | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def _CheckAndCreateNewGroup(self, group_name, group_class):
"""Checks if the last method (a possible group) is an instance of our
group_class. Adds the current method to this group or creates a new one.
Args:
group_name: the name of the group.
group_class: the class used to create instance of ... | def _CheckAndCreateNewGroup(self, group_name, group_class):
"""Checks if the last method (a possible group) is an instance of our
group_class. Adds the current method to this group or creates a new one.
Args:
group_name: the name of the group.
group_class: the class used to create instance of ... | [
"Checks",
"if",
"the",
"last",
"method",
"(",
"a",
"possible",
"group",
")",
"is",
"an",
"instance",
"of",
"our",
"group_class",
".",
"Adds",
"the",
"current",
"method",
"to",
"this",
"group",
"or",
"creates",
"a",
"new",
"one",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L664-L684 | [
"def",
"_CheckAndCreateNewGroup",
"(",
"self",
",",
"group_name",
",",
"group_class",
")",
":",
"group",
"=",
"self",
".",
"GetPossibleGroup",
"(",
")",
"# If this is a group, and it is the correct group, add the method.",
"if",
"isinstance",
"(",
"group",
",",
"group_c... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | IsA.equals | Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def equals(self, rhs):
"""Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool
"""
try:
return isinstance(rhs, self._class_name)
except TypeError:
# Check raw types if there was a type error.... | def equals(self, rhs):
"""Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool
"""
try:
return isinstance(rhs, self._class_name)
except TypeError:
# Check raw types if there was a type error.... | [
"Check",
"to",
"see",
"if",
"the",
"RHS",
"is",
"an",
"instance",
"of",
"class_name",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L807-L823 | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"isinstance",
"(",
"rhs",
",",
"self",
".",
"_class_name",
")",
"except",
"TypeError",
":",
"# Check raw types if there was a type error. This is helpful for",
"# things like cStringIO.StringIO."... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | IsAlmost.equals | Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | [
"Check",
"to",
"see",
"if",
"RHS",
"is",
"almost",
"equal",
"to",
"float_value"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L846-L860 | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"round",
"(",
"rhs",
"-",
"self",
".",
"_float_value",
",",
"self",
".",
"_places",
")",
"==",
"0",
"except",
"TypeError",
":",
"# This is probably because either float_value or rhs is n... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ContainsKeyValue.equals | Check whether the given key/value pair is in the rhs dict.
Returns:
bool | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def equals(self, rhs):
"""Check whether the given key/value pair is in the rhs dict.
Returns:
bool
"""
try:
return rhs[self._key] == self._value
except Exception:
return False | def equals(self, rhs):
"""Check whether the given key/value pair is in the rhs dict.
Returns:
bool
"""
try:
return rhs[self._key] == self._value
except Exception:
return False | [
"Check",
"whether",
"the",
"given",
"key",
"/",
"value",
"pair",
"is",
"in",
"the",
"rhs",
"dict",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L989-L999 | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"rhs",
"[",
"self",
".",
"_key",
"]",
"==",
"self",
".",
"_value",
"except",
"Exception",
":",
"return",
"False"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SameElementsAs.equals | Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def equals(self, actual_seq):
"""Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool
"""
try:
expected = dict([(element, None) for element in self._expected_seq])
actual = dict([(element, None) for element in actual_s... | def equals(self, actual_seq):
"""Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool
"""
try:
expected = dict([(element, None) for element in self._expected_seq])
actual = dict([(element, None) for element in actual_s... | [
"Check",
"to",
"see",
"whether",
"actual_seq",
"has",
"same",
"elements",
"as",
"expected_seq",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1021-L1040 | [
"def",
"equals",
"(",
"self",
",",
"actual_seq",
")",
":",
"try",
":",
"expected",
"=",
"dict",
"(",
"[",
"(",
"element",
",",
"None",
")",
"for",
"element",
"in",
"self",
".",
"_expected_seq",
"]",
")",
"actual",
"=",
"dict",
"(",
"[",
"(",
"eleme... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Or.equals | Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | [
"Checks",
"whether",
"any",
"Comparator",
"is",
"equal",
"to",
"rhs",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1092-L1106 | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"for",
"comparator",
"in",
"self",
".",
"_comparators",
":",
"if",
"comparator",
".",
"equals",
"(",
"rhs",
")",
":",
"return",
"True",
"return",
"False"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | UnorderedGroup.MethodCalled | Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raises:
UnexpectedMethodCallError if the mo... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | [
"Remove",
"a",
"method",
"call",
"from",
"the",
"group",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1223-L1255 | [
"def",
"MethodCalled",
"(",
"self",
",",
"mock_method",
")",
":",
"# Check to see if this method exists, and if so, remove it from the set",
"# and return it.",
"for",
"method",
"in",
"self",
".",
"_methods",
":",
"if",
"method",
"==",
"mock_method",
":",
"# Remove the ca... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MultipleTimesGroup.MethodCalled | Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raises:
UnexpectedMethodCallError if the mo... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | [
"Remove",
"a",
"method",
"call",
"from",
"the",
"group",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1285-L1316 | [
"def",
"MethodCalled",
"(",
"self",
",",
"mock_method",
")",
":",
"# Check to see if this method exists, and if so add it to the set of",
"# called methods.",
"for",
"method",
"in",
"self",
".",
"_methods",
":",
"if",
"method",
"==",
"mock_method",
":",
"self",
".",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MultipleTimesGroup.IsSatisfied | Return True if all methods in this group are called at least once. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | [
"Return",
"True",
"if",
"all",
"methods",
"in",
"this",
"group",
"are",
"called",
"at",
"least",
"once",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1318-L1331 | [
"def",
"IsSatisfied",
"(",
"self",
")",
":",
"# NOTE(psycho): We can't use the simple set difference here because we want",
"# to match different parameters which are considered the same e.g. IsA(str)",
"# and some string. This solution is O(n^2) but n should be small.",
"tmp",
"=",
"self",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Returns
-------
model_spec: An object of type Model_pb.
... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_dict_vectorizer.py | def convert(model, input_features, output_features):
"""Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Retur... | def convert(model, input_features, output_features):
"""Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Retur... | [
"Convert",
"a",
"_imputer",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_dict_vectorizer.py#L29-L102 | [
"def",
"convert",
"(",
"model",
",",
"input_features",
",",
"output_features",
")",
":",
"_INTERMEDIATE_FEATURE_NAME",
"=",
"\"__sparse_vector_features__\"",
"n_dimensions",
"=",
"len",
"(",
"model",
".",
"feature_names_",
")",
"input_features",
"=",
"process_or_validat... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | set_classifier_interface_params | Common utilities to set the regression interface params. | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | def set_classifier_interface_params(spec, features, class_labels,
model_accessor_for_class_labels, output_features = None):
"""
Common utilities to set the regression interface params.
"""
# Normalize the features list.
features = _fm.process_or_validate_features(features)
if class_labe... | def set_classifier_interface_params(spec, features, class_labels,
model_accessor_for_class_labels, output_features = None):
"""
Common utilities to set the regression interface params.
"""
# Normalize the features list.
features = _fm.process_or_validate_features(features)
if class_labe... | [
"Common",
"utilities",
"to",
"set",
"the",
"regression",
"interface",
"params",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L13-L100 | [
"def",
"set_classifier_interface_params",
"(",
"spec",
",",
"features",
",",
"class_labels",
",",
"model_accessor_for_class_labels",
",",
"output_features",
"=",
"None",
")",
":",
"# Normalize the features list.",
"features",
"=",
"_fm",
".",
"process_or_validate_features",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | set_regressor_interface_params | Common utilities to set the regressor interface params. | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | def set_regressor_interface_params(spec, features, output_features):
""" Common utilities to set the regressor interface params.
"""
if output_features is None:
output_features = [("predicted_class", datatypes.Double())]
else:
output_features = _fm.process_or_validate_features(output_fea... | def set_regressor_interface_params(spec, features, output_features):
""" Common utilities to set the regressor interface params.
"""
if output_features is None:
output_features = [("predicted_class", datatypes.Double())]
else:
output_features = _fm.process_or_validate_features(output_fea... | [
"Common",
"utilities",
"to",
"set",
"the",
"regressor",
"interface",
"params",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L102-L132 | [
"def",
"set_regressor_interface_params",
"(",
"spec",
",",
"features",
",",
"output_features",
")",
":",
"if",
"output_features",
"is",
"None",
":",
"output_features",
"=",
"[",
"(",
"\"predicted_class\"",
",",
"datatypes",
".",
"Double",
"(",
")",
")",
"]",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | set_transform_interface_params | Common utilities to set transform interface params. | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
""" Common utilities to set transform interface params.
"""
input_features = _fm.process_or_validate_features(input_features)
output_features = _fm.process_or_validate_features(output_features)
# Add in... | def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
""" Common utilities to set transform interface params.
"""
input_features = _fm.process_or_validate_features(input_features)
output_features = _fm.process_or_validate_features(output_features)
# Add in... | [
"Common",
"utilities",
"to",
"set",
"transform",
"interface",
"params",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L134-L153 | [
"def",
"set_transform_interface_params",
"(",
"spec",
",",
"input_features",
",",
"output_features",
",",
"are_optional",
"=",
"False",
")",
":",
"input_features",
"=",
"_fm",
".",
"process_or_validate_features",
"(",
"input_features",
")",
"output_features",
"=",
"_f... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | prep_data | Convert SFrame to batch form, where each row contains a sequence of length
predictions_in_chunk * prediction_window, and there is a single label per
prediction window. | src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py | def prep_data(data, features, session_id, prediction_window, predictions_in_chunk, target=None, verbose=True):
"""
Convert SFrame to batch form, where each row contains a sequence of length
predictions_in_chunk * prediction_window, and there is a single label per
prediction window.
"""
if target... | def prep_data(data, features, session_id, prediction_window, predictions_in_chunk, target=None, verbose=True):
"""
Convert SFrame to batch form, where each row contains a sequence of length
predictions_in_chunk * prediction_window, and there is a single label per
prediction window.
"""
if target... | [
"Convert",
"SFrame",
"to",
"batch",
"form",
"where",
"each",
"row",
"contains",
"a",
"sequence",
"of",
"length",
"predictions_in_chunk",
"*",
"prediction_window",
"and",
"there",
"is",
"a",
"single",
"label",
"per",
"prediction",
"window",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py#L26-L42 | [
"def",
"prep_data",
"(",
"data",
",",
"features",
",",
"session_id",
",",
"prediction_window",
",",
"predictions_in_chunk",
",",
"target",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"if",
"target",
"is",
"None",
":",
"target",
"=",
"\"\"",
"if",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _load_into_numpy | Loads into numpy array from SFrame, assuming SFrame stores data flattened | src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py | def _load_into_numpy(sf, np_array, start, end, strides=None, shape=None):
"""Loads into numpy array from SFrame, assuming SFrame stores data flattened"""
np_array[:] = 0.0
np_array_2d = np_array.reshape((np_array.shape[0], np_array.shape[1] * np_array.shape[2]))
_extensions.sframe_load_to_numpy(sf, np_a... | def _load_into_numpy(sf, np_array, start, end, strides=None, shape=None):
"""Loads into numpy array from SFrame, assuming SFrame stores data flattened"""
np_array[:] = 0.0
np_array_2d = np_array.reshape((np_array.shape[0], np_array.shape[1] * np_array.shape[2]))
_extensions.sframe_load_to_numpy(sf, np_a... | [
"Loads",
"into",
"numpy",
"array",
"from",
"SFrame",
"assuming",
"SFrame",
"stores",
"data",
"flattened"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py#L49-L55 | [
"def",
"_load_into_numpy",
"(",
"sf",
",",
"np_array",
",",
"start",
",",
"end",
",",
"strides",
"=",
"None",
",",
"shape",
"=",
"None",
")",
":",
"np_array",
"[",
":",
"]",
"=",
"0.0",
"np_array_2d",
"=",
"np_array",
".",
"reshape",
"(",
"(",
"np_ar... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.set_input | Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_dims
is the same as input_names.
Examples
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def set_input(self, input_names, input_dims):
"""
Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_... | def set_input(self, input_names, input_dims):
"""
Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_... | [
"Set",
"the",
"inputs",
"of",
"the",
"network",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L159-L202 | [
"def",
"set_input",
"(",
"self",
",",
"input_names",
",",
"input_dims",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"for",
"idx",
",",
"dim",
"in",
"enumerate",
"(",
"input_dims",
")",
":",
"if",
"len",
"(",
"d... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.set_output | Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering of output_dims is the same
as output_names.
Examp... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def set_output(self, output_names, output_dims):
"""
Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering o... | def set_output(self, output_names, output_dims):
"""
Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering o... | [
"Set",
"the",
"outputs",
"of",
"the",
"network",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L204-L235 | [
"def",
"set_output",
"(",
"self",
",",
"output_names",
",",
"output_dims",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"for",
"idx",
",",
"dim",
"in",
"enumerate",
"(",
"output_dims",
")",
":",
"spec",
".",
"desc... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.set_class_labels | Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings that map the index of the output of a
neural network to labels in a classifier.
predicted_feature_name: ... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def set_class_labels(self, class_labels, predicted_feature_name = 'classLabel', prediction_blob = ''):
"""
Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings th... | def set_class_labels(self, class_labels, predicted_feature_name = 'classLabel', prediction_blob = ''):
"""
Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings th... | [
"Set",
"class",
"labels",
"to",
"the",
"model",
"spec",
"to",
"make",
"it",
"a",
"neural",
"network",
"classifier",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L237-L299 | [
"def",
"set_class_labels",
"(",
"self",
",",
"class_labels",
",",
"predicted_feature_name",
"=",
"'classLabel'",
",",
"prediction_blob",
"=",
"''",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"if",
"len",
"(",
"spec",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_optionals | Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
See Also
--------
set_input, set_output | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_optionals(self, optionals_in, optionals_out):
"""
Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
... | def add_optionals(self, optionals_in, optionals_out):
"""
Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
... | [
"Add",
"optional",
"inputs",
"and",
"outputs",
"to",
"the",
"model",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L302-L343 | [
"def",
"add_optionals",
"(",
"self",
",",
"optionals_in",
",",
"optionals_out",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"if",
"(",
"not",
"optionals_in",
")",
"and",
"(",
"not",
"optionals_out",
")",
":",
"return",
"# assuming single sizes here",
"input_ty... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_embedding | Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix of shape (output_channels, input_dim).
b: numpy.array
Bias vector of shape (output_channels, ).
input_dim: int
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_embedding(self, name, W, b, input_dim, output_channels, has_bias,
input_name, output_name):
"""
Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix ... | def add_embedding(self, name, W, b, input_dim, output_channels, has_bias,
input_name, output_name):
"""
Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix ... | [
"Add",
"an",
"embedding",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L400-L453 | [
"def",
"add_embedding",
"(",
"self",
",",
"name",
",",
"W",
",",
"b",
",",
"input_dim",
",",
"output_channels",
",",
"has_bias",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_softmax | Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of this layer.
See Also
--------
add_ac... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_softmax(self, name, input_name, output_name):
"""
Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output ... | def add_softmax(self, name, input_name, output_name):
"""
Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output ... | [
"Add",
"a",
"softmax",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L456-L482 | [
"def",
"add_softmax",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_activation | Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) function of this layer.
It can be one of the following:
- 'RELU': Rectified Linear Unit (Re... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_activation(self, name, non_linearity, input_name, output_name,
params=None):
"""
Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) functio... | def add_activation(self, name, non_linearity, input_name, output_name,
params=None):
"""
Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) functio... | [
"Add",
"an",
"activation",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L484-L648 | [
"def",
"add_activation",
"(",
"self",
",",
"name",
",",
"non_linearity",
",",
"input_name",
",",
"output_name",
",",
"params",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_elementwise | Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer. The input blobs should have the same shape.
output_name: str
The output blob ... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_elementwise(self, name, input_names, output_name, mode, alpha = None):
"""
Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer... | def add_elementwise(self, name, input_names, output_name, mode, alpha = None):
"""
Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer... | [
"Add",
"an",
"element",
"-",
"wise",
"operation",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L650-L721 | [
"def",
"add_elementwise",
"(",
"self",
",",
"name",
",",
"input_names",
",",
"output_name",
",",
"mode",
",",
"alpha",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
".",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_upsample | Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertical direction.
scaling_factor_w: int
Scaling factor on the horizontal direction.
input_name: str
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_upsample(self, name, scaling_factor_h, scaling_factor_w, input_name, output_name, mode = 'NN'):
"""
Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertic... | def add_upsample(self, name, scaling_factor_h, scaling_factor_w, input_name, output_name, mode = 'NN'):
"""
Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertic... | [
"Add",
"upsample",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L723-L764 | [
"def",
"add_upsample",
"(",
"self",
",",
"name",
",",
"scaling_factor_h",
",",
"scaling_factor_w",
",",
"input_name",
",",
"output_name",
",",
"mode",
"=",
"'NN'",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_scale | Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: int | numpy.array
Bias to add to the input.
has_bias: boolean
Whether the bias vector of this... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_scale(self, name, W, b, has_bias, input_name, output_name, shape_scale = [1], shape_bias = [1]):
"""
Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: ... | def add_scale(self, name, W, b, has_bias, input_name, output_name, shape_scale = [1], shape_bias = [1]):
"""
Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: ... | [
"Add",
"scale",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L766-L824 | [
"def",
"add_scale",
"(",
"self",
",",
"name",
",",
"W",
",",
"b",
",",
"has_bias",
",",
"input_name",
",",
"output_name",
",",
"shape_scale",
"=",
"[",
"1",
"]",
",",
"shape_bias",
"=",
"[",
"1",
"]",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_bias | Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_bias(self, name, b, input_name, output_name, shape_bias = [1]):
"""
Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The... | def add_bias(self, name, b, input_name, output_name, shape_bias = [1]):
"""
Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The... | [
"Add",
"bias",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L826-L864 | [
"def",
"add_bias",
"(",
"self",
",",
"name",
",",
"b",
",",
"input_name",
",",
"output_name",
",",
"shape_bias",
"=",
"[",
"1",
"]",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
"."... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_sequence_repeat | Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
input_name: str
The input blob name of this layer.
output_name: ... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_sequence_repeat(self, name, nrep, input_name, output_name):
"""
Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
... | def add_sequence_repeat(self, name, nrep, input_name, output_name):
"""
Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
... | [
"Add",
"sequence",
"repeat",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L866-L892 | [
"def",
"add_sequence_repeat",
"(",
"self",
",",
"name",
",",
"nrep",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_convolution | Add a convolution layer to the network.
Please see the ConvolutionLayerParams in Core ML neural network
protobuf message for more information about input and output blob dimensions.
Parameters
----------
name: str
The name of this layer.
kernel_channels: int... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_convolution(self, name, kernel_channels, output_channels, height,
width, stride_height, stride_width, border_mode, groups, W, b, has_bias,
is_deconv = False, output_shape = None,
input_name = 'data', output_name = 'out',
dilation_factors = [1,1],
paddi... | def add_convolution(self, name, kernel_channels, output_channels, height,
width, stride_height, stride_width, border_mode, groups, W, b, has_bias,
is_deconv = False, output_shape = None,
input_name = 'data', output_name = 'out',
dilation_factors = [1,1],
paddi... | [
"Add",
"a",
"convolution",
"layer",
"to",
"the",
"network",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L894-L1049 | [
"def",
"add_convolution",
"(",
"self",
",",
"name",
",",
"kernel_channels",
",",
"output_channels",
",",
"height",
",",
"width",
",",
"stride_height",
",",
"stride_width",
",",
"border_mode",
",",
"groups",
",",
"W",
",",
"b",
",",
"has_bias",
",",
"is_decon... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_padding | Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
left: int
Number of elements to be padded on the left side of the input blob.
right: int
Number of eleme... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_padding(self, name,
left = 0, right = 0, top = 0, bottom = 0,
value = 0,
input_name = 'data', output_name = 'out',
padding_type = 'constant'):
"""
Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameter... | def add_padding(self, name,
left = 0, right = 0, top = 0, bottom = 0,
value = 0,
input_name = 'data', output_name = 'out',
padding_type = 'constant'):
"""
Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameter... | [
"Add",
"a",
"padding",
"layer",
"to",
"the",
"model",
".",
"Kindly",
"refer",
"to",
"NeuralNetwork",
".",
"proto",
"for",
"details",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1148-L1208 | [
"def",
"add_padding",
"(",
"self",
",",
"name",
",",
"left",
"=",
"0",
",",
"right",
"=",
"0",
",",
"top",
"=",
"0",
",",
"bottom",
"=",
"0",
",",
"value",
"=",
"0",
",",
"input_name",
"=",
"'data'",
",",
"output_name",
"=",
"'out'",
",",
"paddin... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_crop | Add a cropping layer to the model.
The cropping layer have two functional modes:
- When it has 1 input blob, it crops the input blob based
on the 4 parameters [left, right, top, bottom].
- When it has 2 input blobs, it crops the first input blob based
on the ... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_crop(self, name, left, right, top, bottom, offset, input_names,
output_name):
"""
Add a cropping layer to the model.
The cropping layer have two functional modes:
- When it has 1 input blob, it crops the input blob based
on the 4 parameters [left, r... | def add_crop(self, name, left, right, top, bottom, offset, input_names,
output_name):
"""
Add a cropping layer to the model.
The cropping layer have two functional modes:
- When it has 1 input blob, it crops the input blob based
on the 4 parameters [left, r... | [
"Add",
"a",
"cropping",
"layer",
"to",
"the",
"model",
".",
"The",
"cropping",
"layer",
"have",
"two",
"functional",
"modes",
":"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1210-L1269 | [
"def",
"add_crop",
"(",
"self",
",",
"name",
",",
"left",
",",
"right",
",",
"top",
",",
"bottom",
",",
"offset",
",",
"input_names",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new l... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_simple_rnn | Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: numpy.array
Weights of the recurrent layer's hidden state. Must be of shape (hidden_size, hidden_size).
W_x: numpy.array
Weights of the rec... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_simple_rnn(self,name, W_h, W_x, b, hidden_size, input_size, activation, input_names, output_names, output_all = False, reverse_input = False):
"""
Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: ... | def add_simple_rnn(self,name, W_h, W_x, b, hidden_size, input_size, activation, input_names, output_names, output_all = False, reverse_input = False):
"""
Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: ... | [
"Add",
"a",
"simple",
"recurrent",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1271-L1341 | [
"def",
"add_simple_rnn",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"activation",
",",
"input_names",
",",
"output_names",
",",
"output_all",
"=",
"False",
",",
"reverse_input",
"=",
"False",
")"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_gru | Add a Gated-Recurrent Unit (GRU) layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: [numpy.array]
List of recursion weight matrices. The ordering is [R_z, R_r, R_o],
where R_z, R_r and R_o are weight matrices at update ga... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_gru(self, name, W_h, W_x, b, hidden_size, input_size,
input_names, output_names, activation = 'TANH', inner_activation = 'SIGMOID_HARD',
output_all = False, reverse_input = False):
"""
Add a Gated-Recurrent Unit (GRU) layer to the model.
Parameters
------... | def add_gru(self, name, W_h, W_x, b, hidden_size, input_size,
input_names, output_names, activation = 'TANH', inner_activation = 'SIGMOID_HARD',
output_all = False, reverse_input = False):
"""
Add a Gated-Recurrent Unit (GRU) layer to the model.
Parameters
------... | [
"Add",
"a",
"Gated",
"-",
"Recurrent",
"Unit",
"(",
"GRU",
")",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1343-L1440 | [
"def",
"add_gru",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"input_names",
",",
"output_names",
",",
"activation",
"=",
"'TANH'",
",",
"inner_activation",
"=",
"'SIGMOID_HARD'",
",",
"output_all",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_unilstm | Add a Uni-directional LSTM layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: [numpy.array]
List of recursion weight matrices. The ordering is [R_i, R_f, R_o, R_z],
where R_i, R_f, R_o, R_z are weight matrices at input ga... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_unilstm(self, name, W_h, W_x, b, hidden_size, input_size, input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None,
output_all = Fals... | def add_unilstm(self, name, W_h, W_x, b, hidden_size, input_size, input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None,
output_all = Fals... | [
"Add",
"a",
"Uni",
"-",
"directional",
"LSTM",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1442-L1574 | [
"def",
"add_unilstm",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"input_names",
",",
"output_names",
",",
"inner_activation",
"=",
"'SIGMOID'",
",",
"cell_state_update_activation",
"=",
"'TANH'",
","... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_bidirlstm | Add a Bi-directional LSTM layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: [numpy.array]
List of recursion weight matrices for the forward layer. The ordering is [R_i, R_f, R_o, R_z],
where R_i, R_f, R_o, R_z are weight... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_bidirlstm(self, name, W_h, W_x, b, W_h_back, W_x_back, b_back, hidden_size, input_size,
input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None, peep_back = None,
... | def add_bidirlstm(self, name, W_h, W_x, b, W_h_back, W_x_back, b_back, hidden_size, input_size,
input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None, peep_back = None,
... | [
"Add",
"a",
"Bi",
"-",
"directional",
"LSTM",
"layer",
"to",
"the",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1576-L1759 | [
"def",
"add_bidirlstm",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"W_h_back",
",",
"W_x_back",
",",
"b_back",
",",
"hidden_size",
",",
"input_size",
",",
"input_names",
",",
"output_names",
",",
"inner_activation",
"=",
"'SIGMOID'",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_flatten | Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == 0, the flatten layer is in CHANNEL_FIRST mode.
- If mode == 1, the f... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_flatten(self, name, mode, input_name, output_name):
"""
Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == ... | def add_flatten(self, name, mode, input_name, output_name):
"""
Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == ... | [
"Add",
"a",
"flatten",
"layer",
".",
"Only",
"flattens",
"the",
"channel",
"height",
"and",
"width",
"axis",
".",
"Leaves",
"the",
"sequence",
"axis",
"as",
"is",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1761-L1802 | [
"def",
"add_flatten",
"(",
"self",
",",
"name",
",",
"mode",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_slice | Add a slice layer. Equivalent to to numpy slice [start_index:end_index:stride],
start_index is included, while end_index is exclusive.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
outp... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_slice(self, name, input_name, output_name, axis, start_index = 0, end_index = -1, stride = 1):
"""
Add a slice layer. Equivalent to to numpy slice [start_index:end_index:stride],
start_index is included, while end_index is exclusive.
Parameters
----------
name: s... | def add_slice(self, name, input_name, output_name, axis, start_index = 0, end_index = -1, stride = 1):
"""
Add a slice layer. Equivalent to to numpy slice [start_index:end_index:stride],
start_index is included, while end_index is exclusive.
Parameters
----------
name: s... | [
"Add",
"a",
"slice",
"layer",
".",
"Equivalent",
"to",
"to",
"numpy",
"slice",
"[",
"start_index",
":",
"end_index",
":",
"stride",
"]",
"start_index",
"is",
"included",
"while",
"end_index",
"is",
"exclusive",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1804-L1864 | [
"def",
"add_slice",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"axis",
",",
"start_index",
"=",
"0",
",",
"end_index",
"=",
"-",
"1",
",",
"stride",
"=",
"1",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"s... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_reorganize_data | Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of this layer.
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_reorganize_data(self, name, input_name, output_name, mode = 'SPACE_TO_DEPTH', block_size = 2):
"""
Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
... | def add_reorganize_data(self, name, input_name, output_name, mode = 'SPACE_TO_DEPTH', block_size = 2):
"""
Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
... | [
"Add",
"a",
"data",
"reorganization",
"layer",
"of",
"type",
"SPACE_TO_DEPTH",
"or",
"DEPTH_TO_SPACE",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1867-L1922 | [
"def",
"add_reorganize_data",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"mode",
"=",
"'SPACE_TO_DEPTH'",
",",
"block_size",
"=",
"2",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a n... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_batchnorm | Add a Batch Normalization layer. Batch Normalization operation is
defined as:
`y = gamma * (x - mean) / sqrt(variance + epsilon) + beta`
Parameters
----------
name: str
The name of this layer.
channels: int
Number of channels of the input blob.
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_batchnorm(self, name, channels, gamma, beta,
mean = None, variance = None,
input_name = 'data', output_name = 'out',
compute_mean_var = False,
instance_normalization = False, epsilon = 1e-5):
"""
Add a Batch ... | def add_batchnorm(self, name, channels, gamma, beta,
mean = None, variance = None,
input_name = 'data', output_name = 'out',
compute_mean_var = False,
instance_normalization = False, epsilon = 1e-5):
"""
Add a Batch ... | [
"Add",
"a",
"Batch",
"Normalization",
"layer",
".",
"Batch",
"Normalization",
"operation",
"is",
"defined",
"as",
":"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1924-L1991 | [
"def",
"add_batchnorm",
"(",
"self",
",",
"name",
",",
"channels",
",",
"gamma",
",",
"beta",
",",
"mean",
"=",
"None",
",",
"variance",
"=",
"None",
",",
"input_name",
"=",
"'data'",
",",
"output_name",
"=",
"'out'",
",",
"compute_mean_var",
"=",
"False... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_permute | Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]
Parameters
----------
name: str
The name of this layer.
dim: tuple
The order in which to permute the input dimensions = [seq,C,H,W].
Must have length 4 and a permut... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_permute(self, name, dim, input_name, output_name):
"""
Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]
Parameters
----------
name: str
The name of this layer.
dim: tuple
The order in which to permute ... | def add_permute(self, name, dim, input_name, output_name):
"""
Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]
Parameters
----------
name: str
The name of this layer.
dim: tuple
The order in which to permute ... | [
"Add",
"a",
"permute",
"layer",
".",
"Assumes",
"that",
"the",
"input",
"has",
"dimensions",
"in",
"the",
"order",
"[",
"Seq",
"C",
"H",
"W",
"]"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1994-L2046 | [
"def",
"add_permute",
"(",
"self",
",",
"name",
",",
"dim",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_reshape | Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blob. The product of target_shape must be equal
to the shape of the input blob.
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_reshape(self, name, input_name, output_name, target_shape, mode):
"""
Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blo... | def add_reshape(self, name, input_name, output_name, target_shape, mode):
"""
Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blo... | [
"Add",
"a",
"reshape",
"layer",
".",
"Kindly",
"refer",
"to",
"NeuralNetwork",
".",
"proto",
"for",
"details",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2048-L2094 | [
"def",
"add_reshape",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"target_shape",
",",
"mode",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_reduce | Add a reduce layer. Applies the function specified by the parameter mode,
along dimension(s) specified by the parameter axis.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: ... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_reduce(self, name, input_name, output_name, axis, mode, epsilon = 1e-6):
"""
Add a reduce layer. Applies the function specified by the parameter mode,
along dimension(s) specified by the parameter axis.
Parameters
----------
name: str
The name of this... | def add_reduce(self, name, input_name, output_name, axis, mode, epsilon = 1e-6):
"""
Add a reduce layer. Applies the function specified by the parameter mode,
along dimension(s) specified by the parameter axis.
Parameters
----------
name: str
The name of this... | [
"Add",
"a",
"reduce",
"layer",
".",
"Applies",
"the",
"function",
"specified",
"by",
"the",
"parameter",
"mode",
"along",
"dimension",
"(",
"s",
")",
"specified",
"by",
"the",
"parameter",
"axis",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2096-L2175 | [
"def",
"add_reduce",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"axis",
",",
"mode",
",",
"epsilon",
"=",
"1e-6",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_la... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_lrn | Add a LRN (local response normalization) layer. Please see the LRNLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer. Supports "across" channels normalization.
Parameters
----------
name: str
The name of this layer.
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_lrn(self, name, input_name, output_name, alpha, beta, local_size, k = 1.0):
"""
Add a LRN (local response normalization) layer. Please see the LRNLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer. Supports "across" channels norm... | def add_lrn(self, name, input_name, output_name, alpha, beta, local_size, k = 1.0):
"""
Add a LRN (local response normalization) layer. Please see the LRNLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer. Supports "across" channels norm... | [
"Add",
"a",
"LRN",
"(",
"local",
"response",
"normalization",
")",
"layer",
".",
"Please",
"see",
"the",
"LRNLayerParams",
"message",
"in",
"Core",
"ML",
"neural",
"network",
"protobuf",
"for",
"more",
"information",
"about",
"the",
"operation",
"of",
"this",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2178-L2224 | [
"def",
"add_lrn",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"alpha",
",",
"beta",
",",
"local_size",
",",
"k",
"=",
"1.0",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new laye... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_mvn | Add an MVN (mean variance normalization) layer. Computes mean, variance and normalizes the input.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_mvn(self, name, input_name, output_name, across_channels = True, normalize_variance = True, epsilon = 1e-5):
"""
Add an MVN (mean variance normalization) layer. Computes mean, variance and normalizes the input.
Parameters
----------
name: str
The name of this... | def add_mvn(self, name, input_name, output_name, across_channels = True, normalize_variance = True, epsilon = 1e-5):
"""
Add an MVN (mean variance normalization) layer. Computes mean, variance and normalizes the input.
Parameters
----------
name: str
The name of this... | [
"Add",
"an",
"MVN",
"(",
"mean",
"variance",
"normalization",
")",
"layer",
".",
"Computes",
"mean",
"variance",
"and",
"normalizes",
"the",
"input",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2226-L2268 | [
"def",
"add_mvn",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"across_channels",
"=",
"True",
",",
"normalize_variance",
"=",
"True",
",",
"epsilon",
"=",
"1e-5",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_l2_normalize | Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
name: str
The name of this layer.
input_name: str
The i... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_l2_normalize(self, name, input_name, output_name, epsilon = 1e-5):
"""
Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
... | def add_l2_normalize(self, name, input_name, output_name, epsilon = 1e-5):
"""
Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
... | [
"Add",
"L2",
"normalize",
"layer",
".",
"Normalizes",
"the",
"input",
"by",
"the",
"L2",
"norm",
"i",
".",
"e",
".",
"divides",
"by",
"the",
"the",
"square",
"root",
"of",
"the",
"sum",
"of",
"squares",
"of",
"all",
"elements",
"of",
"the",
"input",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2271-L2305 | [
"def",
"add_l2_normalize",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"epsilon",
"=",
"1e-5",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_unary | Add a Unary layer. Applies the specified function (mode) to all the elements of the input.
Please see the UnaryFunctionLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer.
Prior to the application of the function the input can be scaled a... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_unary(self, name, input_name, output_name, mode, alpha = 1.0,
shift = 0, scale = 1.0, epsilon = 1e-6):
"""
Add a Unary layer. Applies the specified function (mode) to all the elements of the input.
Please see the UnaryFunctionLayerParams message in Core ML neural netw... | def add_unary(self, name, input_name, output_name, mode, alpha = 1.0,
shift = 0, scale = 1.0, epsilon = 1e-6):
"""
Add a Unary layer. Applies the specified function (mode) to all the elements of the input.
Please see the UnaryFunctionLayerParams message in Core ML neural netw... | [
"Add",
"a",
"Unary",
"layer",
".",
"Applies",
"the",
"specified",
"function",
"(",
"mode",
")",
"to",
"all",
"the",
"elements",
"of",
"the",
"input",
".",
"Please",
"see",
"the",
"UnaryFunctionLayerParams",
"message",
"in",
"Core",
"ML",
"neural",
"network",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2308-L2377 | [
"def",
"add_unary",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"mode",
",",
"alpha",
"=",
"1.0",
",",
"shift",
"=",
"0",
",",
"scale",
"=",
"1.0",
",",
"epsilon",
"=",
"1e-6",
")",
":",
"spec",
"=",
"self",
".",
"spec",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_split | Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_names: [str]
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_split(self, name, input_name, output_names):
"""
Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
Th... | def add_split(self, name, input_name, output_names):
"""
Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
Th... | [
"Add",
"a",
"Split",
"layer",
"that",
"uniformly",
"splits",
"the",
"input",
"along",
"the",
"channel",
"dimension",
"to",
"produce",
"multiple",
"outputs",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2379-L2409 | [
"def",
"add_split",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_names",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_load_constant | Add a load constant layer.
Parameters
----------
name: str
The name of this layer.
output_name: str
The output blob name of this layer.
constant_value: numpy.array
value of the constant as a numpy array.
shape: [int]
Lis... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_load_constant(self, name, output_name, constant_value, shape):
"""
Add a load constant layer.
Parameters
----------
name: str
The name of this layer.
output_name: str
The output blob name of this layer.
constant_value: numpy.arra... | def add_load_constant(self, name, output_name, constant_value, shape):
"""
Add a load constant layer.
Parameters
----------
name: str
The name of this layer.
output_name: str
The output blob name of this layer.
constant_value: numpy.arra... | [
"Add",
"a",
"load",
"constant",
"layer",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2411-L2452 | [
"def",
"add_load_constant",
"(",
"self",
",",
"name",
",",
"output_name",
",",
"constant_value",
",",
"shape",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.add_custom | Add a custom layer.
Parameters
----------
name: str
The name of this layer.
input_names: [str]
The input blob names to this layer.
output_names: [str]
The output blob names from this layer.
custom_proto_spec: CustomLayerParams
... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def add_custom(self, name, input_names, output_names, custom_proto_spec = None):
"""
Add a custom layer.
Parameters
----------
name: str
The name of this layer.
input_names: [str]
The input blob names to this layer.
output_names: [str]
... | def add_custom(self, name, input_names, output_names, custom_proto_spec = None):
"""
Add a custom layer.
Parameters
----------
name: str
The name of this layer.
input_names: [str]
The input blob names to this layer.
output_names: [str]
... | [
"Add",
"a",
"custom",
"layer",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2455-L2491 | [
"def",
"add_custom",
"(",
"self",
",",
"name",
",",
"input_names",
",",
"output_names",
",",
"custom_proto_spec",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# custom layers require a newer specification versio... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | NeuralNetworkBuilder.set_pre_processing_parameters | Add pre-processing parameters to the neural network object
Parameters
----------
image_input_names: [str]
Name of input blobs that are images
is_bgr: boolean | dict()
Channel order for input blobs that are images. BGR if True else RGB.
To specify a d... | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | def set_pre_processing_parameters(self, image_input_names = [], is_bgr = False,
red_bias = 0.0, green_bias = 0.0, blue_bias = 0.0, gray_bias = 0.0, image_scale = 1.0):
"""Add pre-processing parameters to the neural network object
Parameters
----------
image_input_names: [str... | def set_pre_processing_parameters(self, image_input_names = [], is_bgr = False,
red_bias = 0.0, green_bias = 0.0, blue_bias = 0.0, gray_bias = 0.0, image_scale = 1.0):
"""Add pre-processing parameters to the neural network object
Parameters
----------
image_input_names: [str... | [
"Add",
"pre",
"-",
"processing",
"parameters",
"to",
"the",
"neural",
"network",
"object"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2494-L2570 | [
"def",
"set_pre_processing_parameters",
"(",
"self",
",",
"image_input_names",
"=",
"[",
"]",
",",
"is_bgr",
"=",
"False",
",",
"red_bias",
"=",
"0.0",
",",
"green_bias",
"=",
"0.0",
",",
"blue_bias",
"=",
"0.0",
",",
"gray_bias",
"=",
"0.0",
",",
"image_s... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | register | Registers a new generator class, specifying a set of
properties relevant to this scanner. Ctor for that class
should have one parameter: list of properties. | deps/src/boost_1_68_0/tools/build/src/build/scanner.py | def register(scanner_class, relevant_properties):
""" Registers a new generator class, specifying a set of
properties relevant to this scanner. Ctor for that class
should have one parameter: list of properties.
"""
assert issubclass(scanner_class, Scanner)
assert isinstance(relevant_pro... | def register(scanner_class, relevant_properties):
""" Registers a new generator class, specifying a set of
properties relevant to this scanner. Ctor for that class
should have one parameter: list of properties.
"""
assert issubclass(scanner_class, Scanner)
assert isinstance(relevant_pro... | [
"Registers",
"a",
"new",
"generator",
"class",
"specifying",
"a",
"set",
"of",
"properties",
"relevant",
"to",
"this",
"scanner",
".",
"Ctor",
"for",
"that",
"class",
"should",
"have",
"one",
"parameter",
":",
"list",
"of",
"properties",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/scanner.py#L54-L61 | [
"def",
"register",
"(",
"scanner_class",
",",
"relevant_properties",
")",
":",
"assert",
"issubclass",
"(",
"scanner_class",
",",
"Scanner",
")",
"assert",
"isinstance",
"(",
"relevant_properties",
",",
"basestring",
")",
"__scanners",
"[",
"str",
"(",
"scanner_cl... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get | Returns an instance of previously registered scanner
with the specified properties. | deps/src/boost_1_68_0/tools/build/src/build/scanner.py | def get(scanner_class, properties):
""" Returns an instance of previously registered scanner
with the specified properties.
"""
assert issubclass(scanner_class, Scanner)
assert is_iterable_typed(properties, basestring)
scanner_name = str(scanner_class)
if not registered(scanner_name):
... | def get(scanner_class, properties):
""" Returns an instance of previously registered scanner
with the specified properties.
"""
assert issubclass(scanner_class, Scanner)
assert is_iterable_typed(properties, basestring)
scanner_name = str(scanner_class)
if not registered(scanner_name):
... | [
"Returns",
"an",
"instance",
"of",
"previously",
"registered",
"scanner",
"with",
"the",
"specified",
"properties",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/scanner.py#L68-L87 | [
"def",
"get",
"(",
"scanner_class",
",",
"properties",
")",
":",
"assert",
"issubclass",
"(",
"scanner_class",
",",
"Scanner",
")",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"scanner_name",
"=",
"str",
"(",
"scanner_class",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ScannerRegistry.install | Installs the specified scanner on actual target 'target'.
vtarget: virtual target from which 'target' was actualized. | deps/src/boost_1_68_0/tools/build/src/build/scanner.py | def install (self, scanner, target, vtarget):
""" Installs the specified scanner on actual target 'target'.
vtarget: virtual target from which 'target' was actualized.
"""
assert isinstance(scanner, Scanner)
assert isinstance(target, basestring)
assert isinstance(vtar... | def install (self, scanner, target, vtarget):
""" Installs the specified scanner on actual target 'target'.
vtarget: virtual target from which 'target' was actualized.
"""
assert isinstance(scanner, Scanner)
assert isinstance(target, basestring)
assert isinstance(vtar... | [
"Installs",
"the",
"specified",
"scanner",
"on",
"actual",
"target",
"target",
".",
"vtarget",
":",
"virtual",
"target",
"from",
"which",
"target",
"was",
"actualized",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/scanner.py#L133-L157 | [
"def",
"install",
"(",
"self",
",",
"scanner",
",",
"target",
",",
"vtarget",
")",
":",
"assert",
"isinstance",
"(",
"scanner",
",",
"Scanner",
")",
"assert",
"isinstance",
"(",
"target",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"vtarget",
",",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _fill_function | Fills in the rest of function data into the skeleton function object
that were created via _make_skel_func(). | src/unity/python/turicreate/util/_cloudpickle.py | def _fill_function(func, globals, defaults, dict, module, closure_values):
""" Fills in the rest of function data into the skeleton function object
that were created via _make_skel_func().
"""
func.__globals__.update(globals)
func.__defaults__ = defaults
func.__dict__ = dict
func.__modul... | def _fill_function(func, globals, defaults, dict, module, closure_values):
""" Fills in the rest of function data into the skeleton function object
that were created via _make_skel_func().
"""
func.__globals__.update(globals)
func.__defaults__ = defaults
func.__dict__ = dict
func.__modul... | [
"Fills",
"in",
"the",
"rest",
"of",
"function",
"data",
"into",
"the",
"skeleton",
"function",
"object",
"that",
"were",
"created",
"via",
"_make_skel_func",
"()",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1090-L1105 | [
"def",
"_fill_function",
"(",
"func",
",",
"globals",
",",
"defaults",
",",
"dict",
",",
"module",
",",
"closure_values",
")",
":",
"func",
".",
"__globals__",
".",
"update",
"(",
"globals",
")",
"func",
".",
"__defaults__",
"=",
"defaults",
"func",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _make_skel_func | Creates a skeleton function object that contains just the provided
code and the correct number of cells in func_closure. All other
func attributes (e.g. func_globals) are empty. | src/unity/python/turicreate/util/_cloudpickle.py | def _make_skel_func(code, cell_count, base_globals=None):
""" Creates a skeleton function object that contains just the provided
code and the correct number of cells in func_closure. All other
func attributes (e.g. func_globals) are empty.
"""
if base_globals is None:
base_globals =... | def _make_skel_func(code, cell_count, base_globals=None):
""" Creates a skeleton function object that contains just the provided
code and the correct number of cells in func_closure. All other
func attributes (e.g. func_globals) are empty.
"""
if base_globals is None:
base_globals =... | [
"Creates",
"a",
"skeleton",
"function",
"object",
"that",
"contains",
"just",
"the",
"provided",
"code",
"and",
"the",
"correct",
"number",
"of",
"cells",
"in",
"func_closure",
".",
"All",
"other",
"func",
"attributes",
"(",
"e",
".",
"g",
".",
"func_globals... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1117-L1131 | [
"def",
"_make_skel_func",
"(",
"code",
",",
"cell_count",
",",
"base_globals",
"=",
"None",
")",
":",
"if",
"base_globals",
"is",
"None",
":",
"base_globals",
"=",
"{",
"}",
"base_globals",
"[",
"'__builtins__'",
"]",
"=",
"__builtins__",
"closure",
"=",
"("... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _rehydrate_skeleton_class | Put attributes from `class_dict` back on `skeleton_class`.
See CloudPickler.save_dynamic_class for more info. | src/unity/python/turicreate/util/_cloudpickle.py | def _rehydrate_skeleton_class(skeleton_class, class_dict):
"""Put attributes from `class_dict` back on `skeleton_class`.
See CloudPickler.save_dynamic_class for more info.
"""
for attrname, attr in class_dict.items():
setattr(skeleton_class, attrname, attr)
return skeleton_class | def _rehydrate_skeleton_class(skeleton_class, class_dict):
"""Put attributes from `class_dict` back on `skeleton_class`.
See CloudPickler.save_dynamic_class for more info.
"""
for attrname, attr in class_dict.items():
setattr(skeleton_class, attrname, attr)
return skeleton_class | [
"Put",
"attributes",
"from",
"class_dict",
"back",
"on",
"skeleton_class",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1134-L1141 | [
"def",
"_rehydrate_skeleton_class",
"(",
"skeleton_class",
",",
"class_dict",
")",
":",
"for",
"attrname",
",",
"attr",
"in",
"class_dict",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"skeleton_class",
",",
"attrname",
",",
"attr",
")",
"return",
"skeleton_cl... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _find_module | Iterate over each part instead of calling imp.find_module directly.
This function is able to find submodules (e.g. sickit.tree) | src/unity/python/turicreate/util/_cloudpickle.py | def _find_module(mod_name):
"""
Iterate over each part instead of calling imp.find_module directly.
This function is able to find submodules (e.g. sickit.tree)
"""
path = None
for part in mod_name.split('.'):
if path is not None:
path = [path]
file, path, description ... | def _find_module(mod_name):
"""
Iterate over each part instead of calling imp.find_module directly.
This function is able to find submodules (e.g. sickit.tree)
"""
path = None
for part in mod_name.split('.'):
if path is not None:
path = [path]
file, path, description ... | [
"Iterate",
"over",
"each",
"part",
"instead",
"of",
"calling",
"imp",
".",
"find_module",
"directly",
".",
"This",
"function",
"is",
"able",
"to",
"find",
"submodules",
"(",
"e",
".",
"g",
".",
"sickit",
".",
"tree",
")"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1144-L1156 | [
"def",
"_find_module",
"(",
"mod_name",
")",
":",
"path",
"=",
"None",
"for",
"part",
"in",
"mod_name",
".",
"split",
"(",
"'.'",
")",
":",
"if",
"path",
"is",
"not",
"None",
":",
"path",
"=",
"[",
"path",
"]",
"file",
",",
"path",
",",
"descriptio... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_module | Save a module as an import | src/unity/python/turicreate/util/_cloudpickle.py | def save_module(self, obj):
"""
Save a module as an import
"""
mod_name = obj.__name__
# If module is successfully found then it is not a dynamically created module
if hasattr(obj, '__file__'):
is_dynamic = False
else:
try:
... | def save_module(self, obj):
"""
Save a module as an import
"""
mod_name = obj.__name__
# If module is successfully found then it is not a dynamically created module
if hasattr(obj, '__file__'):
is_dynamic = False
else:
try:
... | [
"Save",
"a",
"module",
"as",
"an",
"import"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L285-L304 | [
"def",
"save_module",
"(",
"self",
",",
"obj",
")",
":",
"mod_name",
"=",
"obj",
".",
"__name__",
"# If module is successfully found then it is not a dynamically created module",
"if",
"hasattr",
"(",
"obj",
",",
"'__file__'",
")",
":",
"is_dynamic",
"=",
"False",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler._save_subimports | Ensure de-pickler imports any package child-modules that
are needed by the function | src/unity/python/turicreate/util/_cloudpickle.py | def _save_subimports(self, code, top_level_dependencies):
"""
Ensure de-pickler imports any package child-modules that
are needed by the function
"""
# check if any known dependency is an imported package
for x in top_level_dependencies:
if isinstance(x, types... | def _save_subimports(self, code, top_level_dependencies):
"""
Ensure de-pickler imports any package child-modules that
are needed by the function
"""
# check if any known dependency is an imported package
for x in top_level_dependencies:
if isinstance(x, types... | [
"Ensure",
"de",
"-",
"pickler",
"imports",
"any",
"package",
"child",
"-",
"modules",
"that",
"are",
"needed",
"by",
"the",
"function"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L405-L424 | [
"def",
"_save_subimports",
"(",
"self",
",",
"code",
",",
"top_level_dependencies",
")",
":",
"# check if any known dependency is an imported package",
"for",
"x",
"in",
"top_level_dependencies",
":",
"if",
"isinstance",
"(",
"x",
",",
"types",
".",
"ModuleType",
")",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_dynamic_class | Save a class that can't be stored as module global.
This method is used to serialize classes that are defined inside
functions, or that otherwise can't be serialized as attribute lookups
from global modules. | src/unity/python/turicreate/util/_cloudpickle.py | def save_dynamic_class(self, obj):
"""
Save a class that can't be stored as module global.
This method is used to serialize classes that are defined inside
functions, or that otherwise can't be serialized as attribute lookups
from global modules.
"""
clsdict = di... | def save_dynamic_class(self, obj):
"""
Save a class that can't be stored as module global.
This method is used to serialize classes that are defined inside
functions, or that otherwise can't be serialized as attribute lookups
from global modules.
"""
clsdict = di... | [
"Save",
"a",
"class",
"that",
"can",
"t",
"be",
"stored",
"as",
"module",
"global",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L426-L494 | [
"def",
"save_dynamic_class",
"(",
"self",
",",
"obj",
")",
":",
"clsdict",
"=",
"dict",
"(",
"obj",
".",
"__dict__",
")",
"# copy dict proxy to a dict",
"if",
"not",
"isinstance",
"(",
"clsdict",
".",
"get",
"(",
"'__dict__'",
",",
"None",
")",
",",
"prope... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_function_tuple | Pickles an actual func object.
A func comprises: code, globals, defaults, closure, and dict. We
extract and save these, injecting reducing functions at certain points
to recreate the func object. Keep in mind that some of these pieces
can contain a ref to the func itself. Thus, a nai... | src/unity/python/turicreate/util/_cloudpickle.py | def save_function_tuple(self, func):
""" Pickles an actual func object.
A func comprises: code, globals, defaults, closure, and dict. We
extract and save these, injecting reducing functions at certain points
to recreate the func object. Keep in mind that some of these pieces
... | def save_function_tuple(self, func):
""" Pickles an actual func object.
A func comprises: code, globals, defaults, closure, and dict. We
extract and save these, injecting reducing functions at certain points
to recreate the func object. Keep in mind that some of these pieces
... | [
"Pickles",
"an",
"actual",
"func",
"object",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L496-L543 | [
"def",
"save_function_tuple",
"(",
"self",
",",
"func",
")",
":",
"if",
"is_tornado_coroutine",
"(",
"func",
")",
":",
"self",
".",
"save_reduce",
"(",
"_rebuild_tornado_coroutine",
",",
"(",
"func",
".",
"__wrapped__",
",",
")",
",",
"obj",
"=",
"func",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.extract_code_globals | Find all globals names read or written to by codeblock co | src/unity/python/turicreate/util/_cloudpickle.py | def extract_code_globals(cls, co):
"""
Find all globals names read or written to by codeblock co
"""
out_names = cls._extract_code_globals_cache.get(co)
if out_names is None:
try:
names = co.co_names
except AttributeError:
#... | def extract_code_globals(cls, co):
"""
Find all globals names read or written to by codeblock co
"""
out_names = cls._extract_code_globals_cache.get(co)
if out_names is None:
try:
names = co.co_names
except AttributeError:
#... | [
"Find",
"all",
"globals",
"names",
"read",
"or",
"written",
"to",
"by",
"codeblock",
"co"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L551-L574 | [
"def",
"extract_code_globals",
"(",
"cls",
",",
"co",
")",
":",
"out_names",
"=",
"cls",
".",
"_extract_code_globals_cache",
".",
"get",
"(",
"co",
")",
"if",
"out_names",
"is",
"None",
":",
"try",
":",
"names",
"=",
"co",
".",
"co_names",
"except",
"Att... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_global | Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here. | src/unity/python/turicreate/util/_cloudpickle.py | def save_global(self, obj, name=None, pack=struct.pack):
"""
Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here.
"""
if obj.__module__ == "__builtin__" or obj.__module__ == "builtins":
if obj in _BUILTIN_TYPE_NAMES:... | def save_global(self, obj, name=None, pack=struct.pack):
"""
Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here.
"""
if obj.__module__ == "__builtin__" or obj.__module__ == "builtins":
if obj in _BUILTIN_TYPE_NAMES:... | [
"Save",
"a",
"global",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L616-L653 | [
"def",
"save_global",
"(",
"self",
",",
"obj",
",",
"name",
"=",
"None",
",",
"pack",
"=",
"struct",
".",
"pack",
")",
":",
"if",
"obj",
".",
"__module__",
"==",
"\"__builtin__\"",
"or",
"obj",
".",
"__module__",
"==",
"\"builtins\"",
":",
"if",
"obj",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_reduce | Modified to support __transient__ on new objects
Change only affects protocol level 2 (which is always used by PiCloud | src/unity/python/turicreate/util/_cloudpickle.py | def save_reduce(self, func, args, state=None,
listitems=None, dictitems=None, obj=None):
"""Modified to support __transient__ on new objects
Change only affects protocol level 2 (which is always used by PiCloud"""
# Assert that args is a tuple or None
if not isinstanc... | def save_reduce(self, func, args, state=None,
listitems=None, dictitems=None, obj=None):
"""Modified to support __transient__ on new objects
Change only affects protocol level 2 (which is always used by PiCloud"""
# Assert that args is a tuple or None
if not isinstanc... | [
"Modified",
"to",
"support",
"__transient__",
"on",
"new",
"objects",
"Change",
"only",
"affects",
"protocol",
"level",
"2",
"(",
"which",
"is",
"always",
"used",
"by",
"PiCloud"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L777-L837 | [
"def",
"save_reduce",
"(",
"self",
",",
"func",
",",
"args",
",",
"state",
"=",
"None",
",",
"listitems",
"=",
"None",
",",
"dictitems",
"=",
"None",
",",
"obj",
"=",
"None",
")",
":",
"# Assert that args is a tuple or None",
"if",
"not",
"isinstance",
"("... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_partial | Partial objects do not serialize correctly in python2.x -- this fixes the bugs | src/unity/python/turicreate/util/_cloudpickle.py | def save_partial(self, obj):
"""Partial objects do not serialize correctly in python2.x -- this fixes the bugs"""
self.save_reduce(_genpartial, (obj.func, obj.args, obj.keywords)) | def save_partial(self, obj):
"""Partial objects do not serialize correctly in python2.x -- this fixes the bugs"""
self.save_reduce(_genpartial, (obj.func, obj.args, obj.keywords)) | [
"Partial",
"objects",
"do",
"not",
"serialize",
"correctly",
"in",
"python2",
".",
"x",
"--",
"this",
"fixes",
"the",
"bugs"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L839-L841 | [
"def",
"save_partial",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"save_reduce",
"(",
"_genpartial",
",",
"(",
"obj",
".",
"func",
",",
"obj",
".",
"args",
",",
"obj",
".",
"keywords",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_file | Save a file | src/unity/python/turicreate/util/_cloudpickle.py | def save_file(self, obj):
"""Save a file"""
try:
import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute
except ImportError:
import io as pystringIO
if not hasattr(obj, 'name') or not hasattr(obj, 'mode'):
raise pickle.Pi... | def save_file(self, obj):
"""Save a file"""
try:
import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute
except ImportError:
import io as pystringIO
if not hasattr(obj, 'name') or not hasattr(obj, 'mode'):
raise pickle.Pi... | [
"Save",
"a",
"file"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L847-L886 | [
"def",
"save_file",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"import",
"StringIO",
"as",
"pystringIO",
"#we can't use cStringIO as it lacks the name attribute",
"except",
"ImportError",
":",
"import",
"io",
"as",
"pystringIO",
"if",
"not",
"hasattr",
"(",
"o... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | CloudPickler.save_ufunc | Hack function for saving numpy ufunc objects | src/unity/python/turicreate/util/_cloudpickle.py | def save_ufunc(self, obj):
"""Hack function for saving numpy ufunc objects"""
name = obj.__name__
numpy_tst_mods = ['numpy', 'scipy.special']
for tst_mod_name in numpy_tst_mods:
tst_mod = sys.modules.get(tst_mod_name, None)
if tst_mod and name in tst_mod.__dict__:... | def save_ufunc(self, obj):
"""Hack function for saving numpy ufunc objects"""
name = obj.__name__
numpy_tst_mods = ['numpy', 'scipy.special']
for tst_mod_name in numpy_tst_mods:
tst_mod = sys.modules.get(tst_mod_name, None)
if tst_mod and name in tst_mod.__dict__:... | [
"Hack",
"function",
"for",
"saving",
"numpy",
"ufunc",
"objects"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L915-L924 | [
"def",
"save_ufunc",
"(",
"self",
",",
"obj",
")",
":",
"name",
"=",
"obj",
".",
"__name__",
"numpy_tst_mods",
"=",
"[",
"'numpy'",
",",
"'scipy.special'",
"]",
"for",
"tst_mod_name",
"in",
"numpy_tst_mods",
":",
"tst_mod",
"=",
"sys",
".",
"modules",
".",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ExtractSymbols | Pulls out all the symbols from a descriptor proto.
Args:
desc_proto: The proto to extract symbols from.
package: The package containing the descriptor type.
Yields:
The fully qualified name found in the descriptor. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py | def _ExtractSymbols(desc_proto, package):
"""Pulls out all the symbols from a descriptor proto.
Args:
desc_proto: The proto to extract symbols from.
package: The package containing the descriptor type.
Yields:
The fully qualified name found in the descriptor.
"""
message_name = '.'.join((packag... | def _ExtractSymbols(desc_proto, package):
"""Pulls out all the symbols from a descriptor proto.
Args:
desc_proto: The proto to extract symbols from.
package: The package containing the descriptor type.
Yields:
The fully qualified name found in the descriptor.
"""
message_name = '.'.join((packag... | [
"Pulls",
"out",
"all",
"the",
"symbols",
"from",
"a",
"descriptor",
"proto",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py#L127-L144 | [
"def",
"_ExtractSymbols",
"(",
"desc_proto",
",",
"package",
")",
":",
"message_name",
"=",
"'.'",
".",
"join",
"(",
"(",
"package",
",",
"desc_proto",
".",
"name",
")",
")",
"yield",
"message_name",
"for",
"nested_type",
"in",
"desc_proto",
".",
"nested_typ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | DescriptorDatabase.Add | Adds the FileDescriptorProto and its types to this database.
Args:
file_desc_proto: The FileDescriptorProto to add.
Raises:
DescriptorDatabaseConflictingDefinitionError: if an attempt is made to
add a proto with the same name but different definition than an
exisiting proto in the d... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py | def Add(self, file_desc_proto):
"""Adds the FileDescriptorProto and its types to this database.
Args:
file_desc_proto: The FileDescriptorProto to add.
Raises:
DescriptorDatabaseConflictingDefinitionError: if an attempt is made to
add a proto with the same name but different definition t... | def Add(self, file_desc_proto):
"""Adds the FileDescriptorProto and its types to this database.
Args:
file_desc_proto: The FileDescriptorProto to add.
Raises:
DescriptorDatabaseConflictingDefinitionError: if an attempt is made to
add a proto with the same name but different definition t... | [
"Adds",
"the",
"FileDescriptorProto",
"and",
"its",
"types",
"to",
"this",
"database",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py#L51-L81 | [
"def",
"Add",
"(",
"self",
",",
"file_desc_proto",
")",
":",
"proto_name",
"=",
"file_desc_proto",
".",
"name",
"if",
"proto_name",
"not",
"in",
"self",
".",
"_file_desc_protos_by_file",
":",
"self",
".",
"_file_desc_protos_by_file",
"[",
"proto_name",
"]",
"=",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a normalizer model to the protobuf spec.
Parameters
----------
model: Normalizer
A Normalizer.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Returns
-------
model_spec: An object of type Model_pb.
... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_normalizer.py | def convert(model, input_features, output_features):
"""Convert a normalizer model to the protobuf spec.
Parameters
----------
model: Normalizer
A Normalizer.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Returns
... | def convert(model, input_features, output_features):
"""Convert a normalizer model to the protobuf spec.
Parameters
----------
model: Normalizer
A Normalizer.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Returns
... | [
"Convert",
"a",
"normalizer",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_normalizer.py#L24-L64 | [
"def",
"convert",
"(",
"model",
",",
"input_features",
",",
"output_features",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"# Test the scikit-learn model",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | mpi_submit | customized submit script, that submit nslave jobs, each must contain args as parameter
note this can be a lambda function containing additional parameters in input
Parameters
nslave number of slave process to start up
args arguments to launch each job
this usually includes th... | src/external/xgboost/subtree/rabit/tracker/rabit_mpi.py | def mpi_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 arg... | def mpi_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 arg... | [
"customized",
"submit",
"script",
"that",
"submit",
"nslave",
"jobs",
"each",
"must",
"contain",
"args",
"as",
"parameter",
"note",
"this",
"can",
"be",
"a",
"lambda",
"function",
"containing",
"additional",
"parameters",
"in",
"input",
"Parameters",
"nslave",
"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_mpi.py#L24-L40 | [
"def",
"mpi_submit",
"(",
"nslave",
",",
"worker_args",
",",
"worker_envs",
")",
":",
"worker_args",
"+=",
"[",
"'%s=%s'",
"%",
"(",
"k",
",",
"str",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"worker_envs",
".",
"items",
"(",
")",
"]",
"sargs... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ByteCodeConsumer.consume | Consume byte-code | src/unity/python/turicreate/meta/bytecodetools/bytecode_consumer.py | def consume(self):
'''
Consume byte-code
'''
generic_consume = getattr(self, 'generic_consume', None)
for instr in disassembler(self.code):
method_name = 'consume_%s' % (instr.opname)
method = getattr(self, method_name, generic_consume)
... | def consume(self):
'''
Consume byte-code
'''
generic_consume = getattr(self, 'generic_consume', None)
for instr in disassembler(self.code):
method_name = 'consume_%s' % (instr.opname)
method = getattr(self, method_name, generic_consume)
... | [
"Consume",
"byte",
"-",
"code"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/bytecodetools/bytecode_consumer.py#L25-L39 | [
"def",
"consume",
"(",
"self",
")",
":",
"generic_consume",
"=",
"getattr",
"(",
"self",
",",
"'generic_consume'",
",",
"None",
")",
"for",
"instr",
"in",
"disassembler",
"(",
"self",
".",
"code",
")",
":",
"method_name",
"=",
"'consume_%s'",
"%",
"(",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | Create a (binary or multi-class) classifier model of type
:class:`~turicreate.random_forest_classifier.RandomForestClassifier` using
an ensemble of decision trees trained on subsets of the data.
Parameters
----------
dataset : SFrame
A training dataset containing feature columns and a targe... | src/unity/python/turicreate/toolkits/classifier/random_forest_classifier.py | def create(dataset, target,
features=None,
max_iterations=10,
validation_set='auto',
verbose=True, class_weights=None,
random_seed=None,
metric='auto',
**kwargs):
"""
Create a (binary or multi-class) classifier model of type
:class... | def create(dataset, target,
features=None,
max_iterations=10,
validation_set='auto',
verbose=True, class_weights=None,
random_seed=None,
metric='auto',
**kwargs):
"""
Create a (binary or multi-class) classifier model of type
:class... | [
"Create",
"a",
"(",
"binary",
"or",
"multi",
"-",
"class",
")",
"classifier",
"model",
"of",
"type",
":",
"class",
":",
"~turicreate",
".",
"random_forest_classifier",
".",
"RandomForestClassifier",
"using",
"an",
"ensemble",
"of",
"decision",
"trees",
"trained"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/random_forest_classifier.py#L443-L610 | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"features",
"=",
"None",
",",
"max_iterations",
"=",
"10",
",",
"validation_set",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
",",
"class_weights",
"=",
"None",
",",
"random_seed",
"=",
"None",
",",
"m... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | RandomForestClassifier.classify | Return a classification, for each example in the ``dataset``, using the
trained random forest model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
Parameters
----------
dataset : SFrame
Dataset of n... | src/unity/python/turicreate/toolkits/classifier/random_forest_classifier.py | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained random forest model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
P... | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained random forest model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
P... | [
"Return",
"a",
"classification",
"for",
"each",
"example",
"in",
"the",
"dataset",
"using",
"the",
"trained",
"random",
"forest",
"model",
".",
"The",
"output",
"SFrame",
"contains",
"predictions",
"as",
"class",
"labels",
"(",
"0",
"or",
"1",
")",
"and",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/random_forest_classifier.py#L360-L406 | [
"def",
"classify",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"return",
"super",
"(",
"RandomForestClassifier",
",",
"self",
")",
".",
"classify",
"(",
"dataset",
",",
"missing_value_action",
"=",
"missing_value_action",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_layer_converter_fn | Get the right converter function for Keras | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py | def _get_layer_converter_fn(layer):
"""Get the right converter function for Keras
"""
layer_type = type(layer)
if layer_type in _KERAS_LAYER_REGISTRY:
return _KERAS_LAYER_REGISTRY[layer_type]
else:
raise TypeError("Keras layer of type %s is not supported." % type(layer)) | def _get_layer_converter_fn(layer):
"""Get the right converter function for Keras
"""
layer_type = type(layer)
if layer_type in _KERAS_LAYER_REGISTRY:
return _KERAS_LAYER_REGISTRY[layer_type]
else:
raise TypeError("Keras layer of type %s is not supported." % type(layer)) | [
"Get",
"the",
"right",
"converter",
"function",
"for",
"Keras"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py#L103-L110 | [
"def",
"_get_layer_converter_fn",
"(",
"layer",
")",
":",
"layer_type",
"=",
"type",
"(",
"layer",
")",
"if",
"layer_type",
"in",
"_KERAS_LAYER_REGISTRY",
":",
"return",
"_KERAS_LAYER_REGISTRY",
"[",
"layer_type",
"]",
"else",
":",
"raise",
"TypeError",
"(",
"\"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convertToSpec | Convert a Keras model to Core ML protobuf specification (.mlmodel).
Parameters
----------
model: Keras model object | str | (str, str)
A trained Keras neural network model which can be one of the following:
- a Keras model object
- a string with the path to a Keras model file (h5)
... | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py | def convertToSpec(model,
input_names = None,
output_names = None,
image_input_names = None,
input_name_shape_dict = {},
is_bgr = False,
red_bias = 0.0,
green_bias = 0.0,
blue_b... | def convertToSpec(model,
input_names = None,
output_names = None,
image_input_names = None,
input_name_shape_dict = {},
is_bgr = False,
red_bias = 0.0,
green_bias = 0.0,
blue_b... | [
"Convert",
"a",
"Keras",
"model",
"to",
"Core",
"ML",
"protobuf",
"specification",
"(",
".",
"mlmodel",
")",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py#L333-L564 | [
"def",
"convertToSpec",
"(",
"model",
",",
"input_names",
"=",
"None",
",",
"output_names",
"=",
"None",
",",
"image_input_names",
"=",
"None",
",",
"input_name_shape_dict",
"=",
"{",
"}",
",",
"is_bgr",
"=",
"False",
",",
"red_bias",
"=",
"0.0",
",",
"gre... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a Keras model to Core ML protobuf specification (.mlmodel).
Parameters
----------
model: Keras model object | str | (str, str)
A trained Keras neural network model which can be one of the following:
- a Keras model object
- a string with the path to a Keras model file (h5)... | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py | def convert(model,
input_names = None,
output_names = None,
image_input_names = None,
input_name_shape_dict = {},
is_bgr = False,
red_bias = 0.0,
green_bias = 0.0,
blue_bias = ... | def convert(model,
input_names = None,
output_names = None,
image_input_names = None,
input_name_shape_dict = {},
is_bgr = False,
red_bias = 0.0,
green_bias = 0.0,
blue_bias = ... | [
"Convert",
"a",
"Keras",
"model",
"to",
"Core",
"ML",
"protobuf",
"specification",
"(",
".",
"mlmodel",
")",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py#L567-L762 | [
"def",
"convert",
"(",
"model",
",",
"input_names",
"=",
"None",
",",
"output_names",
"=",
"None",
",",
"image_input_names",
"=",
"None",
",",
"input_name_shape_dict",
"=",
"{",
"}",
",",
"is_bgr",
"=",
"False",
",",
"red_bias",
"=",
"0.0",
",",
"green_bia... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : RandomForestRegressor
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output column.
Returns
-------
model_spec: A... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_random_forest_regressor.py | def convert(model, feature_names, target):
"""Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : RandomForestRegressor
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output ... | def convert(model, feature_names, target):
"""Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : RandomForestRegressor
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output ... | [
"Convert",
"a",
"boosted",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_random_forest_regressor.py#L19-L53 | [
"def",
"convert",
"(",
"model",
",",
"feature_names",
",",
"target",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"_sklearn_util",
".",
"check_expected_type... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | Create a DBSCAN clustering model. The DBSCAN method partitions the input
dataset into three types of points, based on the estimated probability
density at each point.
- **Core** points have a large number of points within a given neighborhood.
Specifically, `min_core_neighbors` must be within distanc... | src/unity/python/turicreate/toolkits/clustering/dbscan.py | def create(dataset, features=None, distance=None, radius=1.,
min_core_neighbors=10, verbose=True):
"""
Create a DBSCAN clustering model. The DBSCAN method partitions the input
dataset into three types of points, based on the estimated probability
density at each point.
- **Core** points ... | def create(dataset, features=None, distance=None, radius=1.,
min_core_neighbors=10, verbose=True):
"""
Create a DBSCAN clustering model. The DBSCAN method partitions the input
dataset into three types of points, based on the estimated probability
density at each point.
- **Core** points ... | [
"Create",
"a",
"DBSCAN",
"clustering",
"model",
".",
"The",
"DBSCAN",
"method",
"partitions",
"the",
"input",
"dataset",
"into",
"three",
"types",
"of",
"points",
"based",
"on",
"the",
"estimated",
"probability",
"density",
"at",
"each",
"point",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/dbscan.py#L24-L322 | [
"def",
"create",
"(",
"dataset",
",",
"features",
"=",
"None",
",",
"distance",
"=",
"None",
",",
"radius",
"=",
"1.",
",",
"min_core_neighbors",
"=",
"10",
",",
"verbose",
"=",
"True",
")",
":",
"## Start the training time clock and instantiate an empty model",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | find_lib_path | Load find the path to xgboost dynamic library files.
Returns
-------
lib_path: list(string)
List of all found library path to xgboost | src/external/xgboost/python-package/xgboost/libpath.py | def find_lib_path():
"""Load find the path to xgboost dynamic library files.
Returns
-------
lib_path: list(string)
List of all found library path to xgboost
"""
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
# make pythonpack hack: copy this directory one... | def find_lib_path():
"""Load find the path to xgboost dynamic library files.
Returns
-------
lib_path: list(string)
List of all found library path to xgboost
"""
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
# make pythonpack hack: copy this directory one... | [
"Load",
"find",
"the",
"path",
"to",
"xgboost",
"dynamic",
"library",
"files",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/libpath.py#L13-L45 | [
"def",
"find_lib_path",
"(",
")",
":",
"curr_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"__file__",
")",
")",
")",
"# make pythonpack hack: copy this directory one le... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_expected_type | Check if a model is of the right type. Raise error if not.
Parameters
----------
model: model
Any scikit-learn model
expected_type: Type
Expected type of the scikit-learn. | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_sklearn_util.py | def check_expected_type(model, expected_type):
"""Check if a model is of the right type. Raise error if not.
Parameters
----------
model: model
Any scikit-learn model
expected_type: Type
Expected type of the scikit-learn.
"""
if (model.__class__.__name__ != expected_type.__... | def check_expected_type(model, expected_type):
"""Check if a model is of the right type. Raise error if not.
Parameters
----------
model: model
Any scikit-learn model
expected_type: Type
Expected type of the scikit-learn.
"""
if (model.__class__.__name__ != expected_type.__... | [
"Check",
"if",
"a",
"model",
"is",
"of",
"the",
"right",
"type",
".",
"Raise",
"error",
"if",
"not",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_sklearn_util.py#L20-L33 | [
"def",
"check_expected_type",
"(",
"model",
",",
"expected_type",
")",
":",
"if",
"(",
"model",
".",
"__class__",
".",
"__name__",
"!=",
"expected_type",
".",
"__name__",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected model of type '%s' (got %s)\"",
"%",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a LIBSVM model to Core ML format.
Parameters
----------
model: a libsvm model (C-SVC, nu-SVC, epsilon-SVR, or nu-SVR)
or string path to a saved model.
input_names: str | [str]
Name of the input column(s).
If a single string is used (the default) the input will be an ar... | src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/__init__.py | def convert(model, input_names='input', target_name='target',
probability='classProbability', input_length='auto'):
"""
Convert a LIBSVM model to Core ML format.
Parameters
----------
model: a libsvm model (C-SVC, nu-SVC, epsilon-SVR, or nu-SVR)
or string path to a saved model.... | def convert(model, input_names='input', target_name='target',
probability='classProbability', input_length='auto'):
"""
Convert a LIBSVM model to Core ML format.
Parameters
----------
model: a libsvm model (C-SVC, nu-SVC, epsilon-SVR, or nu-SVR)
or string path to a saved model.... | [
"Convert",
"a",
"LIBSVM",
"model",
"to",
"Core",
"ML",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/__init__.py#L17-L93 | [
"def",
"convert",
"(",
"model",
",",
"input_names",
"=",
"'input'",
",",
"target_name",
"=",
"'target'",
",",
"probability",
"=",
"'classProbability'",
",",
"input_length",
"=",
"'auto'",
")",
":",
"if",
"not",
"(",
"_HAS_LIBSVM",
")",
":",
"raise",
"Runtime... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | RepeatedScalarFieldContainer.append | Appends an item to the list. Similar to list.append(). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py | def append(self, value):
"""Appends an item to the list. Similar to list.append()."""
self._values.append(self._type_checker.CheckValue(value))
if not self._message_listener.dirty:
self._message_listener.Modified() | def append(self, value):
"""Appends an item to the list. Similar to list.append()."""
self._values.append(self._type_checker.CheckValue(value))
if not self._message_listener.dirty:
self._message_listener.Modified() | [
"Appends",
"an",
"item",
"to",
"the",
"list",
".",
"Similar",
"to",
"list",
".",
"append",
"()",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L249-L253 | [
"def",
"append",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_values",
".",
"append",
"(",
"self",
".",
"_type_checker",
".",
"CheckValue",
"(",
"value",
")",
")",
"if",
"not",
"self",
".",
"_message_listener",
".",
"dirty",
":",
"self",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | RepeatedScalarFieldContainer.insert | Inserts the item at the specified position. Similar to list.insert(). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py | def insert(self, key, value):
"""Inserts the item at the specified position. Similar to list.insert()."""
self._values.insert(key, self._type_checker.CheckValue(value))
if not self._message_listener.dirty:
self._message_listener.Modified() | def insert(self, key, value):
"""Inserts the item at the specified position. Similar to list.insert()."""
self._values.insert(key, self._type_checker.CheckValue(value))
if not self._message_listener.dirty:
self._message_listener.Modified() | [
"Inserts",
"the",
"item",
"at",
"the",
"specified",
"position",
".",
"Similar",
"to",
"list",
".",
"insert",
"()",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L255-L259 | [
"def",
"insert",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_values",
".",
"insert",
"(",
"key",
",",
"self",
".",
"_type_checker",
".",
"CheckValue",
"(",
"value",
")",
")",
"if",
"not",
"self",
".",
"_message_listener",
".",
"di... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | RepeatedScalarFieldContainer.extend | Extends by appending the given iterable. Similar to list.extend(). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py | def extend(self, elem_seq):
"""Extends by appending the given iterable. Similar to list.extend()."""
if elem_seq is None:
return
try:
elem_seq_iter = iter(elem_seq)
except TypeError:
if not elem_seq:
# silently ignore falsy inputs :-/.
# TODO(ptucker): Deprecate this b... | def extend(self, elem_seq):
"""Extends by appending the given iterable. Similar to list.extend()."""
if elem_seq is None:
return
try:
elem_seq_iter = iter(elem_seq)
except TypeError:
if not elem_seq:
# silently ignore falsy inputs :-/.
# TODO(ptucker): Deprecate this b... | [
"Extends",
"by",
"appending",
"the",
"given",
"iterable",
".",
"Similar",
"to",
"list",
".",
"extend",
"()",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L261-L278 | [
"def",
"extend",
"(",
"self",
",",
"elem_seq",
")",
":",
"if",
"elem_seq",
"is",
"None",
":",
"return",
"try",
":",
"elem_seq_iter",
"=",
"iter",
"(",
"elem_seq",
")",
"except",
"TypeError",
":",
"if",
"not",
"elem_seq",
":",
"# silently ignore falsy inputs ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | RepeatedScalarFieldContainer.MergeFrom | Appends the contents of another repeated field of the same type to this
one. We do not check the types of the individual fields. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py | def MergeFrom(self, other):
"""Appends the contents of another repeated field of the same type to this
one. We do not check the types of the individual fields.
"""
self._values.extend(other._values)
self._message_listener.Modified() | def MergeFrom(self, other):
"""Appends the contents of another repeated field of the same type to this
one. We do not check the types of the individual fields.
"""
self._values.extend(other._values)
self._message_listener.Modified() | [
"Appends",
"the",
"contents",
"of",
"another",
"repeated",
"field",
"of",
"the",
"same",
"type",
"to",
"this",
"one",
".",
"We",
"do",
"not",
"check",
"the",
"types",
"of",
"the",
"individual",
"fields",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L280-L285 | [
"def",
"MergeFrom",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"_values",
".",
"extend",
"(",
"other",
".",
"_values",
")",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | RepeatedScalarFieldContainer.remove | Removes an item from the list. Similar to list.remove(). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py | def remove(self, elem):
"""Removes an item from the list. Similar to list.remove()."""
self._values.remove(elem)
self._message_listener.Modified() | def remove(self, elem):
"""Removes an item from the list. Similar to list.remove()."""
self._values.remove(elem)
self._message_listener.Modified() | [
"Removes",
"an",
"item",
"from",
"the",
"list",
".",
"Similar",
"to",
"list",
".",
"remove",
"()",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L287-L290 | [
"def",
"remove",
"(",
"self",
",",
"elem",
")",
":",
"self",
".",
"_values",
".",
"remove",
"(",
"elem",
")",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | RepeatedScalarFieldContainer.pop | Removes and returns an item at a given index. Similar to list.pop(). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py | def pop(self, key=-1):
"""Removes and returns an item at a given index. Similar to list.pop()."""
value = self._values[key]
self.__delitem__(key)
return value | def pop(self, key=-1):
"""Removes and returns an item at a given index. Similar to list.pop()."""
value = self._values[key]
self.__delitem__(key)
return value | [
"Removes",
"and",
"returns",
"an",
"item",
"at",
"a",
"given",
"index",
".",
"Similar",
"to",
"list",
".",
"pop",
"()",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L292-L296 | [
"def",
"pop",
"(",
"self",
",",
"key",
"=",
"-",
"1",
")",
":",
"value",
"=",
"self",
".",
"_values",
"[",
"key",
"]",
"self",
".",
"__delitem__",
"(",
"key",
")",
"return",
"value"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.