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 | SArray.date_range | Returns a new SArray that represents a fixed frequency datetime index.
Parameters
----------
start_time : datetime.datetime
Left bound for generating dates.
end_time : datetime.datetime
Right bound for generating dates.
freq : datetime.timedelta
F... | src/unity/python/turicreate/data_structures/sarray.py | def date_range(cls,start_time,end_time,freq):
'''
Returns a new SArray that represents a fixed frequency datetime index.
Parameters
----------
start_time : datetime.datetime
Left bound for generating dates.
end_time : datetime.datetime
Right bound fo... | def date_range(cls,start_time,end_time,freq):
'''
Returns a new SArray that represents a fixed frequency datetime index.
Parameters
----------
start_time : datetime.datetime
Left bound for generating dates.
end_time : datetime.datetime
Right bound fo... | [
"Returns",
"a",
"new",
"SArray",
"that",
"represents",
"a",
"fixed",
"frequency",
"datetime",
"index",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L431-L475 | [
"def",
"date_range",
"(",
"cls",
",",
"start_time",
",",
"end_time",
",",
"freq",
")",
":",
"if",
"not",
"isinstance",
"(",
"start_time",
",",
"datetime",
".",
"datetime",
")",
":",
"raise",
"TypeError",
"(",
"\"The ``start_time`` argument must be from type dateti... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.from_const | Constructs an SArray of size with a const value.
Parameters
----------
value : [int | float | str | array.array | list | dict | datetime]
The value to fill the SArray
size : int
The size of the SArray
dtype : type
The type of the SArray. If not spec... | src/unity/python/turicreate/data_structures/sarray.py | def from_const(cls, value, size, dtype=type(None)):
"""
Constructs an SArray of size with a const value.
Parameters
----------
value : [int | float | str | array.array | list | dict | datetime]
The value to fill the SArray
size : int
The size of the S... | def from_const(cls, value, size, dtype=type(None)):
"""
Constructs an SArray of size with a const value.
Parameters
----------
value : [int | float | str | array.array | list | dict | datetime]
The value to fill the SArray
size : int
The size of the S... | [
"Constructs",
"an",
"SArray",
"of",
"size",
"with",
"a",
"const",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L478-L508 | [
"def",
"from_const",
"(",
"cls",
",",
"value",
",",
"size",
",",
"dtype",
"=",
"type",
"(",
"None",
")",
")",
":",
"assert",
"isinstance",
"(",
"size",
",",
"(",
"int",
",",
"long",
")",
")",
"and",
"size",
">=",
"0",
",",
"\"size must be a positive ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.from_sequence | from_sequence(start=0, stop)
Create an SArray from sequence
.. sourcecode:: python
Construct an SArray of integer values from 0 to 999
>>> tc.SArray.from_sequence(1000)
This is equivalent, but more efficient than:
>>> tc.SArray(range(1000))
... | src/unity/python/turicreate/data_structures/sarray.py | def from_sequence(cls, *args):
"""
from_sequence(start=0, stop)
Create an SArray from sequence
.. sourcecode:: python
Construct an SArray of integer values from 0 to 999
>>> tc.SArray.from_sequence(1000)
This is equivalent, but more efficient than... | def from_sequence(cls, *args):
"""
from_sequence(start=0, stop)
Create an SArray from sequence
.. sourcecode:: python
Construct an SArray of integer values from 0 to 999
>>> tc.SArray.from_sequence(1000)
This is equivalent, but more efficient than... | [
"from_sequence",
"(",
"start",
"=",
"0",
"stop",
")"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L511-L563 | [
"def",
"from_sequence",
"(",
"cls",
",",
"*",
"args",
")",
":",
"start",
"=",
"None",
"stop",
"=",
"None",
"# fill with args. This checks for from_sequence(100), from_sequence(10,100)",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"stop",
"=",
"args",
"[",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.read_json | Construct an SArray from a json file or glob of json files.
The json file must contain a list of dictionaries. The returned
SArray type will be of dict type
Parameters
----------
filename : str
The filename or glob to load into an SArray.
Examples
----... | src/unity/python/turicreate/data_structures/sarray.py | def read_json(cls, filename):
"""
Construct an SArray from a json file or glob of json files.
The json file must contain a list of dictionaries. The returned
SArray type will be of dict type
Parameters
----------
filename : str
The filename or glob to l... | def read_json(cls, filename):
"""
Construct an SArray from a json file or glob of json files.
The json file must contain a list of dictionaries. The returned
SArray type will be of dict type
Parameters
----------
filename : str
The filename or glob to l... | [
"Construct",
"an",
"SArray",
"from",
"a",
"json",
"file",
"or",
"glob",
"of",
"json",
"files",
".",
"The",
"json",
"file",
"must",
"contain",
"a",
"list",
"of",
"dictionaries",
".",
"The",
"returned",
"SArray",
"type",
"will",
"be",
"of",
"dict",
"type"
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L566-L590 | [
"def",
"read_json",
"(",
"cls",
",",
"filename",
")",
":",
"proxy",
"=",
"UnitySArrayProxy",
"(",
")",
"proxy",
".",
"load_from_json_record_files",
"(",
"_make_internal_url",
"(",
"filename",
")",
")",
"return",
"cls",
"(",
"_proxy",
"=",
"proxy",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.where | Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a
value from istrue, otherwise from isfalse.
istrue : SArray... | src/unity/python/turicreate/data_structures/sarray.py | def where(cls, condition, istrue, isfalse, dtype=None):
"""
Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a... | def where(cls, condition, istrue, isfalse, dtype=None):
"""
Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a... | [
"Selects",
"elements",
"from",
"either",
"istrue",
"or",
"isfalse",
"depending",
"on",
"the",
"value",
"of",
"the",
"condition",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L593-L675 | [
"def",
"where",
"(",
"cls",
",",
"condition",
",",
"istrue",
",",
"isfalse",
",",
"dtype",
"=",
"None",
")",
":",
"true_is_sarray",
"=",
"isinstance",
"(",
"istrue",
",",
"SArray",
")",
"false_is_sarray",
"=",
"isinstance",
"(",
"isfalse",
",",
"SArray",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.save | Saves the SArray to file.
The saved SArray will be in a directory named with the `targetfile`
parameter.
Parameters
----------
filename : string
A local path or a remote URL. If format is 'text', it will be
saved as a text file. If format is 'binary', a... | src/unity/python/turicreate/data_structures/sarray.py | def save(self, filename, format=None):
"""
Saves the SArray to file.
The saved SArray will be in a directory named with the `targetfile`
parameter.
Parameters
----------
filename : string
A local path or a remote URL. If format is 'text', it will be... | def save(self, filename, format=None):
"""
Saves the SArray to file.
The saved SArray will be in a directory named with the `targetfile`
parameter.
Parameters
----------
filename : string
A local path or a remote URL. If format is 'text', it will be... | [
"Saves",
"the",
"SArray",
"to",
"file",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L705-L743 | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"format",
"=",
"None",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"format",
"is",
"None",
":",
"if",
"filename",
".",
"endswith",
"(",
"(",
"'.csv'",
",",
"'.csv.gz'",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.vector_slice | If this SArray contains vectors or lists, this returns a new SArray
containing each individual element sliced, between start and
end (exclusive).
Parameters
----------
start : int
The start position of the slice.
end : int, optional.
The end posi... | src/unity/python/turicreate/data_structures/sarray.py | def vector_slice(self, start, end=None):
"""
If this SArray contains vectors or lists, this returns a new SArray
containing each individual element sliced, between start and
end (exclusive).
Parameters
----------
start : int
The start position of the ... | def vector_slice(self, start, end=None):
"""
If this SArray contains vectors or lists, this returns a new SArray
containing each individual element sliced, between start and
end (exclusive).
Parameters
----------
start : int
The start position of the ... | [
"If",
"this",
"SArray",
"contains",
"vectors",
"or",
"lists",
"this",
"returns",
"a",
"new",
"SArray",
"containing",
"each",
"individual",
"element",
"sliced",
"between",
"start",
"and",
"end",
"(",
"exclusive",
")",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1370-L1451 | [
"def",
"vector_slice",
"(",
"self",
",",
"start",
",",
"end",
"=",
"None",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"array",
".",
"array",
")",
"and",
"(",
"self",
".",
"dtype",
"!=",
"list",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Only ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.element_slice | This returns an SArray with each element sliced accordingly to the
slice specified. This is conceptually equivalent to:
>>> g.apply(lambda x: x[start:step:stop])
The SArray must be of type list, vector, or string.
For instance:
>>> g = SArray(["abcdef","qwerty"])
>>> ... | src/unity/python/turicreate/data_structures/sarray.py | def element_slice(self, start=None, stop=None, step=None):
"""
This returns an SArray with each element sliced accordingly to the
slice specified. This is conceptually equivalent to:
>>> g.apply(lambda x: x[start:step:stop])
The SArray must be of type list, vector, or string.
... | def element_slice(self, start=None, stop=None, step=None):
"""
This returns an SArray with each element sliced accordingly to the
slice specified. This is conceptually equivalent to:
>>> g.apply(lambda x: x[start:step:stop])
The SArray must be of type list, vector, or string.
... | [
"This",
"returns",
"an",
"SArray",
"with",
"each",
"element",
"sliced",
"accordingly",
"to",
"the",
"slice",
"specified",
".",
"This",
"is",
"conceptually",
"equivalent",
"to",
":"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1453-L1504 | [
"def",
"element_slice",
"(",
"self",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"step",
"=",
"None",
")",
":",
"if",
"self",
".",
"dtype",
"not",
"in",
"[",
"str",
",",
"array",
".",
"array",
",",
"list",
"]",
":",
"raise",
"TypeEr... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray._count_words | This returns an SArray with, for each input string, a dict from the unique,
delimited substrings to their number of occurrences within the original
string.
The SArray must be of type string.
..WARNING:: This function is deprecated, and will be removed in future
versions of Turi... | src/unity/python/turicreate/data_structures/sarray.py | def _count_words(self, to_lower=True, delimiters=["\r", "\v", "\n", "\f", "\t", " "]):
"""
This returns an SArray with, for each input string, a dict from the unique,
delimited substrings to their number of occurrences within the original
string.
The SArray must be of type strin... | def _count_words(self, to_lower=True, delimiters=["\r", "\v", "\n", "\f", "\t", " "]):
"""
This returns an SArray with, for each input string, a dict from the unique,
delimited substrings to their number of occurrences within the original
string.
The SArray must be of type strin... | [
"This",
"returns",
"an",
"SArray",
"with",
"for",
"each",
"input",
"string",
"a",
"dict",
"from",
"the",
"unique",
"delimited",
"substrings",
"to",
"their",
"number",
"of",
"occurrences",
"within",
"the",
"original",
"string",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1506-L1558 | [
"def",
"_count_words",
"(",
"self",
",",
"to_lower",
"=",
"True",
",",
"delimiters",
"=",
"[",
"\"\\r\"",
",",
"\"\\v\"",
",",
"\"\\n\"",
",",
"\"\\f\"",
",",
"\"\\t\"",
",",
"\" \"",
"]",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"str",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray._count_ngrams | For documentation, see turicreate.text_analytics.count_ngrams().
..WARNING:: This function is deprecated, and will be removed in future
versions of Turi Create. Please use the `text_analytics.count_words`
function instead. | src/unity/python/turicreate/data_structures/sarray.py | def _count_ngrams(self, n=2, method="word", to_lower=True, ignore_space=True):
"""
For documentation, see turicreate.text_analytics.count_ngrams().
..WARNING:: This function is deprecated, and will be removed in future
versions of Turi Create. Please use the `text_analytics.count_words`... | def _count_ngrams(self, n=2, method="word", to_lower=True, ignore_space=True):
"""
For documentation, see turicreate.text_analytics.count_ngrams().
..WARNING:: This function is deprecated, and will be removed in future
versions of Turi Create. Please use the `text_analytics.count_words`... | [
"For",
"documentation",
"see",
"turicreate",
".",
"text_analytics",
".",
"count_ngrams",
"()",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1560-L1594 | [
"def",
"_count_ngrams",
"(",
"self",
",",
"n",
"=",
"2",
",",
"method",
"=",
"\"word\"",
",",
"to_lower",
"=",
"True",
",",
"ignore_space",
"=",
"True",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.dict_trim_by_keys | Filter an SArray of dictionary type by the given keys. By default, all
keys that are in the provided list in ``keys`` are *excluded* from the
returned SArray.
Parameters
----------
keys : list
A collection of keys to trim down the elements in the SArray.
exc... | src/unity/python/turicreate/data_structures/sarray.py | def dict_trim_by_keys(self, keys, exclude=True):
"""
Filter an SArray of dictionary type by the given keys. By default, all
keys that are in the provided list in ``keys`` are *excluded* from the
returned SArray.
Parameters
----------
keys : list
A col... | def dict_trim_by_keys(self, keys, exclude=True):
"""
Filter an SArray of dictionary type by the given keys. By default, all
keys that are in the provided list in ``keys`` are *excluded* from the
returned SArray.
Parameters
----------
keys : list
A col... | [
"Filter",
"an",
"SArray",
"of",
"dictionary",
"type",
"by",
"the",
"given",
"keys",
".",
"By",
"default",
"all",
"keys",
"that",
"are",
"in",
"the",
"provided",
"list",
"in",
"keys",
"are",
"*",
"excluded",
"*",
"from",
"the",
"returned",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1596-L1635 | [
"def",
"dict_trim_by_keys",
"(",
"self",
",",
"keys",
",",
"exclude",
"=",
"True",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"keys",
")",
":",
"keys",
"=",
"[",
"keys",
"]",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.dict_trim_by_values | Filter dictionary values to a given range (inclusive). Trimming is only
performed on values which can be compared to the bound values. Fails on
SArrays whose data type is not ``dict``.
Parameters
----------
lower : int or long or float, optional
The lowest dictionary... | src/unity/python/turicreate/data_structures/sarray.py | def dict_trim_by_values(self, lower=None, upper=None):
"""
Filter dictionary values to a given range (inclusive). Trimming is only
performed on values which can be compared to the bound values. Fails on
SArrays whose data type is not ``dict``.
Parameters
----------
... | def dict_trim_by_values(self, lower=None, upper=None):
"""
Filter dictionary values to a given range (inclusive). Trimming is only
performed on values which can be compared to the bound values. Fails on
SArrays whose data type is not ``dict``.
Parameters
----------
... | [
"Filter",
"dictionary",
"values",
"to",
"a",
"given",
"range",
"(",
"inclusive",
")",
".",
"Trimming",
"is",
"only",
"performed",
"on",
"values",
"which",
"can",
"be",
"compared",
"to",
"the",
"bound",
"values",
".",
"Fails",
"on",
"SArrays",
"whose",
"dat... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1637-L1686 | [
"def",
"dict_trim_by_values",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"not",
"(",
"lower",
"is",
"None",
"or",
"isinstance",
"(",
"lower",
",",
"numbers",
".",
"Number",
")",
")",
":",
"raise",
"TypeError",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.dict_has_any_keys | Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has any of the given keys.
Fails on SArrays whose data type is not ``dict``.
Parameters
----------
keys : li... | src/unity/python/turicreate/data_structures/sarray.py | def dict_has_any_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has any of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | def dict_has_any_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has any of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | [
"Create",
"a",
"boolean",
"SArray",
"by",
"checking",
"the",
"keys",
"of",
"an",
"SArray",
"of",
"dictionaries",
".",
"An",
"element",
"of",
"the",
"output",
"SArray",
"is",
"True",
"if",
"the",
"corresponding",
"input",
"element",
"s",
"dictionary",
"has",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1745-L1781 | [
"def",
"dict_has_any_keys",
"(",
"self",
",",
"keys",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"keys",
")",
":",
"keys",
"=",
"[",
"keys",
"]",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.dict_has_all_keys | Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has all of the given keys.
Fails on SArrays whose data type is not ``dict``.
Parameters
----------
keys : li... | src/unity/python/turicreate/data_structures/sarray.py | def dict_has_all_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has all of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | def dict_has_all_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has all of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | [
"Create",
"a",
"boolean",
"SArray",
"by",
"checking",
"the",
"keys",
"of",
"an",
"SArray",
"of",
"dictionaries",
".",
"An",
"element",
"of",
"the",
"output",
"SArray",
"is",
"True",
"if",
"the",
"corresponding",
"input",
"element",
"s",
"dictionary",
"has",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1783-L1819 | [
"def",
"dict_has_all_keys",
"(",
"self",
",",
"keys",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"keys",
")",
":",
"keys",
"=",
"[",
"keys",
"]",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.apply | apply(fn, dtype=None, skip_na=True, seed=None)
Transform each element of the SArray by a given function. The result
SArray is of type ``dtype``. ``fn`` should be a function that returns
exactly one value which can be cast into the type specified by
``dtype``. If ``dtype`` is not specifi... | src/unity/python/turicreate/data_structures/sarray.py | def apply(self, fn, dtype=None, skip_na=True, seed=None):
"""
apply(fn, dtype=None, skip_na=True, seed=None)
Transform each element of the SArray by a given function. The result
SArray is of type ``dtype``. ``fn`` should be a function that returns
exactly one value which can be ... | def apply(self, fn, dtype=None, skip_na=True, seed=None):
"""
apply(fn, dtype=None, skip_na=True, seed=None)
Transform each element of the SArray by a given function. The result
SArray is of type ``dtype``. ``fn`` should be a function that returns
exactly one value which can be ... | [
"apply",
"(",
"fn",
"dtype",
"=",
"None",
"skip_na",
"=",
"True",
"seed",
"=",
"None",
")"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1821-L1920 | [
"def",
"apply",
"(",
"self",
",",
"fn",
",",
"dtype",
"=",
"None",
",",
"skip_na",
"=",
"True",
",",
"seed",
"=",
"None",
")",
":",
"assert",
"callable",
"(",
"fn",
")",
",",
"\"Input function must be callable.\"",
"dryrun",
"=",
"[",
"fn",
"(",
"i",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.filter | Filter this SArray by a function.
Returns a new SArray filtered by this SArray. If `fn` evaluates an
element to true, this element is copied to the new SArray. If not, it
isn't. Throws an exception if the return type of `fn` is not castable
to a boolean value.
Parameters
... | src/unity/python/turicreate/data_structures/sarray.py | def filter(self, fn, skip_na=True, seed=None):
"""
Filter this SArray by a function.
Returns a new SArray filtered by this SArray. If `fn` evaluates an
element to true, this element is copied to the new SArray. If not, it
isn't. Throws an exception if the return type of `fn` is... | def filter(self, fn, skip_na=True, seed=None):
"""
Filter this SArray by a function.
Returns a new SArray filtered by this SArray. If `fn` evaluates an
element to true, this element is copied to the new SArray. If not, it
isn't. Throws an exception if the return type of `fn` is... | [
"Filter",
"this",
"SArray",
"by",
"a",
"function",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1923-L1963 | [
"def",
"filter",
"(",
"self",
",",
"fn",
",",
"skip_na",
"=",
"True",
",",
"seed",
"=",
"None",
")",
":",
"assert",
"callable",
"(",
"fn",
")",
",",
"\"Input must be callable\"",
"if",
"seed",
"is",
"None",
":",
"seed",
"=",
"abs",
"(",
"hash",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.sample | Create an SArray which contains a subsample of the current SArray.
Parameters
----------
fraction : float
Fraction of the rows to fetch. Must be between 0 and 1.
if exact is False (default), the number of rows returned is
approximately the fraction times the ... | src/unity/python/turicreate/data_structures/sarray.py | def sample(self, fraction, seed=None, exact=False):
"""
Create an SArray which contains a subsample of the current SArray.
Parameters
----------
fraction : float
Fraction of the rows to fetch. Must be between 0 and 1.
if exact is False (default), the numb... | def sample(self, fraction, seed=None, exact=False):
"""
Create an SArray which contains a subsample of the current SArray.
Parameters
----------
fraction : float
Fraction of the rows to fetch. Must be between 0 and 1.
if exact is False (default), the numb... | [
"Create",
"an",
"SArray",
"which",
"contains",
"a",
"subsample",
"of",
"the",
"current",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1966-L2006 | [
"def",
"sample",
"(",
"self",
",",
"fraction",
",",
"seed",
"=",
"None",
",",
"exact",
"=",
"False",
")",
":",
"if",
"(",
"fraction",
">",
"1",
"or",
"fraction",
"<",
"0",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid sampling rate: '",
"+",
"str",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.hash | Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to different values to get
different h... | src/unity/python/turicreate/data_structures/sarray.py | def hash(self, seed=0):
"""
Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to dif... | def hash(self, seed=0):
"""
Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to dif... | [
"Returns",
"an",
"SArray",
"with",
"a",
"hash",
"of",
"each",
"element",
".",
"seed",
"can",
"be",
"used",
"to",
"change",
"the",
"hash",
"function",
"to",
"allow",
"this",
"method",
"to",
"be",
"used",
"for",
"random",
"number",
"generation",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2008-L2027 | [
"def",
"hash",
"(",
"self",
",",
"seed",
"=",
"0",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"hash",
"(",
"seed",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.random_integers | Returns an SArray with random integer values. | src/unity/python/turicreate/data_structures/sarray.py | def random_integers(cls, size, seed=None):
"""
Returns an SArray with random integer values.
"""
if seed is None:
seed = abs(hash("%0.20f" % time.time())) % (2 ** 31)
return cls.from_sequence(size).hash(seed) | def random_integers(cls, size, seed=None):
"""
Returns an SArray with random integer values.
"""
if seed is None:
seed = abs(hash("%0.20f" % time.time())) % (2 ** 31)
return cls.from_sequence(size).hash(seed) | [
"Returns",
"an",
"SArray",
"with",
"random",
"integer",
"values",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2030-L2036 | [
"def",
"random_integers",
"(",
"cls",
",",
"size",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"None",
":",
"seed",
"=",
"abs",
"(",
"hash",
"(",
"\"%0.20f\"",
"%",
"time",
".",
"time",
"(",
")",
")",
")",
"%",
"(",
"2",
"**",
"31",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.argmin | Get the index of the minimum numeric value in SArray.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type.
Returns
-------
out : int
index of the minimum value of SArray
See Also
--------
argmax
... | src/unity/python/turicreate/data_structures/sarray.py | def argmin(self):
"""
Get the index of the minimum numeric value in SArray.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type.
Returns
-------
out : int
index of the minimum value of SArray
See... | def argmin(self):
"""
Get the index of the minimum numeric value in SArray.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type.
Returns
-------
out : int
index of the minimum value of SArray
See... | [
"Get",
"the",
"index",
"of",
"the",
"minimum",
"numeric",
"value",
"in",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2201-L2231 | [
"def",
"argmin",
"(",
"self",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"len",
"(",
"self",
")",
"==",
"0",
":",
"return",
"None",
"if",
"not",
"any",
"(",
"[",
"isinstance",
"(",
"self",
"[",
"0",
"]",
",",
"i",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.mean | Mean of all the values in the SArray, or mean image.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type or non-Image type.
Returns
-------
out : float | turicreate.Image
Mean of all values in SArray, or image holding pe... | src/unity/python/turicreate/data_structures/sarray.py | def mean(self):
"""
Mean of all the values in the SArray, or mean image.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type or non-Image type.
Returns
-------
out : float | turicreate.Image
Mean of all v... | def mean(self):
"""
Mean of all the values in the SArray, or mean image.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type or non-Image type.
Returns
-------
out : float | turicreate.Image
Mean of all v... | [
"Mean",
"of",
"all",
"the",
"values",
"in",
"the",
"SArray",
"or",
"mean",
"image",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2252-L2270 | [
"def",
"mean",
"(",
"self",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"if",
"self",
".",
"dtype",
"==",
"_Image",
":",
"from",
".",
".",
"import",
"extensions",
"return",
"extensions",
".",
"generate_mean",
"(",
"self",
")",
"else",
":",
"retu... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.datetime_to_str | Create a new SArray with all the values cast to str. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The format to output the string. Default format is "%Y-%m-%dT%H:%M:%S%ZP".
Returns
-------
out : SArray[... | src/unity/python/turicreate/data_structures/sarray.py | def datetime_to_str(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to str. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The format to output the string. Default format is "... | def datetime_to_str(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to str. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The format to output the string. Default format is "... | [
"Create",
"a",
"new",
"SArray",
"with",
"all",
"the",
"values",
"cast",
"to",
"str",
".",
"The",
"string",
"format",
"is",
"specified",
"by",
"the",
"format",
"parameter",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2338-L2375 | [
"def",
"datetime_to_str",
"(",
"self",
",",
"format",
"=",
"\"%Y-%m-%dT%H:%M:%S%ZP\"",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"datetime",
".",
"datetime",
")",
":",
"raise",
"TypeError",
"(",
"\"datetime_to_str expects SArray of datetime as input SArray\"",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.str_to_datetime | Create a new SArray with all the values cast to datetime. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The string format of the input SArray. Default format is "%Y-%m-%dT%H:%M:%S%ZP".
If format is "ISO", the the for... | src/unity/python/turicreate/data_structures/sarray.py | def str_to_datetime(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to datetime. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The string format of the input SArray. Default ... | def str_to_datetime(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to datetime. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The string format of the input SArray. Default ... | [
"Create",
"a",
"new",
"SArray",
"with",
"all",
"the",
"values",
"cast",
"to",
"datetime",
".",
"The",
"string",
"format",
"is",
"specified",
"by",
"the",
"format",
"parameter",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2377-L2413 | [
"def",
"str_to_datetime",
"(",
"self",
",",
"format",
"=",
"\"%Y-%m-%dT%H:%M:%S%ZP\"",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"str_to_datetime expects SArray of str as input SArray\"",
")",
"with",
"cython_cont... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.pixel_array_to_image | Create a new SArray with all the values cast to :py:class:`turicreate.image.Image`
of uniform size.
Parameters
----------
width: int
The width of the new images.
height: int
The height of the new images.
channels: int.
Number of chan... | src/unity/python/turicreate/data_structures/sarray.py | def pixel_array_to_image(self, width, height, channels, undefined_on_failure=True, allow_rounding=False):
"""
Create a new SArray with all the values cast to :py:class:`turicreate.image.Image`
of uniform size.
Parameters
----------
width: int
The width of the... | def pixel_array_to_image(self, width, height, channels, undefined_on_failure=True, allow_rounding=False):
"""
Create a new SArray with all the values cast to :py:class:`turicreate.image.Image`
of uniform size.
Parameters
----------
width: int
The width of the... | [
"Create",
"a",
"new",
"SArray",
"with",
"all",
"the",
"values",
"cast",
"to",
":",
"py",
":",
"class",
":",
"turicreate",
".",
"image",
".",
"Image",
"of",
"uniform",
"size",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2415-L2478 | [
"def",
"pixel_array_to_image",
"(",
"self",
",",
"width",
",",
"height",
",",
"channels",
",",
"undefined_on_failure",
"=",
"True",
",",
"allow_rounding",
"=",
"False",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"array",
".",
"array",
")",
":",
"ra... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.astype | Create a new SArray with all values cast to the given type. Throws an
exception if the types are not castable to the given type.
Parameters
----------
dtype : {int, float, str, list, array.array, dict, datetime.datetime}
The type to cast the elements to in SArray
un... | src/unity/python/turicreate/data_structures/sarray.py | def astype(self, dtype, undefined_on_failure=False):
"""
Create a new SArray with all values cast to the given type. Throws an
exception if the types are not castable to the given type.
Parameters
----------
dtype : {int, float, str, list, array.array, dict, datetime.dat... | def astype(self, dtype, undefined_on_failure=False):
"""
Create a new SArray with all values cast to the given type. Throws an
exception if the types are not castable to the given type.
Parameters
----------
dtype : {int, float, str, list, array.array, dict, datetime.dat... | [
"Create",
"a",
"new",
"SArray",
"with",
"all",
"values",
"cast",
"to",
"the",
"given",
"type",
".",
"Throws",
"an",
"exception",
"if",
"the",
"types",
"are",
"not",
"castable",
"to",
"the",
"given",
"type",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2480-L2531 | [
"def",
"astype",
"(",
"self",
",",
"dtype",
",",
"undefined_on_failure",
"=",
"False",
")",
":",
"if",
"(",
"dtype",
"==",
"_Image",
")",
"and",
"(",
"self",
".",
"dtype",
"==",
"array",
".",
"array",
")",
":",
"raise",
"TypeError",
"(",
"\"Cannot cast... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.clip | Create a new SArray with each value clipped to be within the given
bounds.
In this case, "clipped" means that values below the lower bound will be
set to the lower bound value. Values above the upper bound will be set
to the upper bound value. This function can operate on SArrays of
... | src/unity/python/turicreate/data_structures/sarray.py | def clip(self, lower=float('nan'), upper=float('nan')):
"""
Create a new SArray with each value clipped to be within the given
bounds.
In this case, "clipped" means that values below the lower bound will be
set to the lower bound value. Values above the upper bound will be set
... | def clip(self, lower=float('nan'), upper=float('nan')):
"""
Create a new SArray with each value clipped to be within the given
bounds.
In this case, "clipped" means that values below the lower bound will be
set to the lower bound value. Values above the upper bound will be set
... | [
"Create",
"a",
"new",
"SArray",
"with",
"each",
"value",
"clipped",
"to",
"be",
"within",
"the",
"given",
"bounds",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2533-L2573 | [
"def",
"clip",
"(",
"self",
",",
"lower",
"=",
"float",
"(",
"'nan'",
")",
",",
"upper",
"=",
"float",
"(",
"'nan'",
")",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"cli... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.clip_lower | Create new SArray with all values clipped to the given lower bound. This
function can operate on numeric arrays, as well as vector arrays, in
which case each individual element in each vector is clipped. Throws an
exception if the SArray is empty or the types are non-numeric.
Parameters... | src/unity/python/turicreate/data_structures/sarray.py | def clip_lower(self, threshold):
"""
Create new SArray with all values clipped to the given lower bound. This
function can operate on numeric arrays, as well as vector arrays, in
which case each individual element in each vector is clipped. Throws an
exception if the SArray is em... | def clip_lower(self, threshold):
"""
Create new SArray with all values clipped to the given lower bound. This
function can operate on numeric arrays, as well as vector arrays, in
which case each individual element in each vector is clipped. Throws an
exception if the SArray is em... | [
"Create",
"new",
"SArray",
"with",
"all",
"values",
"clipped",
"to",
"the",
"given",
"lower",
"bound",
".",
"This",
"function",
"can",
"operate",
"on",
"numeric",
"arrays",
"as",
"well",
"as",
"vector",
"arrays",
"in",
"which",
"case",
"each",
"individual",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2575-L2604 | [
"def",
"clip_lower",
"(",
"self",
",",
"threshold",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"clip",
"(",
"threshold",
",",
"float",
"(",
"'nan'",
")",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.tail | Get an SArray that contains the last n elements in the SArray.
Parameters
----------
n : int
The number of elements to fetch
Returns
-------
out : SArray
A new SArray which contains the last n rows of the current SArray. | src/unity/python/turicreate/data_structures/sarray.py | def tail(self, n=10):
"""
Get an SArray that contains the last n elements in the SArray.
Parameters
----------
n : int
The number of elements to fetch
Returns
-------
out : SArray
A new SArray which contains the last n rows of the... | def tail(self, n=10):
"""
Get an SArray that contains the last n elements in the SArray.
Parameters
----------
n : int
The number of elements to fetch
Returns
-------
out : SArray
A new SArray which contains the last n rows of the... | [
"Get",
"an",
"SArray",
"that",
"contains",
"the",
"last",
"n",
"elements",
"in",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2637-L2652 | [
"def",
"tail",
"(",
"self",
",",
"n",
"=",
"10",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"tail",
"(",
"n",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.fillna | Create new SArray with all missing values (None or NaN) filled in
with the given value.
The size of the new SArray will be the same as the original SArray. If
the given value is not the same type as the values in the SArray,
`fillna` will attempt to convert the value to the original SAr... | src/unity/python/turicreate/data_structures/sarray.py | def fillna(self, value):
"""
Create new SArray with all missing values (None or NaN) filled in
with the given value.
The size of the new SArray will be the same as the original SArray. If
the given value is not the same type as the values in the SArray,
`fillna` will att... | def fillna(self, value):
"""
Create new SArray with all missing values (None or NaN) filled in
with the given value.
The size of the new SArray will be the same as the original SArray. If
the given value is not the same type as the values in the SArray,
`fillna` will att... | [
"Create",
"new",
"SArray",
"with",
"all",
"missing",
"values",
"(",
"None",
"or",
"NaN",
")",
"filled",
"in",
"with",
"the",
"given",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2673-L2695 | [
"def",
"fillna",
"(",
"self",
",",
"value",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"fill_missing_values",
"(",
"value",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.is_topk | Create an SArray indicating which elements are in the top k.
Entries are '1' if the corresponding element in the current SArray is a
part of the top k elements, and '0' if that corresponding element is
not. Order is descending by default.
Parameters
----------
topk : in... | src/unity/python/turicreate/data_structures/sarray.py | def is_topk(self, topk=10, reverse=False):
"""
Create an SArray indicating which elements are in the top k.
Entries are '1' if the corresponding element in the current SArray is a
part of the top k elements, and '0' if that corresponding element is
not. Order is descending by de... | def is_topk(self, topk=10, reverse=False):
"""
Create an SArray indicating which elements are in the top k.
Entries are '1' if the corresponding element in the current SArray is a
part of the top k elements, and '0' if that corresponding element is
not. Order is descending by de... | [
"Create",
"an",
"SArray",
"indicating",
"which",
"elements",
"are",
"in",
"the",
"top",
"k",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2697-L2722 | [
"def",
"is_topk",
"(",
"self",
",",
"topk",
"=",
"10",
",",
"reverse",
"=",
"False",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"topk_index",
"(",
"topk",
",",
"reverse",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.summary | Summary statistics that can be calculated with one pass over the SArray.
Returns a turicreate.Sketch object which can be further queried for many
descriptive statistics over this SArray. Many of the statistics are
approximate. See the :class:`~turicreate.Sketch` documentation for more
d... | src/unity/python/turicreate/data_structures/sarray.py | def summary(self, background=False, sub_sketch_keys=None):
"""
Summary statistics that can be calculated with one pass over the SArray.
Returns a turicreate.Sketch object which can be further queried for many
descriptive statistics over this SArray. Many of the statistics are
ap... | def summary(self, background=False, sub_sketch_keys=None):
"""
Summary statistics that can be calculated with one pass over the SArray.
Returns a turicreate.Sketch object which can be further queried for many
descriptive statistics over this SArray. Many of the statistics are
ap... | [
"Summary",
"statistics",
"that",
"can",
"be",
"calculated",
"with",
"one",
"pass",
"over",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2724-L2775 | [
"def",
"summary",
"(",
"self",
",",
"background",
"=",
"False",
",",
"sub_sketch_keys",
"=",
"None",
")",
":",
"from",
".",
".",
"data_structures",
".",
"sketch",
"import",
"Sketch",
"if",
"(",
"self",
".",
"dtype",
"==",
"_Image",
")",
":",
"raise",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.value_counts | Return an SFrame containing counts of unique values. The resulting
SFrame will be sorted in descending frequency.
Returns
-------
out : SFrame
An SFrame containing 2 columns : 'value', and 'count'. The SFrame will
be sorted in descending order by the column 'coun... | src/unity/python/turicreate/data_structures/sarray.py | def value_counts(self):
"""
Return an SFrame containing counts of unique values. The resulting
SFrame will be sorted in descending frequency.
Returns
-------
out : SFrame
An SFrame containing 2 columns : 'value', and 'count'. The SFrame will
be so... | def value_counts(self):
"""
Return an SFrame containing counts of unique values. The resulting
SFrame will be sorted in descending frequency.
Returns
-------
out : SFrame
An SFrame containing 2 columns : 'value', and 'count'. The SFrame will
be so... | [
"Return",
"an",
"SFrame",
"containing",
"counts",
"of",
"unique",
"values",
".",
"The",
"resulting",
"SFrame",
"will",
"be",
"sorted",
"in",
"descending",
"frequency",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2777-L2811 | [
"def",
"value_counts",
"(",
"self",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"return",
"_SFrame",
"(",
"{",
"'value'",
":",
"self",
"}",
")",
".",
"groupby",
"(",
"'value'",
",",
"{",
"'count'",
":",
"_aggregate",
".",
"COU... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.append | Append an SArray to the current SArray. Creates a new SArray with the
rows from both SArrays. Both SArrays must be of the same type.
Parameters
----------
other : SArray
Another SArray whose rows are appended to current SArray.
Returns
-------
out : ... | src/unity/python/turicreate/data_structures/sarray.py | def append(self, other):
"""
Append an SArray to the current SArray. Creates a new SArray with the
rows from both SArrays. Both SArrays must be of the same type.
Parameters
----------
other : SArray
Another SArray whose rows are appended to current SArray.
... | def append(self, other):
"""
Append an SArray to the current SArray. Creates a new SArray with the
rows from both SArrays. Both SArrays must be of the same type.
Parameters
----------
other : SArray
Another SArray whose rows are appended to current SArray.
... | [
"Append",
"an",
"SArray",
"to",
"the",
"current",
"SArray",
".",
"Creates",
"a",
"new",
"SArray",
"with",
"the",
"rows",
"from",
"both",
"SArrays",
".",
"Both",
"SArrays",
"must",
"be",
"of",
"the",
"same",
"type",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2814-L2850 | [
"def",
"append",
"(",
"self",
",",
"other",
")",
":",
"if",
"type",
"(",
"other",
")",
"is",
"not",
"SArray",
":",
"raise",
"RuntimeError",
"(",
"\"SArray append can only work with SArray\"",
")",
"if",
"self",
".",
"dtype",
"!=",
"other",
".",
"dtype",
":... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.unique | Get all unique values in the current SArray.
Raises a TypeError if the SArray is of dictionary type. Will not
necessarily preserve the order of the given SArray in the new SArray.
Returns
-------
out : SArray
A new SArray that contains the unique values of the curr... | src/unity/python/turicreate/data_structures/sarray.py | def unique(self):
"""
Get all unique values in the current SArray.
Raises a TypeError if the SArray is of dictionary type. Will not
necessarily preserve the order of the given SArray in the new SArray.
Returns
-------
out : SArray
A new SArray that ... | def unique(self):
"""
Get all unique values in the current SArray.
Raises a TypeError if the SArray is of dictionary type. Will not
necessarily preserve the order of the given SArray in the new SArray.
Returns
-------
out : SArray
A new SArray that ... | [
"Get",
"all",
"unique",
"values",
"in",
"the",
"current",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2852-L2876 | [
"def",
"unique",
"(",
"self",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"tmp_sf",
"=",
"_SFrame",
"(",
")",
"tmp_sf",
".",
"add_column",
"(",
"self",
",",
"'X1'",
",",
"inplace",
"=",
"True",
")",
"res",
"=",
"tmp_sf",
"."... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.show | Visualize the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visualization.set_target` (defaults to 'auto').
Parameters
----------
title : str
... | src/unity/python/turicreate/data_structures/sarray.py | def show(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Visualize the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visual... | def show(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Visualize the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visual... | [
"Visualize",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2905-L2946 | [
"def",
"show",
"(",
"self",
",",
"title",
"=",
"LABEL_DEFAULT",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
")",
":",
"returned_plot",
"=",
"self",
".",
"plot",
"(",
"title",
",",
"xlabel",
",",
"ylabel",
")",
"returned_plot",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.plot | Create a Plot object representing the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visualization.set_target` (defaults to 'auto').
Parameters
-------... | src/unity/python/turicreate/data_structures/sarray.py | def plot(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Create a Plot object representing the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
... | def plot(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Create a Plot object representing the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
... | [
"Create",
"a",
"Plot",
"object",
"representing",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2948-L3006 | [
"def",
"plot",
"(",
"self",
",",
"title",
"=",
"LABEL_DEFAULT",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"title",
"==",
"\"\"",
":",
"title",
"=",
"\" \"",
"if",
"xlabel",
"==",
"\"\"",
":",
"xlabel",
"=... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.item_length | Length of each element in the current SArray.
Only works on SArrays of dict, array, or list type. If a given element
is a missing value, then the output elements is also a missing value.
This function is equivalent to the following but more performant:
sa_item_len = sa.apply(lambd... | src/unity/python/turicreate/data_structures/sarray.py | def item_length(self):
"""
Length of each element in the current SArray.
Only works on SArrays of dict, array, or list type. If a given element
is a missing value, then the output elements is also a missing value.
This function is equivalent to the following but more performant:... | def item_length(self):
"""
Length of each element in the current SArray.
Only works on SArrays of dict, array, or list type. If a given element
is a missing value, then the output elements is also a missing value.
This function is equivalent to the following but more performant:... | [
"Length",
"of",
"each",
"element",
"in",
"the",
"current",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3008-L3043 | [
"def",
"item_length",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"not",
"in",
"[",
"list",
",",
"dict",
",",
"array",
".",
"array",
"]",
")",
":",
"raise",
"TypeError",
"(",
"\"item_length() is only applicable for SArray of type list, dict and array... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.random_split | Randomly split the rows of an SArray into two SArrays. The first SArray
contains *M* rows, sampled uniformly (without replacement) from the
original SArray. *M* is approximately the fraction times the original
number of rows. The second SArray contains the remaining rows of the
original ... | src/unity/python/turicreate/data_structures/sarray.py | def random_split(self, fraction, seed=None):
"""
Randomly split the rows of an SArray into two SArrays. The first SArray
contains *M* rows, sampled uniformly (without replacement) from the
original SArray. *M* is approximately the fraction times the original
number of rows. The s... | def random_split(self, fraction, seed=None):
"""
Randomly split the rows of an SArray into two SArrays. The first SArray
contains *M* rows, sampled uniformly (without replacement) from the
original SArray. *M* is approximately the fraction times the original
number of rows. The s... | [
"Randomly",
"split",
"the",
"rows",
"of",
"an",
"SArray",
"into",
"two",
"SArrays",
".",
"The",
"first",
"SArray",
"contains",
"*",
"M",
"*",
"rows",
"sampled",
"uniformly",
"(",
"without",
"replacement",
")",
"from",
"the",
"original",
"SArray",
".",
"*",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3045-L3081 | [
"def",
"random_split",
"(",
"self",
",",
"fraction",
",",
"seed",
"=",
"None",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"temporary_sf",
"=",
"SFrame",
"(",
")",
"temporary_sf",
"[",
"'X1'",
"]",
"=",
"self",
"(",
"train",
",",
"test",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.split_datetime | Splits an SArray of datetime type to multiple columns, return a
new SFrame that contains expanded columns. A SArray of datetime will be
split by default into an SFrame of 6 columns, one for each
year/month/day/hour/minute/second element.
**Column Naming**
When splitting a SArra... | src/unity/python/turicreate/data_structures/sarray.py | def split_datetime(self, column_name_prefix = "X", limit=None, timezone=False):
"""
Splits an SArray of datetime type to multiple columns, return a
new SFrame that contains expanded columns. A SArray of datetime will be
split by default into an SFrame of 6 columns, one for each
y... | def split_datetime(self, column_name_prefix = "X", limit=None, timezone=False):
"""
Splits an SArray of datetime type to multiple columns, return a
new SFrame that contains expanded columns. A SArray of datetime will be
split by default into an SFrame of 6 columns, one for each
y... | [
"Splits",
"an",
"SArray",
"of",
"datetime",
"type",
"to",
"multiple",
"columns",
"return",
"a",
"new",
"SFrame",
"that",
"contains",
"expanded",
"columns",
".",
"A",
"SArray",
"of",
"datetime",
"will",
"be",
"split",
"by",
"default",
"into",
"an",
"SFrame",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3083-L3217 | [
"def",
"split_datetime",
"(",
"self",
",",
"column_name_prefix",
"=",
"\"X\"",
",",
"limit",
"=",
"None",
",",
"timezone",
"=",
"False",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"self",
".",
"dtype",
"!=",
"datetime",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.stack | Convert a "wide" SArray to one or two "tall" columns in an SFrame by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two new columns are created as a result of
stacking: one column holds the key and another column holds th... | src/unity/python/turicreate/data_structures/sarray.py | def stack(self, new_column_name=None, drop_na=False, new_column_type=None):
"""
Convert a "wide" SArray to one or two "tall" columns in an SFrame by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two new columns a... | def stack(self, new_column_name=None, drop_na=False, new_column_type=None):
"""
Convert a "wide" SArray to one or two "tall" columns in an SFrame by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two new columns a... | [
"Convert",
"a",
"wide",
"SArray",
"to",
"one",
"or",
"two",
"tall",
"columns",
"in",
"an",
"SFrame",
"by",
"stacking",
"all",
"values",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3219-L3294 | [
"def",
"stack",
"(",
"self",
",",
"new_column_name",
"=",
"None",
",",
"drop_na",
"=",
"False",
",",
"new_column_type",
"=",
"None",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"return",
"_SFrame",
"(",
"{",
"'SArray'",
":",
"se... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.unpack | Convert an SArray of list, array, or dict type to an SFrame with
multiple columns.
`unpack` expands an SArray using the values of each list/array/dict as
elements in a new SFrame of multiple columns. For example, an SArray of
lists each of length 4 will be expanded into an SFrame of 4 c... | src/unity/python/turicreate/data_structures/sarray.py | def unpack(self, column_name_prefix = "X", column_types=None, na_value=None, limit=None):
"""
Convert an SArray of list, array, or dict type to an SFrame with
multiple columns.
`unpack` expands an SArray using the values of each list/array/dict as
elements in a new SFrame of mul... | def unpack(self, column_name_prefix = "X", column_types=None, na_value=None, limit=None):
"""
Convert an SArray of list, array, or dict type to an SFrame with
multiple columns.
`unpack` expands an SArray using the values of each list/array/dict as
elements in a new SFrame of mul... | [
"Convert",
"an",
"SArray",
"of",
"list",
"array",
"or",
"dict",
"type",
"to",
"an",
"SFrame",
"with",
"multiple",
"columns",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3296-L3493 | [
"def",
"unpack",
"(",
"self",
",",
"column_name_prefix",
"=",
"\"X\"",
",",
"column_types",
"=",
"None",
",",
"na_value",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"self",
".",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.sort | Sort all values in this SArray.
Sort only works for sarray of type str, int and float, otherwise TypeError
will be raised. Creates a new, sorted SArray.
Parameters
----------
ascending: boolean, optional
If true, the sarray values are sorted in ascending order, other... | src/unity/python/turicreate/data_structures/sarray.py | def sort(self, ascending=True):
"""
Sort all values in this SArray.
Sort only works for sarray of type str, int and float, otherwise TypeError
will be raised. Creates a new, sorted SArray.
Parameters
----------
ascending: boolean, optional
If true, th... | def sort(self, ascending=True):
"""
Sort all values in this SArray.
Sort only works for sarray of type str, int and float, otherwise TypeError
will be raised. Creates a new, sorted SArray.
Parameters
----------
ascending: boolean, optional
If true, th... | [
"Sort",
"all",
"values",
"in",
"this",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3495-L3526 | [
"def",
"sort",
"(",
"self",
",",
"ascending",
"=",
"True",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"self",
".",
"dtype",
"not",
"in",
"(",
"int",
",",
"float",
",",
"str",
",",
"datetime",
".",
"datetime",
")",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.rolling_sum | Calculate a new SArray of the sum of different subsets over this
SArray.
Also known as a "moving sum" or "running sum". The subset that
the sum is calculated over is defined as an inclusive range relative
to the position to each value in the SArray, using `window_start` and
`win... | src/unity/python/turicreate/data_structures/sarray.py | def rolling_sum(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the sum of different subsets over this
SArray.
Also known as a "moving sum" or "running sum". The subset that
the sum is calculated over is defined as an inclusive range relativ... | def rolling_sum(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the sum of different subsets over this
SArray.
Also known as a "moving sum" or "running sum". The subset that
the sum is calculated over is defined as an inclusive range relativ... | [
"Calculate",
"a",
"new",
"SArray",
"of",
"the",
"sum",
"of",
"different",
"subsets",
"over",
"this",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3640-L3743 | [
"def",
"rolling_sum",
"(",
"self",
",",
"window_start",
",",
"window_end",
",",
"min_observations",
"=",
"None",
")",
":",
"min_observations",
"=",
"self",
".",
"__check_min_observations",
"(",
"min_observations",
")",
"agg_op",
"=",
"None",
"if",
"self",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.rolling_max | Calculate a new SArray of the maximum value of different subsets over
this SArray.
The subset that the maximum is calculated over is defined as an
inclusive range relative to the position to each value in the SArray,
using `window_start` and `window_end`. For a better understanding of
... | src/unity/python/turicreate/data_structures/sarray.py | def rolling_max(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the maximum value of different subsets over
this SArray.
The subset that the maximum is calculated over is defined as an
inclusive range relative to the position to each value i... | def rolling_max(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the maximum value of different subsets over
this SArray.
The subset that the maximum is calculated over is defined as an
inclusive range relative to the position to each value i... | [
"Calculate",
"a",
"new",
"SArray",
"of",
"the",
"maximum",
"value",
"of",
"different",
"subsets",
"over",
"this",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3745-L3843 | [
"def",
"rolling_max",
"(",
"self",
",",
"window_start",
",",
"window_end",
",",
"min_observations",
"=",
"None",
")",
":",
"min_observations",
"=",
"self",
".",
"__check_min_observations",
"(",
"min_observations",
")",
"agg_op",
"=",
"'__builtin__max__'",
"return",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.rolling_count | Count the number of non-NULL values of different subsets over this
SArray.
The subset that the count is executed on is defined as an inclusive
range relative to the position to each value in the SArray, using
`window_start` and `window_end`. For a better understanding of this,
s... | src/unity/python/turicreate/data_structures/sarray.py | def rolling_count(self, window_start, window_end):
"""
Count the number of non-NULL values of different subsets over this
SArray.
The subset that the count is executed on is defined as an inclusive
range relative to the position to each value in the SArray, using
`window... | def rolling_count(self, window_start, window_end):
"""
Count the number of non-NULL values of different subsets over this
SArray.
The subset that the count is executed on is defined as an inclusive
range relative to the position to each value in the SArray, using
`window... | [
"Count",
"the",
"number",
"of",
"non",
"-",
"NULL",
"values",
"of",
"different",
"subsets",
"over",
"this",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4146-L4221 | [
"def",
"rolling_count",
"(",
"self",
",",
"window_start",
",",
"window_end",
")",
":",
"agg_op",
"=",
"'__builtin__nonnull__count__'",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_rolling_apply",
"(",
"agg_op",
",",
"window_start... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.cumulative_sum | Return the cumulative sum of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
sum of all the elements preceding and including it. The SArray is
expected to be of numeric type (int, float), or a numeric vector type.
Returns
------... | src/unity/python/turicreate/data_structures/sarray.py | def cumulative_sum(self):
"""
Return the cumulative sum of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
sum of all the elements preceding and including it. The SArray is
expected to be of numeric type (int, float), or a numeri... | def cumulative_sum(self):
"""
Return the cumulative sum of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
sum of all the elements preceding and including it. The SArray is
expected to be of numeric type (int, float), or a numeri... | [
"Return",
"the",
"cumulative",
"sum",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4223-L4252 | [
"def",
"cumulative_sum",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_sum__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.cumulative_mean | Return the cumulative mean of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
mean value of all the elements preceding and including it. The SArray
is expected to be of numeric type (int, float), or a numeric vector
type.
Return... | src/unity/python/turicreate/data_structures/sarray.py | def cumulative_mean(self):
"""
Return the cumulative mean of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
mean value of all the elements preceding and including it. The SArray
is expected to be of numeric type (int, float), or... | def cumulative_mean(self):
"""
Return the cumulative mean of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
mean value of all the elements preceding and including it. The SArray
is expected to be of numeric type (int, float), or... | [
"Return",
"the",
"cumulative",
"mean",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4254-L4284 | [
"def",
"cumulative_mean",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_avg__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.cumulative_min | Return the cumulative minimum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
minimum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int, float).
Returns
-------
... | src/unity/python/turicreate/data_structures/sarray.py | def cumulative_min(self):
"""
Return the cumulative minimum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
minimum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | def cumulative_min(self):
"""
Return the cumulative minimum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
minimum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | [
"Return",
"the",
"cumulative",
"minimum",
"value",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4286-L4313 | [
"def",
"cumulative_min",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_min__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.cumulative_max | Return the cumulative maximum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
maximum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int, float).
Returns
-------
... | src/unity/python/turicreate/data_structures/sarray.py | def cumulative_max(self):
"""
Return the cumulative maximum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
maximum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | def cumulative_max(self):
"""
Return the cumulative maximum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
maximum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | [
"Return",
"the",
"cumulative",
"maximum",
"value",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4315-L4342 | [
"def",
"cumulative_max",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_max__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.cumulative_std | Return the cumulative standard deviation of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
standard deviation of all the elements preceding and including it. The
SArray is expected to be of numeric type, or a numeric vector type.
Retur... | src/unity/python/turicreate/data_structures/sarray.py | def cumulative_std(self):
"""
Return the cumulative standard deviation of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
standard deviation of all the elements preceding and including it. The
SArray is expected to be of numeric ... | def cumulative_std(self):
"""
Return the cumulative standard deviation of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
standard deviation of all the elements preceding and including it. The
SArray is expected to be of numeric ... | [
"Return",
"the",
"cumulative",
"standard",
"deviation",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4344-L4371 | [
"def",
"cumulative_std",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_std__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.cumulative_var | Return the cumulative variance of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
variance of all the elements preceding and including it. The SArray is
expected to be of numeric type, or a numeric vector type.
Returns
-------
... | src/unity/python/turicreate/data_structures/sarray.py | def cumulative_var(self):
"""
Return the cumulative variance of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
variance of all the elements preceding and including it. The SArray is
expected to be of numeric type, or a numeric v... | def cumulative_var(self):
"""
Return the cumulative variance of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
variance of all the elements preceding and including it. The SArray is
expected to be of numeric type, or a numeric v... | [
"Return",
"the",
"cumulative",
"variance",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4373-L4400 | [
"def",
"cumulative_var",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_var__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArray.filter_by | Filter an SArray by values inside an iterable object. The result is an SArray that
only includes (or excludes) the values in the given ``values`` :class:`~turicreate.SArray`.
If ``values`` is not an SArray, we attempt to convert it to one before filtering.
Parameters
----------
... | src/unity/python/turicreate/data_structures/sarray.py | def filter_by(self, values, exclude=False):
"""
Filter an SArray by values inside an iterable object. The result is an SArray that
only includes (or excludes) the values in the given ``values`` :class:`~turicreate.SArray`.
If ``values`` is not an SArray, we attempt to convert it... | def filter_by(self, values, exclude=False):
"""
Filter an SArray by values inside an iterable object. The result is an SArray that
only includes (or excludes) the values in the given ``values`` :class:`~turicreate.SArray`.
If ``values`` is not an SArray, we attempt to convert it... | [
"Filter",
"an",
"SArray",
"by",
"values",
"inside",
"an",
"iterable",
"object",
".",
"The",
"result",
"is",
"an",
"SArray",
"that",
"only",
"includes",
"(",
"or",
"excludes",
")",
"the",
"values",
"in",
"the",
"given",
"values",
":",
"class",
":",
"~turi... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4402-L4480 | [
"def",
"filter_by",
"(",
"self",
",",
"values",
",",
"exclude",
"=",
"False",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"column_name",
"=",
"'sarray'",
"# Convert values to SArray",
"if",
"not",
"isinstance",
"(",
"values",
",",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | run_build_lib | Run the doxygen make command in the designated folder. | src/external/xgboost/subtree/rabit/doc/conf.py | def run_build_lib(folder):
"""Run the doxygen make command in the designated folder."""
try:
retcode = subprocess.call("cd %s; make" % folder, shell=True)
retcode = subprocess.call("rm -rf _build/html/doxygen", shell=True)
retcode = subprocess.call("mkdir _build", shell=True)
ret... | def run_build_lib(folder):
"""Run the doxygen make command in the designated folder."""
try:
retcode = subprocess.call("cd %s; make" % folder, shell=True)
retcode = subprocess.call("rm -rf _build/html/doxygen", shell=True)
retcode = subprocess.call("mkdir _build", shell=True)
ret... | [
"Run",
"the",
"doxygen",
"make",
"command",
"in",
"the",
"designated",
"folder",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/doc/conf.py#L153-L164 | [
"def",
"run_build_lib",
"(",
"folder",
")",
":",
"try",
":",
"retcode",
"=",
"subprocess",
".",
"call",
"(",
"\"cd %s; make\"",
"%",
"folder",
",",
"shell",
"=",
"True",
")",
"retcode",
"=",
"subprocess",
".",
"call",
"(",
"\"rm -rf _build/html/doxygen\"",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | generate_doxygen_xml | Run the doxygen make commands if we're on the ReadTheDocs server | src/external/xgboost/subtree/rabit/doc/conf.py | def generate_doxygen_xml(app):
"""Run the doxygen make commands if we're on the ReadTheDocs server"""
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
run_doxygen('..')
sys.stderr.write('Check if shared lib exists\n')
run_build_lib('..')
... | def generate_doxygen_xml(app):
"""Run the doxygen make commands if we're on the ReadTheDocs server"""
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
run_doxygen('..')
sys.stderr.write('Check if shared lib exists\n')
run_build_lib('..')
... | [
"Run",
"the",
"doxygen",
"make",
"commands",
"if",
"we",
"re",
"on",
"the",
"ReadTheDocs",
"server"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/doc/conf.py#L167-L175 | [
"def",
"generate_doxygen_xml",
"(",
"app",
")",
":",
"read_the_docs_build",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'READTHEDOCS'",
",",
"None",
")",
"==",
"'True'",
"if",
"read_the_docs_build",
":",
"run_doxygen",
"(",
"'..'",
")",
"sys",
".",
"stderr"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MessageToJson | Converts protobuf message to JSON format.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitive fields,
repeated fields, and map fields will always be serialized. If
False, only serialize non-empty fields. Singular mes... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def MessageToJson(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to JSON format.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitiv... | def MessageToJson(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to JSON format.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitiv... | [
"Converts",
"protobuf",
"message",
"to",
"JSON",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L89-L109 | [
"def",
"MessageToJson",
"(",
"message",
",",
"including_default_value_fields",
"=",
"False",
",",
"preserving_proto_field_name",
"=",
"False",
")",
":",
"printer",
"=",
"_Printer",
"(",
"including_default_value_fields",
",",
"preserving_proto_field_name",
")",
"return",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MessageToDict | Converts protobuf message to a JSON dictionary.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitive fields,
repeated fields, and map fields will always be serialized. If
False, only serialize non-empty fields. Singul... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def MessageToDict(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to a JSON dictionary.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular pr... | def MessageToDict(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to a JSON dictionary.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular pr... | [
"Converts",
"protobuf",
"message",
"to",
"a",
"JSON",
"dictionary",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L112-L133 | [
"def",
"MessageToDict",
"(",
"message",
",",
"including_default_value_fields",
"=",
"False",
",",
"preserving_proto_field_name",
"=",
"False",
")",
":",
"printer",
"=",
"_Printer",
"(",
"including_default_value_fields",
",",
"preserving_proto_field_name",
")",
"# pylint: ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | ParseDict | Parses a JSON dictionary representation into a message.
Args:
js_dict: Dict representation of a JSON message.
message: A protocol buffer message to merge into.
ignore_unknown_fields: If True, do not raise errors for unknown fields.
Returns:
The same message passed as argument. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def ParseDict(js_dict, message, ignore_unknown_fields=False):
"""Parses a JSON dictionary representation into a message.
Args:
js_dict: Dict representation of a JSON message.
message: A protocol buffer message to merge into.
ignore_unknown_fields: If True, do not raise errors for unknown fields.
Ret... | def ParseDict(js_dict, message, ignore_unknown_fields=False):
"""Parses a JSON dictionary representation into a message.
Args:
js_dict: Dict representation of a JSON message.
message: A protocol buffer message to merge into.
ignore_unknown_fields: If True, do not raise errors for unknown fields.
Ret... | [
"Parses",
"a",
"JSON",
"dictionary",
"representation",
"into",
"a",
"message",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L372-L385 | [
"def",
"ParseDict",
"(",
"js_dict",
",",
"message",
",",
"ignore_unknown_fields",
"=",
"False",
")",
":",
"parser",
"=",
"_Parser",
"(",
"ignore_unknown_fields",
")",
"parser",
".",
"ConvertMessage",
"(",
"js_dict",
",",
"message",
")",
"return",
"message"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ConvertScalarFieldValue | Convert a single scalar field value.
Args:
value: A scalar value to convert the scalar field value.
field: The descriptor of the field to convert.
require_str: If True, the field value must be a str.
Returns:
The converted scalar field value
Raises:
ParseError: In case of convert problems. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertScalarFieldValue(value, field, require_str=False):
"""Convert a single scalar field value.
Args:
value: A scalar value to convert the scalar field value.
field: The descriptor of the field to convert.
require_str: If True, the field value must be a str.
Returns:
The converted scalar ... | def _ConvertScalarFieldValue(value, field, require_str=False):
"""Convert a single scalar field value.
Args:
value: A scalar value to convert the scalar field value.
field: The descriptor of the field to convert.
require_str: If True, the field value must be a str.
Returns:
The converted scalar ... | [
"Convert",
"a",
"single",
"scalar",
"field",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L606-L648 | [
"def",
"_ConvertScalarFieldValue",
"(",
"value",
",",
"field",
",",
"require_str",
"=",
"False",
")",
":",
"if",
"field",
".",
"cpp_type",
"in",
"_INT_TYPES",
":",
"return",
"_ConvertInteger",
"(",
"value",
")",
"elif",
"field",
".",
"cpp_type",
"in",
"_FLOA... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ConvertInteger | Convert an integer.
Args:
value: A scalar value to convert.
Returns:
The integer value.
Raises:
ParseError: If an integer couldn't be consumed. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertInteger(value):
"""Convert an integer.
Args:
value: A scalar value to convert.
Returns:
The integer value.
Raises:
ParseError: If an integer couldn't be consumed.
"""
if isinstance(value, float) and not value.is_integer():
raise ParseError('Couldn\'t parse integer: {0}.'.forma... | def _ConvertInteger(value):
"""Convert an integer.
Args:
value: A scalar value to convert.
Returns:
The integer value.
Raises:
ParseError: If an integer couldn't be consumed.
"""
if isinstance(value, float) and not value.is_integer():
raise ParseError('Couldn\'t parse integer: {0}.'.forma... | [
"Convert",
"an",
"integer",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L651-L669 | [
"def",
"_ConvertInteger",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"float",
")",
"and",
"not",
"value",
".",
"is_integer",
"(",
")",
":",
"raise",
"ParseError",
"(",
"'Couldn\\'t parse integer: {0}.'",
".",
"format",
"(",
"value",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ConvertFloat | Convert an floating point number. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertFloat(value):
"""Convert an floating point number."""
if value == 'nan':
raise ParseError('Couldn\'t parse float "nan", use "NaN" instead.')
try:
# Assume Python compatible syntax.
return float(value)
except ValueError:
# Check alternative spellings.
if value == _NEG_INFINITY:
... | def _ConvertFloat(value):
"""Convert an floating point number."""
if value == 'nan':
raise ParseError('Couldn\'t parse float "nan", use "NaN" instead.')
try:
# Assume Python compatible syntax.
return float(value)
except ValueError:
# Check alternative spellings.
if value == _NEG_INFINITY:
... | [
"Convert",
"an",
"floating",
"point",
"number",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L672-L688 | [
"def",
"_ConvertFloat",
"(",
"value",
")",
":",
"if",
"value",
"==",
"'nan'",
":",
"raise",
"ParseError",
"(",
"'Couldn\\'t parse float \"nan\", use \"NaN\" instead.'",
")",
"try",
":",
"# Assume Python compatible syntax.",
"return",
"float",
"(",
"value",
")",
"excep... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ConvertBool | Convert a boolean value.
Args:
value: A scalar value to convert.
require_str: If True, value must be a str.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertBool(value, require_str):
"""Convert a boolean value.
Args:
value: A scalar value to convert.
require_str: If True, value must be a str.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed.
"""
if require_str:
if value == 'true':
ret... | def _ConvertBool(value, require_str):
"""Convert a boolean value.
Args:
value: A scalar value to convert.
require_str: If True, value must be a str.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed.
"""
if require_str:
if value == 'true':
ret... | [
"Convert",
"a",
"boolean",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L691-L714 | [
"def",
"_ConvertBool",
"(",
"value",
",",
"require_str",
")",
":",
"if",
"require_str",
":",
"if",
"value",
"==",
"'true'",
":",
"return",
"True",
"elif",
"value",
"==",
"'false'",
":",
"return",
"False",
"else",
":",
"raise",
"ParseError",
"(",
"'Expected... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Printer._MessageToJsonObject | Converts message to an object according to Proto3 JSON Specification. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _MessageToJsonObject(self, message):
"""Converts message to an object according to Proto3 JSON Specification."""
message_descriptor = message.DESCRIPTOR
full_name = message_descriptor.full_name
if _IsWrapperMessage(message_descriptor):
return self._WrapperMessageToJsonObject(message)
if fu... | def _MessageToJsonObject(self, message):
"""Converts message to an object according to Proto3 JSON Specification."""
message_descriptor = message.DESCRIPTOR
full_name = message_descriptor.full_name
if _IsWrapperMessage(message_descriptor):
return self._WrapperMessageToJsonObject(message)
if fu... | [
"Converts",
"message",
"to",
"an",
"object",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L155-L164 | [
"def",
"_MessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"message_descriptor",
"=",
"message",
".",
"DESCRIPTOR",
"full_name",
"=",
"message_descriptor",
".",
"full_name",
"if",
"_IsWrapperMessage",
"(",
"message_descriptor",
")",
":",
"return",
"self",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Printer._RegularMessageToJsonObject | Converts normal message according to Proto3 JSON Specification. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _RegularMessageToJsonObject(self, message, js):
"""Converts normal message according to Proto3 JSON Specification."""
fields = message.ListFields()
try:
for field, value in fields:
if self.preserving_proto_field_name:
name = field.name
else:
name = field.json_n... | def _RegularMessageToJsonObject(self, message, js):
"""Converts normal message according to Proto3 JSON Specification."""
fields = message.ListFields()
try:
for field, value in fields:
if self.preserving_proto_field_name:
name = field.name
else:
name = field.json_n... | [
"Converts",
"normal",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L166-L225 | [
"def",
"_RegularMessageToJsonObject",
"(",
"self",
",",
"message",
",",
"js",
")",
":",
"fields",
"=",
"message",
".",
"ListFields",
"(",
")",
"try",
":",
"for",
"field",
",",
"value",
"in",
"fields",
":",
"if",
"self",
".",
"preserving_proto_field_name",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Printer._FieldToJsonObject | Converts field value according to Proto3 JSON Specification. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _FieldToJsonObject(self, field, value):
"""Converts field value according to Proto3 JSON Specification."""
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
return self._MessageToJsonObject(value)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
enum_value = fie... | def _FieldToJsonObject(self, field, value):
"""Converts field value according to Proto3 JSON Specification."""
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
return self._MessageToJsonObject(value)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
enum_value = fie... | [
"Converts",
"field",
"value",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L227-L256 | [
"def",
"_FieldToJsonObject",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"if",
"field",
".",
"cpp_type",
"==",
"descriptor",
".",
"FieldDescriptor",
".",
"CPPTYPE_MESSAGE",
":",
"return",
"self",
".",
"_MessageToJsonObject",
"(",
"value",
")",
"elif",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Printer._AnyMessageToJsonObject | Converts Any message according to Proto3 JSON Specification. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _AnyMessageToJsonObject(self, message):
"""Converts Any message according to Proto3 JSON Specification."""
if not message.ListFields():
return {}
# Must print @type first, use OrderedDict instead of {}
js = OrderedDict()
type_url = message.type_url
js['@type'] = type_url
sub_messag... | def _AnyMessageToJsonObject(self, message):
"""Converts Any message according to Proto3 JSON Specification."""
if not message.ListFields():
return {}
# Must print @type first, use OrderedDict instead of {}
js = OrderedDict()
type_url = message.type_url
js['@type'] = type_url
sub_messag... | [
"Converts",
"Any",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L258-L277 | [
"def",
"_AnyMessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"if",
"not",
"message",
".",
"ListFields",
"(",
")",
":",
"return",
"{",
"}",
"# Must print @type first, use OrderedDict instead of {}",
"js",
"=",
"OrderedDict",
"(",
")",
"type_url",
"=",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Printer._ValueMessageToJsonObject | Converts Value message according to Proto3 JSON Specification. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ValueMessageToJsonObject(self, message):
"""Converts Value message according to Proto3 JSON Specification."""
which = message.WhichOneof('kind')
# If the Value message is not set treat as null_value when serialize
# to JSON. The parse back result will be different from original message.
if whic... | def _ValueMessageToJsonObject(self, message):
"""Converts Value message according to Proto3 JSON Specification."""
which = message.WhichOneof('kind')
# If the Value message is not set treat as null_value when serialize
# to JSON. The parse back result will be different from original message.
if whic... | [
"Converts",
"Value",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L285-L299 | [
"def",
"_ValueMessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"which",
"=",
"message",
".",
"WhichOneof",
"(",
"'kind'",
")",
"# If the Value message is not set treat as null_value when serialize",
"# to JSON. The parse back result will be different from original messa... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Printer._StructMessageToJsonObject | Converts Struct message according to Proto3 JSON Specification. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _StructMessageToJsonObject(self, message):
"""Converts Struct message according to Proto3 JSON Specification."""
fields = message.fields
ret = {}
for key in fields:
ret[key] = self._ValueMessageToJsonObject(fields[key])
return ret | def _StructMessageToJsonObject(self, message):
"""Converts Struct message according to Proto3 JSON Specification."""
fields = message.fields
ret = {}
for key in fields:
ret[key] = self._ValueMessageToJsonObject(fields[key])
return ret | [
"Converts",
"Struct",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L306-L312 | [
"def",
"_StructMessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"fields",
"=",
"message",
".",
"fields",
"ret",
"=",
"{",
"}",
"for",
"key",
"in",
"fields",
":",
"ret",
"[",
"key",
"]",
"=",
"self",
".",
"_ValueMessageToJsonObject",
"(",
"fie... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Parser.ConvertMessage | Convert a JSON object into a message.
Args:
value: A JSON object.
message: A WKT or regular protocol message to record the data.
Raises:
ParseError: In case of convert problems. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def ConvertMessage(self, value, message):
"""Convert a JSON object into a message.
Args:
value: A JSON object.
message: A WKT or regular protocol message to record the data.
Raises:
ParseError: In case of convert problems.
"""
message_descriptor = message.DESCRIPTOR
full_name... | def ConvertMessage(self, value, message):
"""Convert a JSON object into a message.
Args:
value: A JSON object.
message: A WKT or regular protocol message to record the data.
Raises:
ParseError: In case of convert problems.
"""
message_descriptor = message.DESCRIPTOR
full_name... | [
"Convert",
"a",
"JSON",
"object",
"into",
"a",
"message",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L398-L415 | [
"def",
"ConvertMessage",
"(",
"self",
",",
"value",
",",
"message",
")",
":",
"message_descriptor",
"=",
"message",
".",
"DESCRIPTOR",
"full_name",
"=",
"message_descriptor",
".",
"full_name",
"if",
"_IsWrapperMessage",
"(",
"message_descriptor",
")",
":",
"self",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Parser._ConvertFieldValuePair | Convert field value pairs into regular message.
Args:
js: A JSON object to convert the field value pairs.
message: A regular protocol message to record the data.
Raises:
ParseError: In case of problems converting. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertFieldValuePair(self, js, message):
"""Convert field value pairs into regular message.
Args:
js: A JSON object to convert the field value pairs.
message: A regular protocol message to record the data.
Raises:
ParseError: In case of problems converting.
"""
names = []
... | def _ConvertFieldValuePair(self, js, message):
"""Convert field value pairs into regular message.
Args:
js: A JSON object to convert the field value pairs.
message: A regular protocol message to record the data.
Raises:
ParseError: In case of problems converting.
"""
names = []
... | [
"Convert",
"field",
"value",
"pairs",
"into",
"regular",
"message",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L417-L507 | [
"def",
"_ConvertFieldValuePair",
"(",
"self",
",",
"js",
",",
"message",
")",
":",
"names",
"=",
"[",
"]",
"message_descriptor",
"=",
"message",
".",
"DESCRIPTOR",
"fields_by_json_name",
"=",
"dict",
"(",
"(",
"f",
".",
"json_name",
",",
"f",
")",
"for",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Parser._ConvertAnyMessage | Convert a JSON representation into Any message. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertAnyMessage(self, value, message):
"""Convert a JSON representation into Any message."""
if isinstance(value, dict) and not value:
return
try:
type_url = value['@type']
except KeyError:
raise ParseError('@type is missing when parsing any message.')
sub_message = _Create... | def _ConvertAnyMessage(self, value, message):
"""Convert a JSON representation into Any message."""
if isinstance(value, dict) and not value:
return
try:
type_url = value['@type']
except KeyError:
raise ParseError('@type is missing when parsing any message.')
sub_message = _Create... | [
"Convert",
"a",
"JSON",
"representation",
"into",
"Any",
"message",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L509-L531 | [
"def",
"_ConvertAnyMessage",
"(",
"self",
",",
"value",
",",
"message",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
"and",
"not",
"value",
":",
"return",
"try",
":",
"type_url",
"=",
"value",
"[",
"'@type'",
"]",
"except",
"KeyError",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Parser._ConvertWrapperMessage | Convert a JSON representation into Wrapper message. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertWrapperMessage(self, value, message):
"""Convert a JSON representation into Wrapper message."""
field = message.DESCRIPTOR.fields_by_name['value']
setattr(message, 'value', _ConvertScalarFieldValue(value, field)) | def _ConvertWrapperMessage(self, value, message):
"""Convert a JSON representation into Wrapper message."""
field = message.DESCRIPTOR.fields_by_name['value']
setattr(message, 'value', _ConvertScalarFieldValue(value, field)) | [
"Convert",
"a",
"JSON",
"representation",
"into",
"Wrapper",
"message",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L574-L577 | [
"def",
"_ConvertWrapperMessage",
"(",
"self",
",",
"value",
",",
"message",
")",
":",
"field",
"=",
"message",
".",
"DESCRIPTOR",
".",
"fields_by_name",
"[",
"'value'",
"]",
"setattr",
"(",
"message",
",",
"'value'",
",",
"_ConvertScalarFieldValue",
"(",
"valu... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _Parser._ConvertMapFieldValue | Convert map field value for a message map field.
Args:
value: A JSON object to convert the map field value.
message: A protocol message to record the converted data.
field: The descriptor of the map field to be converted.
Raises:
ParseError: In case of convert problems. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | def _ConvertMapFieldValue(self, value, message, field):
"""Convert map field value for a message map field.
Args:
value: A JSON object to convert the map field value.
message: A protocol message to record the converted data.
field: The descriptor of the map field to be converted.
Raises:... | def _ConvertMapFieldValue(self, value, message, field):
"""Convert map field value for a message map field.
Args:
value: A JSON object to convert the map field value.
message: A protocol message to record the converted data.
field: The descriptor of the map field to be converted.
Raises:... | [
"Convert",
"map",
"field",
"value",
"for",
"a",
"message",
"map",
"field",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L579-L603 | [
"def",
"_ConvertMapFieldValue",
"(",
"self",
",",
"value",
",",
"message",
",",
"field",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"raise",
"ParseError",
"(",
"'Map field {0} must be in a dict which is {1}.'",
".",
"format",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | plot | Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d visualization, and shows the resulting visualization.
Uses the following heuristic to choose the visualization:
* If `x` and `y` are both numeric (SArray of int or float), and they contain
fewer than or equal to 5,000 value... | src/unity/python/turicreate/visualization/show.py | def plot(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d visualization, and shows the resulting visualization.
Uses the following heuristic to choose the visualization:
* If `x` and `y` are bot... | def plot(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d visualization, and shows the resulting visualization.
Uses the following heuristic to choose the visualization:
* If `x` and `y` are bot... | [
"Plots",
"the",
"data",
"in",
"x",
"on",
"the",
"X",
"axis",
"and",
"the",
"data",
"in",
"y",
"on",
"the",
"Y",
"axis",
"in",
"a",
"2d",
"visualization",
"and",
"shows",
"the",
"resulting",
"visualization",
".",
"Uses",
"the",
"following",
"heuristic",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L20-L81 | [
"def",
"plot",
"(",
"x",
",",
"y",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"title",
"=",
"_get_title",
"(",
"title",
")",
"plt_ref",
"=",
"tc",
".",
"extensions",
".",
"plo... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | show | Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d visualization, and shows the resulting visualization.
Uses the following heuristic to choose the visualization:
* If `x` and `y` are both numeric (SArray of int or float), and they contain
fewer than or equal to 5,000 value... | src/unity/python/turicreate/visualization/show.py | def show(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d visualization, and shows the resulting visualization.
Uses the following heuristic to choose the visualization:
* If `x` and `y` are bot... | def show(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d visualization, and shows the resulting visualization.
Uses the following heuristic to choose the visualization:
* If `x` and `y` are bot... | [
"Plots",
"the",
"data",
"in",
"x",
"on",
"the",
"X",
"axis",
"and",
"the",
"data",
"in",
"y",
"on",
"the",
"Y",
"axis",
"in",
"a",
"2d",
"visualization",
"and",
"shows",
"the",
"resulting",
"visualization",
".",
"Uses",
"the",
"following",
"heuristic",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L83-L143 | [
"def",
"show",
"(",
"x",
",",
"y",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"plot",
"(",
"x",
",",
"y",
",",
"xlabel",
",",
"ylabel",
",",
"title",
")",
".",
"show",
"("... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | scatter | Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d scatter plot, and returns the resulting Plot object.
The function supports SArrays of dtypes: int, float.
Parameters
----------
x : SArray
The data to plot on the X axis of the scatter plot.
Must be nume... | src/unity/python/turicreate/visualization/show.py | def scatter(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d scatter plot, and returns the resulting Plot object.
The function supports SArrays of dtypes: int, float.
Parameters
-------... | def scatter(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d scatter plot, and returns the resulting Plot object.
The function supports SArrays of dtypes: int, float.
Parameters
-------... | [
"Plots",
"the",
"data",
"in",
"x",
"on",
"the",
"X",
"axis",
"and",
"the",
"data",
"in",
"y",
"on",
"the",
"Y",
"axis",
"in",
"a",
"2d",
"scatter",
"plot",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports",
"S... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L145-L193 | [
"def",
"scatter",
"(",
"x",
",",
"y",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"x",
",",
"tc",
".",
"data_structures",
".",
"sarray",
".... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | categorical_heatmap | Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d categorical heatmap, and returns the resulting Plot object.
The function supports SArrays of dtypes str.
Parameters
----------
x : SArray
The data to plot on the X axis of the categorical heatmap.
Must b... | src/unity/python/turicreate/visualization/show.py | def categorical_heatmap(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d categorical heatmap, and returns the resulting Plot object.
The function supports SArrays of dtypes str.
Parameters
... | def categorical_heatmap(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d categorical heatmap, and returns the resulting Plot object.
The function supports SArrays of dtypes str.
Parameters
... | [
"Plots",
"the",
"data",
"in",
"x",
"on",
"the",
"X",
"axis",
"and",
"the",
"data",
"in",
"y",
"on",
"the",
"Y",
"axis",
"in",
"a",
"2d",
"categorical",
"heatmap",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L195-L242 | [
"def",
"categorical_heatmap",
"(",
"x",
",",
"y",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"x",
",",
"tc",
".",
"data_structures",
".",
"s... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | box_plot | Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d box and whiskers plot, and returns the resulting Plot object.
The function x as SArray of dtype str and y as SArray of dtype: int, float.
Parameters
----------
x : SArray
The data to plot on the X axis of the b... | src/unity/python/turicreate/visualization/show.py | def box_plot(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d box and whiskers plot, and returns the resulting Plot object.
The function x as SArray of dtype str and y as SArray of dtype: int, f... | def box_plot(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d box and whiskers plot, and returns the resulting Plot object.
The function x as SArray of dtype str and y as SArray of dtype: int, f... | [
"Plots",
"the",
"data",
"in",
"x",
"on",
"the",
"X",
"axis",
"and",
"the",
"data",
"in",
"y",
"on",
"the",
"Y",
"axis",
"in",
"a",
"2d",
"box",
"and",
"whiskers",
"plot",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L292-L337 | [
"def",
"box_plot",
"(",
"x",
",",
"y",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"x",
",",
"tc",
".",
"data_structures",
".",
"sarray",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | columnwise_summary | Plots a columnwise summary of the sframe provided as input,
and returns the resulting Plot object.
The function supports SFrames.
Parameters
----------
sf : SFrame
The data to get a columnwise summary for.
Returns
-------
out : Plot
A :class: Plot object that is t... | src/unity/python/turicreate/visualization/show.py | def columnwise_summary(sf):
"""
Plots a columnwise summary of the sframe provided as input,
and returns the resulting Plot object.
The function supports SFrames.
Parameters
----------
sf : SFrame
The data to get a columnwise summary for.
Returns
-------
out : Pl... | def columnwise_summary(sf):
"""
Plots a columnwise summary of the sframe provided as input,
and returns the resulting Plot object.
The function supports SFrames.
Parameters
----------
sf : SFrame
The data to get a columnwise summary for.
Returns
-------
out : Pl... | [
"Plots",
"a",
"columnwise",
"summary",
"of",
"the",
"sframe",
"provided",
"as",
"input",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports",
"SFrames",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L339-L369 | [
"def",
"columnwise_summary",
"(",
"sf",
")",
":",
"if",
"not",
"isinstance",
"(",
"sf",
",",
"tc",
".",
"data_structures",
".",
"sframe",
".",
"SFrame",
")",
":",
"raise",
"ValueError",
"(",
"\"turicreate.visualization.columnwise_summary \"",
"+",
"\"supports SFra... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | histogram | Plots a histogram of the sarray provided as input, and returns the
resulting Plot object.
The function supports numeric SArrays with dtypes int or float.
Parameters
----------
sa : SArray
The data to get a histogram for. Must be numeric (int/float).
xlabel : str (optional)
The... | src/unity/python/turicreate/visualization/show.py | def histogram(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots a histogram of the sarray provided as input, and returns the
resulting Plot object.
The function supports numeric SArrays with dtypes int or float.
Parameters
----------
sa : SArray
The... | def histogram(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots a histogram of the sarray provided as input, and returns the
resulting Plot object.
The function supports numeric SArrays with dtypes int or float.
Parameters
----------
sa : SArray
The... | [
"Plots",
"a",
"histogram",
"of",
"the",
"sarray",
"provided",
"as",
"input",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports",
"numeric",
"SArrays",
"with",
"dtypes",
"int",
"or",
"float",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L371-L411 | [
"def",
"histogram",
"(",
"sa",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"sa",
",",
"tc",
".",
"data_structures",
".",
"sarray",
".",
"SArr... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | item_frequency | Plots an item frequency of the sarray provided as input, and returns the
resulting Plot object.
The function supports SArrays with dtype str.
Parameters
----------
sa : SArray
The data to get an item frequency for. Must have dtype str
xlabel : str (optional)
The text label for... | src/unity/python/turicreate/visualization/show.py | def item_frequency(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots an item frequency of the sarray provided as input, and returns the
resulting Plot object.
The function supports SArrays with dtype str.
Parameters
----------
sa : SArray
The data t... | def item_frequency(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots an item frequency of the sarray provided as input, and returns the
resulting Plot object.
The function supports SArrays with dtype str.
Parameters
----------
sa : SArray
The data t... | [
"Plots",
"an",
"item",
"frequency",
"of",
"the",
"sarray",
"provided",
"as",
"input",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports",
"SArrays",
"with",
"dtype",
"str",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L413-L453 | [
"def",
"item_frequency",
"(",
"sa",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"sa",
",",
"tc",
".",
"data_structures",
".",
"sarray",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Parse | Parses the input file and returns C code and corresponding header file. | deps/src/libevent-2.0.18-stable/event_rpcgen.py | def Parse(factory, file):
"""
Parses the input file and returns C code and corresponding header file.
"""
entities = []
while 1:
# Just gets the whole struct nicely formatted
data = GetNextStruct(file)
if not data:
break
entities.extend(ProcessStruct(f... | def Parse(factory, file):
"""
Parses the input file and returns C code and corresponding header file.
"""
entities = []
while 1:
# Just gets the whole struct nicely formatted
data = GetNextStruct(file)
if not data:
break
entities.extend(ProcessStruct(f... | [
"Parses",
"the",
"input",
"file",
"and",
"returns",
"C",
"code",
"and",
"corresponding",
"header",
"file",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L1509-L1525 | [
"def",
"Parse",
"(",
"factory",
",",
"file",
")",
":",
"entities",
"=",
"[",
"]",
"while",
"1",
":",
"# Just gets the whole struct nicely formatted",
"data",
"=",
"GetNextStruct",
"(",
"file",
")",
"if",
"not",
"data",
":",
"break",
"entities",
".",
"extend"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Struct.EntryTagName | Creates the name inside an enumeration for distinguishing data
types. | deps/src/libevent-2.0.18-stable/event_rpcgen.py | def EntryTagName(self, entry):
"""Creates the name inside an enumeration for distinguishing data
types."""
name = "%s_%s" % (self._name, entry.Name())
return name.upper() | def EntryTagName(self, entry):
"""Creates the name inside an enumeration for distinguishing data
types."""
name = "%s_%s" % (self._name, entry.Name())
return name.upper() | [
"Creates",
"the",
"name",
"inside",
"an",
"enumeration",
"for",
"distinguishing",
"data",
"types",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L66-L70 | [
"def",
"EntryTagName",
"(",
"self",
",",
"entry",
")",
":",
"name",
"=",
"\"%s_%s\"",
"%",
"(",
"self",
".",
"_name",
",",
"entry",
".",
"Name",
"(",
")",
")",
"return",
"name",
".",
"upper",
"(",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Struct.PrintIndented | Takes an array, add indentation to each entry and prints it. | deps/src/libevent-2.0.18-stable/event_rpcgen.py | def PrintIndented(self, file, ident, code):
"""Takes an array, add indentation to each entry and prints it."""
for entry in code:
print >>file, '%s%s' % (ident, entry) | def PrintIndented(self, file, ident, code):
"""Takes an array, add indentation to each entry and prints it."""
for entry in code:
print >>file, '%s%s' % (ident, entry) | [
"Takes",
"an",
"array",
"add",
"indentation",
"to",
"each",
"entry",
"and",
"prints",
"it",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L72-L75 | [
"def",
"PrintIndented",
"(",
"self",
",",
"file",
",",
"ident",
",",
"code",
")",
":",
"for",
"entry",
"in",
"code",
":",
"print",
">>",
"file",
",",
"'%s%s'",
"%",
"(",
"ident",
",",
"entry",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | StructCCode.PrintTags | Prints the tag definitions for a structure. | deps/src/libevent-2.0.18-stable/event_rpcgen.py | def PrintTags(self, file):
"""Prints the tag definitions for a structure."""
print >>file, '/* Tag definition for %s */' % self._name
print >>file, 'enum %s_ {' % self._name.lower()
for entry in self._entries:
print >>file, ' %s=%d,' % (self.EntryTagName(entry),
... | def PrintTags(self, file):
"""Prints the tag definitions for a structure."""
print >>file, '/* Tag definition for %s */' % self._name
print >>file, 'enum %s_ {' % self._name.lower()
for entry in self._entries:
print >>file, ' %s=%d,' % (self.EntryTagName(entry),
... | [
"Prints",
"the",
"tag",
"definitions",
"for",
"a",
"structure",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L83-L91 | [
"def",
"PrintTags",
"(",
"self",
",",
"file",
")",
":",
"print",
">>",
"file",
",",
"'/* Tag definition for %s */'",
"%",
"self",
".",
"_name",
"print",
">>",
"file",
",",
"'enum %s_ {'",
"%",
"self",
".",
"_name",
".",
"lower",
"(",
")",
"for",
"entry",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | QUANTILE | Builtin approximate quantile aggregator for groupby.
Accepts as an argument, one or more of a list of quantiles to query.
For instance:
To extract the median
>>> sf.groupby("user",
... {'rating_quantiles':tc.aggregate.QUANTILE('rating', 0.5)})
To extract a few quantiles
>>> sf.groupby(... | src/unity/python/turicreate/aggregate.py | def QUANTILE(src_column, *args):
"""
Builtin approximate quantile aggregator for groupby.
Accepts as an argument, one or more of a list of quantiles to query.
For instance:
To extract the median
>>> sf.groupby("user",
... {'rating_quantiles':tc.aggregate.QUANTILE('rating', 0.5)})
To... | def QUANTILE(src_column, *args):
"""
Builtin approximate quantile aggregator for groupby.
Accepts as an argument, one or more of a list of quantiles to query.
For instance:
To extract the median
>>> sf.groupby("user",
... {'rating_quantiles':tc.aggregate.QUANTILE('rating', 0.5)})
To... | [
"Builtin",
"approximate",
"quantile",
"aggregator",
"for",
"groupby",
".",
"Accepts",
"as",
"an",
"argument",
"one",
"or",
"more",
"of",
"a",
"list",
"of",
"quantiles",
"to",
"query",
".",
"For",
"instance",
":"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/aggregate.py#L226-L259 | [
"def",
"QUANTILE",
"(",
"src_column",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"quantiles",
"=",
"args",
"[",
"0",
"]",
"else",
":",
"quantiles",
"=",
"list",
"(",
"args",
")",
"if",
"not",
"_is_non_string_iterable",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | create | Compute the K-core decomposition of the graph. Return a model object with
total number of cores as well as the core id for each vertex in the graph.
Parameters
----------
graph : SGraph
The graph on which to compute the k-core decomposition.
kmin : int, optional
Minimum core id. Ve... | src/unity/python/turicreate/toolkits/graph_analytics/kcore.py | def create(graph, kmin=0, kmax=10, verbose=True):
"""
Compute the K-core decomposition of the graph. Return a model object with
total number of cores as well as the core id for each vertex in the graph.
Parameters
----------
graph : SGraph
The graph on which to compute the k-core decomp... | def create(graph, kmin=0, kmax=10, verbose=True):
"""
Compute the K-core decomposition of the graph. Return a model object with
total number of cores as well as the core id for each vertex in the graph.
Parameters
----------
graph : SGraph
The graph on which to compute the k-core decomp... | [
"Compute",
"the",
"K",
"-",
"core",
"decomposition",
"of",
"the",
"graph",
".",
"Return",
"a",
"model",
"object",
"with",
"total",
"number",
"of",
"cores",
"as",
"well",
"as",
"the",
"core",
"id",
"for",
"each",
"vertex",
"in",
"the",
"graph",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/kcore.py#L86-L150 | [
"def",
"create",
"(",
"graph",
",",
"kmin",
"=",
"0",
",",
"kmax",
"=",
"10",
",",
"verbose",
"=",
"True",
")",
":",
"from",
"turicreate",
".",
"_cython",
".",
"cy_server",
"import",
"QuietProgress",
"if",
"not",
"isinstance",
"(",
"graph",
",",
"_SGra... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | raise_error_unsupported_categorical_option | Raise an error if an option is not supported. | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_utils.py | def raise_error_unsupported_categorical_option(option_name, option_value, layer_type, layer_name):
"""
Raise an error if an option is not supported.
"""
raise RuntimeError("Unsupported option %s=%s in layer %s(%s)" % (option_name, option_value,
layer_type, layer_name)) | def raise_error_unsupported_categorical_option(option_name, option_value, layer_type, layer_name):
"""
Raise an error if an option is not supported.
"""
raise RuntimeError("Unsupported option %s=%s in layer %s(%s)" % (option_name, option_value,
layer_type, layer_name)) | [
"Raise",
"an",
"error",
"if",
"an",
"option",
"is",
"not",
"supported",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_utils.py#L7-L12 | [
"def",
"raise_error_unsupported_categorical_option",
"(",
"option_name",
",",
"option_value",
",",
"layer_type",
",",
"layer_name",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Unsupported option %s=%s in layer %s(%s)\"",
"%",
"(",
"option_name",
",",
"option_value",
",",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | process_or_validate_classifier_output_features | Given a list of class labels and a list of output_features, validate the
list and return a valid version of output_features with all the correct
data type information included. | src/external/coremltools_wrap/coremltools/coremltools/models/_feature_management.py | def process_or_validate_classifier_output_features(
output_features, class_labels, supports_class_scores = True):
"""
Given a list of class labels and a list of output_features, validate the
list and return a valid version of output_features with all the correct
data type information included.
... | def process_or_validate_classifier_output_features(
output_features, class_labels, supports_class_scores = True):
"""
Given a list of class labels and a list of output_features, validate the
list and return a valid version of output_features with all the correct
data type information included.
... | [
"Given",
"a",
"list",
"of",
"class",
"labels",
"and",
"a",
"list",
"of",
"output_features",
"validate",
"the",
"list",
"and",
"return",
"a",
"valid",
"version",
"of",
"output_features",
"with",
"all",
"the",
"correct",
"data",
"type",
"information",
"included"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_feature_management.py#L19-L103 | [
"def",
"process_or_validate_classifier_output_features",
"(",
"output_features",
",",
"class_labels",
",",
"supports_class_scores",
"=",
"True",
")",
":",
"def",
"raise_error",
"(",
"msg",
")",
":",
"raise",
"ValueError",
"(",
"\"Classifier error: %s\"",
"%",
"msg",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | process_or_validate_features | Puts features into a standard form from a number of different possible forms.
The standard form is a list of 2-tuples of (name, datatype) pairs. The name
is a string and the datatype is an object as defined in the _datatype module.
The possible input forms are as follows:
* A list of strings. in t... | src/external/coremltools_wrap/coremltools/coremltools/models/_feature_management.py | def process_or_validate_features(features, num_dimensions = None, feature_type_map = {}):
"""
Puts features into a standard form from a number of different possible forms.
The standard form is a list of 2-tuples of (name, datatype) pairs. The name
is a string and the datatype is an object as defined i... | def process_or_validate_features(features, num_dimensions = None, feature_type_map = {}):
"""
Puts features into a standard form from a number of different possible forms.
The standard form is a list of 2-tuples of (name, datatype) pairs. The name
is a string and the datatype is an object as defined i... | [
"Puts",
"features",
"into",
"a",
"standard",
"form",
"from",
"a",
"number",
"of",
"different",
"possible",
"forms",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_feature_management.py#L130-L317 | [
"def",
"process_or_validate_features",
"(",
"features",
",",
"num_dimensions",
"=",
"None",
",",
"feature_type_map",
"=",
"{",
"}",
")",
":",
"original_features",
"=",
"copy",
"(",
"features",
")",
"if",
"num_dimensions",
"is",
"not",
"None",
"and",
"not",
"is... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | bootstrap | Performs python-side bootstrapping of Boost.Build/Python.
This function arranges for 'b2.whatever' package names to work, while also
allowing to put python files alongside corresponding jam modules. | deps/src/boost_1_68_0/tools/build/src/kernel/bootstrap.py | def bootstrap(root_path):
"""Performs python-side bootstrapping of Boost.Build/Python.
This function arranges for 'b2.whatever' package names to work, while also
allowing to put python files alongside corresponding jam modules.
"""
m = imp.new_module("b2")
# Note that:
# 1. If __path__ is ... | def bootstrap(root_path):
"""Performs python-side bootstrapping of Boost.Build/Python.
This function arranges for 'b2.whatever' package names to work, while also
allowing to put python files alongside corresponding jam modules.
"""
m = imp.new_module("b2")
# Note that:
# 1. If __path__ is ... | [
"Performs",
"python",
"-",
"side",
"bootstrapping",
"of",
"Boost",
".",
"Build",
"/",
"Python",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/kernel/bootstrap.py#L9-L24 | [
"def",
"bootstrap",
"(",
"root_path",
")",
":",
"m",
"=",
"imp",
".",
"new_module",
"(",
"\"b2\"",
")",
"# Note that:",
"# 1. If __path__ is not list of strings, nothing will work",
"# 2. root_path is already list of strings.",
"m",
".",
"__path__",
"=",
"root_path",
"sys... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | main | The main function of the utility | deps/src/boost_1_68_0/libs/metaparse/tools/build_environment.py | def main():
"""The main function of the utility"""
parser = argparse.ArgumentParser(
description='Manage the build environment of Boost.Metaparse'
)
parser.add_argument(
'--dep_json',
required=True,
help='The json file describing the dependencies'
)
parser.add_arg... | def main():
"""The main function of the utility"""
parser = argparse.ArgumentParser(
description='Manage the build environment of Boost.Metaparse'
)
parser.add_argument(
'--dep_json',
required=True,
help='The json file describing the dependencies'
)
parser.add_arg... | [
"The",
"main",
"function",
"of",
"the",
"utility"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/build_environment.py#L81-L130 | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Manage the build environment of Boost.Metaparse'",
")",
"parser",
".",
"add_argument",
"(",
"'--dep_json'",
",",
"required",
"=",
"True",
",",
"help",
"=",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | SArrayBuilder.read_history | Outputs the last `num` elements that were appended either by `append` or
`append_multiple`.
Returns
-------
out : list | src/unity/python/turicreate/data_structures/sarray_builder.py | def read_history(self, num=10, segment=0):
"""
Outputs the last `num` elements that were appended either by `append` or
`append_multiple`.
Returns
-------
out : list
"""
if num < 0:
num = 0
if segment < 0:
raise TypeError(... | def read_history(self, num=10, segment=0):
"""
Outputs the last `num` elements that were appended either by `append` or
`append_multiple`.
Returns
-------
out : list
"""
if num < 0:
num = 0
if segment < 0:
raise TypeError(... | [
"Outputs",
"the",
"last",
"num",
"elements",
"that",
"were",
"appended",
"either",
"by",
"append",
"or",
"append_multiple",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray_builder.py#L114-L128 | [
"def",
"read_history",
"(",
"self",
",",
"num",
"=",
"10",
",",
"segment",
"=",
"0",
")",
":",
"if",
"num",
"<",
"0",
":",
"num",
"=",
"0",
"if",
"segment",
"<",
"0",
":",
"raise",
"TypeError",
"(",
"\"segment must be >= 0\"",
")",
"return",
"self",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | flags | Specifies the flags (variables) that must be set on targets under certain
conditions, described by arguments.
rule_or_module: If contains dot, should be a rule name.
The flags will be applied when that rule is
used to set up build actions.
... | deps/src/boost_1_68_0/tools/build/src/build/toolset.py | def flags(rule_or_module, variable_name, condition, values = []):
""" Specifies the flags (variables) that must be set on targets under certain
conditions, described by arguments.
rule_or_module: If contains dot, should be a rule name.
The flags will be applied when that ... | def flags(rule_or_module, variable_name, condition, values = []):
""" Specifies the flags (variables) that must be set on targets under certain
conditions, described by arguments.
rule_or_module: If contains dot, should be a rule name.
The flags will be applied when that ... | [
"Specifies",
"the",
"flags",
"(",
"variables",
")",
"that",
"must",
"be",
"set",
"on",
"targets",
"under",
"certain",
"conditions",
"described",
"by",
"arguments",
".",
"rule_or_module",
":",
"If",
"contains",
"dot",
"should",
"be",
"a",
"rule",
"name",
".",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/toolset.py#L92-L169 | [
"def",
"flags",
"(",
"rule_or_module",
",",
"variable_name",
",",
"condition",
",",
"values",
"=",
"[",
"]",
")",
":",
"assert",
"isinstance",
"(",
"rule_or_module",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"variable_name",
",",
"basestring",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | find_satisfied_condition | Returns the first element of 'property-sets' which is a subset of
'properties', or an empty list if no such element exists. | deps/src/boost_1_68_0/tools/build/src/build/toolset.py | def find_satisfied_condition(conditions, ps):
"""Returns the first element of 'property-sets' which is a subset of
'properties', or an empty list if no such element exists."""
assert is_iterable_typed(conditions, property_set.PropertySet)
assert isinstance(ps, property_set.PropertySet)
for conditio... | def find_satisfied_condition(conditions, ps):
"""Returns the first element of 'property-sets' which is a subset of
'properties', or an empty list if no such element exists."""
assert is_iterable_typed(conditions, property_set.PropertySet)
assert isinstance(ps, property_set.PropertySet)
for conditio... | [
"Returns",
"the",
"first",
"element",
"of",
"property",
"-",
"sets",
"which",
"is",
"a",
"subset",
"of",
"properties",
"or",
"an",
"empty",
"list",
"if",
"no",
"such",
"element",
"exists",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/toolset.py#L184-L216 | [
"def",
"find_satisfied_condition",
"(",
"conditions",
",",
"ps",
")",
":",
"assert",
"is_iterable_typed",
"(",
"conditions",
",",
"property_set",
".",
"PropertySet",
")",
"assert",
"isinstance",
"(",
"ps",
",",
"property_set",
".",
"PropertySet",
")",
"for",
"co... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | inherit_flags | Brings all flag definitions from the 'base' toolset into the 'toolset'
toolset. Flag definitions whose conditions make use of properties in
'prohibited-properties' are ignored. Don't confuse property and feature, for
example <debug-symbols>on and <debug-symbols>off, so blocking one of them does
not bloc... | deps/src/boost_1_68_0/tools/build/src/build/toolset.py | def inherit_flags(toolset, base, prohibited_properties = []):
"""Brings all flag definitions from the 'base' toolset into the 'toolset'
toolset. Flag definitions whose conditions make use of properties in
'prohibited-properties' are ignored. Don't confuse property and feature, for
example <debug-symbols... | def inherit_flags(toolset, base, prohibited_properties = []):
"""Brings all flag definitions from the 'base' toolset into the 'toolset'
toolset. Flag definitions whose conditions make use of properties in
'prohibited-properties' are ignored. Don't confuse property and feature, for
example <debug-symbols... | [
"Brings",
"all",
"flag",
"definitions",
"from",
"the",
"base",
"toolset",
"into",
"the",
"toolset",
"toolset",
".",
"Flag",
"definitions",
"whose",
"conditions",
"make",
"use",
"of",
"properties",
"in",
"prohibited",
"-",
"properties",
"are",
"ignored",
".",
"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/toolset.py#L251-L280 | [
"def",
"inherit_flags",
"(",
"toolset",
",",
"base",
",",
"prohibited_properties",
"=",
"[",
"]",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"base",
",",
"basestring",
")",
"assert",
"is_iterable_type... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __set_target_variables_aux | Given a rule name and a property set, returns a list of tuples of
variables names and values, which must be set on targets for that
rule/properties combination. | deps/src/boost_1_68_0/tools/build/src/build/toolset.py | def __set_target_variables_aux (manager, rule_or_module, ps):
""" Given a rule name and a property set, returns a list of tuples of
variables names and values, which must be set on targets for that
rule/properties combination.
"""
assert isinstance(rule_or_module, basestring)
assert isin... | def __set_target_variables_aux (manager, rule_or_module, ps):
""" Given a rule name and a property set, returns a list of tuples of
variables names and values, which must be set on targets for that
rule/properties combination.
"""
assert isinstance(rule_or_module, basestring)
assert isin... | [
"Given",
"a",
"rule",
"name",
"and",
"a",
"property",
"set",
"returns",
"a",
"list",
"of",
"tuples",
"of",
"variables",
"names",
"and",
"values",
"which",
"must",
"be",
"set",
"on",
"targets",
"for",
"that",
"rule",
"/",
"properties",
"combination",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/toolset.py#L301-L329 | [
"def",
"__set_target_variables_aux",
"(",
"manager",
",",
"rule_or_module",
",",
"ps",
")",
":",
"assert",
"isinstance",
"(",
"rule_or_module",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"ps",
",",
"property_set",
".",
"PropertySet",
")",
"result",
"="... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __add_flag | Adds a new flag setting with the specified values.
Does no checking. | deps/src/boost_1_68_0/tools/build/src/build/toolset.py | def __add_flag (rule_or_module, variable_name, condition, values):
""" Adds a new flag setting with the specified values.
Does no checking.
"""
assert isinstance(rule_or_module, basestring)
assert isinstance(variable_name, basestring)
assert is_iterable_typed(condition, property_set.Property... | def __add_flag (rule_or_module, variable_name, condition, values):
""" Adds a new flag setting with the specified values.
Does no checking.
"""
assert isinstance(rule_or_module, basestring)
assert isinstance(variable_name, basestring)
assert is_iterable_typed(condition, property_set.Property... | [
"Adds",
"a",
"new",
"flag",
"setting",
"with",
"the",
"specified",
"values",
".",
"Does",
"no",
"checking",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/toolset.py#L365-L382 | [
"def",
"__add_flag",
"(",
"rule_or_module",
",",
"variable_name",
",",
"condition",
",",
"values",
")",
":",
"assert",
"isinstance",
"(",
"rule_or_module",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"variable_name",
",",
"basestring",
")",
"assert",
"i... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | Convert a Logistic Regression model to the protobuf spec.
Parameters
----------
model: LogisticRegression
A trained LogisticRegression model.
feature_names: [str], optional (default=None)
Name of the input columns.
target: str, optional (default=None)
Name of the output col... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_logistic_regression.py | def convert(model, feature_names, target):
"""Convert a Logistic Regression model to the protobuf spec.
Parameters
----------
model: LogisticRegression
A trained LogisticRegression model.
feature_names: [str], optional (default=None)
Name of the input columns.
target: str, opti... | def convert(model, feature_names, target):
"""Convert a Logistic Regression model to the protobuf spec.
Parameters
----------
model: LogisticRegression
A trained LogisticRegression model.
feature_names: [str], optional (default=None)
Name of the input columns.
target: str, opti... | [
"Convert",
"a",
"Logistic",
"Regression",
"model",
"to",
"the",
"protobuf",
"spec",
".",
"Parameters",
"----------",
"model",
":",
"LogisticRegression",
"A",
"trained",
"LogisticRegression",
"model",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_logistic_regression.py#L21-L45 | [
"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 | root | If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. | deps/src/boost_1_68_0/tools/build/src/util/path.py | def root (path, root):
""" If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged.
"""
if os.path.isabs (path):
return path
else:
return os.path.join (root, path) | def root (path, root):
""" If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged.
"""
if os.path.isabs (path):
return path
else:
return os.path.join (root, path) | [
"If",
"path",
"is",
"relative",
"it",
"is",
"rooted",
"at",
"root",
".",
"Otherwise",
"it",
"s",
"unchanged",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L28-L34 | [
"def",
"root",
"(",
"path",
",",
"root",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"return",
"path",
"else",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"path",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | reverse | Returns path2 such that `os.path.join(path, path2) == '.'`.
`path` may not contain '..' or be rooted.
Args:
path (str): the path to reverse
Returns:
the string of the reversed path
Example:
>>> p1 = 'path/to/somewhere'
>>> p2 = reverse('path/to/somewhere')
>>>... | deps/src/boost_1_68_0/tools/build/src/util/path.py | def reverse(path):
"""Returns path2 such that `os.path.join(path, path2) == '.'`.
`path` may not contain '..' or be rooted.
Args:
path (str): the path to reverse
Returns:
the string of the reversed path
Example:
>>> p1 = 'path/to/somewhere'
>>> p2 = reverse('path/... | def reverse(path):
"""Returns path2 such that `os.path.join(path, path2) == '.'`.
`path` may not contain '..' or be rooted.
Args:
path (str): the path to reverse
Returns:
the string of the reversed path
Example:
>>> p1 = 'path/to/somewhere'
>>> p2 = reverse('path/... | [
"Returns",
"path2",
"such",
"that",
"os",
".",
"path",
".",
"join",
"(",
"path",
"path2",
")",
"==",
".",
".",
"path",
"may",
"not",
"contain",
"..",
"or",
"be",
"rooted",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L197-L225 | [
"def",
"reverse",
"(",
"path",
")",
":",
"if",
"is_rooted",
"(",
"path",
")",
"or",
"'..'",
"in",
"path",
":",
"from",
"b2",
".",
"manager",
"import",
"get_manager",
"get_manager",
"(",
")",
".",
"errors",
"(",
")",
"(",
"'reverse(path): path is either roo... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.