repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
count_words
def count_words(text, to_lower=True, delimiters=DEFAULT_DELIMITERS): """ If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. C...
python
def count_words(text, to_lower=True, delimiters=DEFAULT_DELIMITERS): """ If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. C...
[ "def", "count_words", "(", "text", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute word counts", "sf", "=", "_turicreate", ".", "SFrame", "(", "{",...
If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. Counts for the same word, in the same row, are added together. This outpu...
[ "If", "text", "is", "an", "SArray", "of", "strings", "or", "an", "SArray", "of", "lists", "of", "strings", "the", "occurances", "of", "word", "are", "counted", "for", "each", "row", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L24-L117
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
count_ngrams
def count_ngrams(text, n=2, method="word", to_lower=True, delimiters=DEFAULT_DELIMITERS, ignore_punct=True, ignore_space=True): """ Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element...
python
def count_ngrams(text, n=2, method="word", to_lower=True, delimiters=DEFAULT_DELIMITERS, ignore_punct=True, ignore_space=True): """ Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element...
[ "def", "count_ngrams", "(", "text", ",", "n", "=", "2", ",", "method", "=", "\"word\"", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ",", "ignore_punct", "=", "True", ",", "ignore_space", "=", "True", ")", ":", "_raise_error_...
Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element. The n-grams can be specified to be either character n-grams or word n-grams. The input SArray could contain strings, dicts with string keys and numeric values,...
[ "Return", "an", "SArray", "of", "dict", "type", "where", "each", "element", "contains", "the", "count", "for", "each", "of", "the", "n", "-", "grams", "that", "appear", "in", "the", "corresponding", "input", "element", ".", "The", "n", "-", "grams", "can...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L119-L243
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
tf_idf
def tf_idf(text): """ Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`...
python
def tf_idf(text): """ Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`...
[ "def", "tf_idf", "(", "text", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "if", "len", "(", "text", ")", "==", "0", ":", "return", "_turicreate", ".", "SArray", "(", ")", "dataset", "=", "_turicreate", ".", "SFrame", "(", ...
Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`d`, :math:`f(w)` is the number...
[ "Compute", "the", "TF", "-", "IDF", "scores", "for", "each", "word", "in", "each", "document", ".", "The", "collection", "of", "documents", "must", "be", "in", "bag", "-", "of", "-", "words", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L246-L295
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
drop_words
def drop_words(text, threshold=2, to_lower=True, delimiters=DEFAULT_DELIMITERS, stop_words=None): ''' Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the mo...
python
def drop_words(text, threshold=2, to_lower=True, delimiters=DEFAULT_DELIMITERS, stop_words=None): ''' Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the mo...
[ "def", "drop_words", "(", "text", ",", "threshold", "=", "2", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ",", "stop_words", "=", "None", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute wor...
Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the models learned on the transformed data. RareWordTrimmer can be applied to all the string-, dictionary-, and list-typed ...
[ "Remove", "words", "that", "occur", "below", "a", "certain", "number", "of", "times", "in", "an", "SArray", ".", "This", "is", "a", "common", "method", "of", "cleaning", "text", "before", "it", "is", "used", "and", "can", "increase", "the", "quality", "a...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L298-L410
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
tokenize
def tokenize(text, to_lower=False, delimiters=DEFAULT_DELIMITERS): """ Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HT...
python
def tokenize(text, to_lower=False, delimiters=DEFAULT_DELIMITERS): """ Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HT...
[ "def", "tokenize", "(", "text", ",", "to_lower", "=", "False", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute word counts", "sf", "=", "_turicreate", ".", "SFrame", "(", "{", ...
Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HTML, or other structured text formats. to_lower : bool, optional If...
[ "Tokenize", "the", "input", "SArray", "of", "text", "strings", "and", "return", "the", "list", "of", "tokens", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L412-L478
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
bm25
def bm25(dataset, query, k1=1.5, b=.75): """ For a given query and set of documents, compute the BM25 score for each document. If we have a query with words q_1, ..., q_n the BM25 score for a document is: .. math:: \sum_{i=1}^N IDF(q_i)\\frac{f(q_i) * (k_1+1)}{f(q_i) + k_1 * (1-b+b*|D|/d_avg))}...
python
def bm25(dataset, query, k1=1.5, b=.75): """ For a given query and set of documents, compute the BM25 score for each document. If we have a query with words q_1, ..., q_n the BM25 score for a document is: .. math:: \sum_{i=1}^N IDF(q_i)\\frac{f(q_i) * (k_1+1)}{f(q_i) + k_1 * (1-b+b*|D|/d_avg))}...
[ "def", "bm25", "(", "dataset", ",", "query", ",", "k1", "=", "1.5", ",", "b", "=", ".75", ")", ":", "if", "type", "(", "dataset", ")", "!=", "_turicreate", ".", "SArray", ":", "raise", "TypeError", "(", "'bm25 requires an SArray of dict, list, or str type'",...
For a given query and set of documents, compute the BM25 score for each document. If we have a query with words q_1, ..., q_n the BM25 score for a document is: .. math:: \sum_{i=1}^N IDF(q_i)\\frac{f(q_i) * (k_1+1)}{f(q_i) + k_1 * (1-b+b*|D|/d_avg))} where * :math:`\mbox{IDF}(q_i) = log((N - ...
[ "For", "a", "given", "query", "and", "set", "of", "documents", "compute", "the", "BM25", "score", "for", "each", "document", ".", "If", "we", "have", "a", "query", "with", "words", "q_1", "...", "q_n", "the", "BM25", "score", "for", "a", "document", "i...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L480-L590
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
parse_sparse
def parse_sparse(filename, vocab_filename): """ Parse a file that's in libSVM format. In libSVM format each line of the text file represents a document in bag of words format: num_unique_words_in_doc word_id:count another_id:count The word_ids have 0-based indexing, i.e. 0 corresponds to the first...
python
def parse_sparse(filename, vocab_filename): """ Parse a file that's in libSVM format. In libSVM format each line of the text file represents a document in bag of words format: num_unique_words_in_doc word_id:count another_id:count The word_ids have 0-based indexing, i.e. 0 corresponds to the first...
[ "def", "parse_sparse", "(", "filename", ",", "vocab_filename", ")", ":", "vocab", "=", "_turicreate", ".", "SFrame", ".", "read_csv", "(", "vocab_filename", ",", "header", "=", "None", ")", "[", "'X1'", "]", "vocab", "=", "list", "(", "vocab", ")", "docs...
Parse a file that's in libSVM format. In libSVM format each line of the text file represents a document in bag of words format: num_unique_words_in_doc word_id:count another_id:count The word_ids have 0-based indexing, i.e. 0 corresponds to the first word in the vocab filename. Parameters ---...
[ "Parse", "a", "file", "that", "s", "in", "libSVM", "format", ".", "In", "libSVM", "format", "each", "line", "of", "the", "text", "file", "represents", "a", "document", "in", "bag", "of", "words", "format", ":" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L593-L662
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
parse_docword
def parse_docword(filename, vocab_filename): """ Parse a file that's in "docword" format. This consists of a 3-line header comprised of the document count, the vocabulary count, and the number of tokens, i.e. unique (doc_id, word_id) pairs. After the header, each line contains a space-separated trip...
python
def parse_docword(filename, vocab_filename): """ Parse a file that's in "docword" format. This consists of a 3-line header comprised of the document count, the vocabulary count, and the number of tokens, i.e. unique (doc_id, word_id) pairs. After the header, each line contains a space-separated trip...
[ "def", "parse_docword", "(", "filename", ",", "vocab_filename", ")", ":", "vocab", "=", "_turicreate", ".", "SFrame", ".", "read_csv", "(", "vocab_filename", ",", "header", "=", "None", ")", "[", "'X1'", "]", "vocab", "=", "list", "(", "vocab", ")", "sf"...
Parse a file that's in "docword" format. This consists of a 3-line header comprised of the document count, the vocabulary count, and the number of tokens, i.e. unique (doc_id, word_id) pairs. After the header, each line contains a space-separated triple of (doc_id, word_id, frequency), where frequency i...
[ "Parse", "a", "file", "that", "s", "in", "docword", "format", ".", "This", "consists", "of", "a", "3", "-", "line", "header", "comprised", "of", "the", "document", "count", "the", "vocabulary", "count", "and", "the", "number", "of", "tokens", "i", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L665-L716
train
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
random_split
def random_split(dataset, prob=.5): """ Utility for performing a random split for text data that is already in bag-of-words format. For each (word, count) pair in a particular element, the counts are uniformly partitioned in either a training set or a test set. Parameters ---------- dat...
python
def random_split(dataset, prob=.5): """ Utility for performing a random split for text data that is already in bag-of-words format. For each (word, count) pair in a particular element, the counts are uniformly partitioned in either a training set or a test set. Parameters ---------- dat...
[ "def", "random_split", "(", "dataset", ",", "prob", "=", ".5", ")", ":", "def", "grab_values", "(", "x", ",", "train", "=", "True", ")", ":", "if", "train", ":", "ix", "=", "0", "else", ":", "ix", "=", "1", "return", "dict", "(", "[", "(", "key...
Utility for performing a random split for text data that is already in bag-of-words format. For each (word, count) pair in a particular element, the counts are uniformly partitioned in either a training set or a test set. Parameters ---------- dataset : SArray of type dict, SFrame with columns ...
[ "Utility", "for", "performing", "a", "random", "split", "for", "text", "data", "that", "is", "already", "in", "bag", "-", "of", "-", "words", "format", ".", "For", "each", "(", "word", "count", ")", "pair", "in", "a", "particular", "element", "the", "c...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L719-L778
train
apple/turicreate
src/external/xgboost/python-package/xgboost/training.py
train
def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, maximize=False, early_stopping_rounds=None, evals_result=None, verbose_eval=True, learning_rates=None, xgb_model=None): # pylint: disable=too-many-statements,too-many-branches, attribute-defined-outside-init """Tra...
python
def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, maximize=False, early_stopping_rounds=None, evals_result=None, verbose_eval=True, learning_rates=None, xgb_model=None): # pylint: disable=too-many-statements,too-many-branches, attribute-defined-outside-init """Tra...
[ "def", "train", "(", "params", ",", "dtrain", ",", "num_boost_round", "=", "10", ",", "evals", "=", "(", ")", ",", "obj", "=", "None", ",", "feval", "=", "None", ",", "maximize", "=", "False", ",", "early_stopping_rounds", "=", "None", ",", "evals_resu...
Train a booster with given parameters. Parameters ---------- params : dict Booster params. dtrain : DMatrix Data to be trained. num_boost_round: int Number of boosting iterations. watchlist (evals): list of pairs (DMatrix, string) List of items to be evaluated du...
[ "Train", "a", "booster", "with", "given", "parameters", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L12-L192
train
apple/turicreate
src/external/xgboost/python-package/xgboost/training.py
mknfold
def mknfold(dall, nfold, param, seed, evals=(), fpreproc=None): """ Make an n-fold list of CVPack from random indices. """ evals = list(evals) np.random.seed(seed) randidx = np.random.permutation(dall.num_row()) kstep = len(randidx) / nfold idset = [randidx[(i * kstep): min(len(randidx),...
python
def mknfold(dall, nfold, param, seed, evals=(), fpreproc=None): """ Make an n-fold list of CVPack from random indices. """ evals = list(evals) np.random.seed(seed) randidx = np.random.permutation(dall.num_row()) kstep = len(randidx) / nfold idset = [randidx[(i * kstep): min(len(randidx),...
[ "def", "mknfold", "(", "dall", ",", "nfold", ",", "param", ",", "seed", ",", "evals", "=", "(", ")", ",", "fpreproc", "=", "None", ")", ":", "evals", "=", "list", "(", "evals", ")", "np", ".", "random", ".", "seed", "(", "seed", ")", "randidx", ...
Make an n-fold list of CVPack from random indices.
[ "Make", "an", "n", "-", "fold", "list", "of", "CVPack", "from", "random", "indices", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L213-L233
train
apple/turicreate
src/external/xgboost/python-package/xgboost/training.py
aggcv
def aggcv(rlist, show_stdv=True, show_progress=None, as_pandas=True): # pylint: disable=invalid-name """ Aggregate cross-validation results. """ cvmap = {} idx = rlist[0].split()[0] for line in rlist: arr = line.split() assert idx == arr[0] for it in arr[1:]: ...
python
def aggcv(rlist, show_stdv=True, show_progress=None, as_pandas=True): # pylint: disable=invalid-name """ Aggregate cross-validation results. """ cvmap = {} idx = rlist[0].split()[0] for line in rlist: arr = line.split() assert idx == arr[0] for it in arr[1:]: ...
[ "def", "aggcv", "(", "rlist", ",", "show_stdv", "=", "True", ",", "show_progress", "=", "None", ",", "as_pandas", "=", "True", ")", ":", "# pylint: disable=invalid-name", "cvmap", "=", "{", "}", "idx", "=", "rlist", "[", "0", "]", ".", "split", "(", ")...
Aggregate cross-validation results.
[ "Aggregate", "cross", "-", "validation", "results", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L236-L291
train
apple/turicreate
src/external/xgboost/python-package/xgboost/training.py
cv
def cv(params, dtrain, num_boost_round=10, nfold=3, metrics=(), obj=None, feval=None, fpreproc=None, as_pandas=True, show_progress=None, show_stdv=True, seed=0): # pylint: disable = invalid-name """Cross-validation with given paramaters. Parameters ---------- params : dict Boo...
python
def cv(params, dtrain, num_boost_round=10, nfold=3, metrics=(), obj=None, feval=None, fpreproc=None, as_pandas=True, show_progress=None, show_stdv=True, seed=0): # pylint: disable = invalid-name """Cross-validation with given paramaters. Parameters ---------- params : dict Boo...
[ "def", "cv", "(", "params", ",", "dtrain", ",", "num_boost_round", "=", "10", ",", "nfold", "=", "3", ",", "metrics", "=", "(", ")", ",", "obj", "=", "None", ",", "feval", "=", "None", ",", "fpreproc", "=", "None", ",", "as_pandas", "=", "True", ...
Cross-validation with given paramaters. Parameters ---------- params : dict Booster params. dtrain : DMatrix Data to be trained. num_boost_round : int Number of boosting iterations. nfold : int Number of folds in CV. metrics : list of strings Evaluati...
[ "Cross", "-", "validation", "with", "given", "paramaters", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L294-L354
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
create
def create(dataset, target, feature=None, model = 'resnet-50', l2_penalty=0.01, l1_penalty=0.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], step_size = _DEFAULT_SOLVER_OPTIONS['step_size'], lbfgs_memory_level = _DEFAULT_SOLVER...
python
def create(dataset, target, feature=None, model = 'resnet-50', l2_penalty=0.01, l1_penalty=0.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], step_size = _DEFAULT_SOLVER_OPTIONS['step_size'], lbfgs_memory_level = _DEFAULT_SOLVER...
[ "def", "create", "(", "dataset", ",", "target", ",", "feature", "=", "None", ",", "model", "=", "'resnet-50'", ",", "l2_penalty", "=", "0.01", ",", "l1_penalty", "=", "0.0", ",", "solver", "=", "'auto'", ",", "feature_rescaling", "=", "True", ",", "conve...
Create a :class:`ImageClassifier` model. Parameters ---------- dataset : SFrame Input data. The column named by the 'feature' parameter will be extracted for modeling. target : string, or int Name of the column containing the target variable. The values in this column m...
[ "Create", "a", ":", "class", ":", "ImageClassifier", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L38-L307
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
ImageClassifier._get_native_state
def _get_native_state(self): """ Save the model as a dictionary, which can be loaded with the :py:func:`~turicreate.load_model` method. """ state = self.__proxy__.get_state() state['classifier'] = state['classifier'].__proxy__ del state['feature_extractor'] ...
python
def _get_native_state(self): """ Save the model as a dictionary, which can be loaded with the :py:func:`~turicreate.load_model` method. """ state = self.__proxy__.get_state() state['classifier'] = state['classifier'].__proxy__ del state['feature_extractor'] ...
[ "def", "_get_native_state", "(", "self", ")", ":", "state", "=", "self", ".", "__proxy__", ".", "get_state", "(", ")", "state", "[", "'classifier'", "]", "=", "state", "[", "'classifier'", "]", ".", "__proxy__", "del", "state", "[", "'feature_extractor'", ...
Save the model as a dictionary, which can be loaded with the :py:func:`~turicreate.load_model` method.
[ "Save", "the", "model", "as", "a", "dictionary", "which", "can", "be", "loaded", "with", "the", ":", "py", ":", "func", ":", "~turicreate", ".", "load_model", "method", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L329-L338
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
ImageClassifier._load_version
def _load_version(cls, state, version): """ A function to load a previously saved ImageClassifier instance. """ _tkutl._model_version_check(version, cls._PYTHON_IMAGE_CLASSIFIER_VERSION) from turicreate.toolkits.classifier.logistic_classifier import LogisticClassifier ...
python
def _load_version(cls, state, version): """ A function to load a previously saved ImageClassifier instance. """ _tkutl._model_version_check(version, cls._PYTHON_IMAGE_CLASSIFIER_VERSION) from turicreate.toolkits.classifier.logistic_classifier import LogisticClassifier ...
[ "def", "_load_version", "(", "cls", ",", "state", ",", "version", ")", ":", "_tkutl", ".", "_model_version_check", "(", "version", ",", "cls", ".", "_PYTHON_IMAGE_CLASSIFIER_VERSION", ")", "from", "turicreate", ".", "toolkits", ".", "classifier", ".", "logistic_...
A function to load a previously saved ImageClassifier instance.
[ "A", "function", "to", "load", "a", "previously", "saved", "ImageClassifier", "instance", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L341-L362
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
ImageClassifier.predict
def predict(self, dataset, output_type='class', batch_size=64): """ Return predictions for ``dataset``, using the trained logistic regression model. Predictions can be generated as class labels, probabilities that the target value is True, or margins (i.e. the distance of the obs...
python
def predict(self, dataset, output_type='class', batch_size=64): """ Return predictions for ``dataset``, using the trained logistic regression model. Predictions can be generated as class labels, probabilities that the target value is True, or margins (i.e. the distance of the obs...
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'class'", ",", "batch_size", "=", "64", ")", ":", "if", "not", "isinstance", "(", "dataset", ",", "(", "_tc", ".", "SFrame", ",", "_tc", ".", "SArray", ",", "_tc", ".", "Image",...
Return predictions for ``dataset``, using the trained logistic regression model. Predictions can be generated as class labels, probabilities that the target value is True, or margins (i.e. the distance of the observations from the hyperplane separating the classes). `probability_vector` ...
[ "Return", "predictions", "for", "dataset", "using", "the", "trained", "logistic", "regression", "model", ".", "Predictions", "can", "be", "generated", "as", "class", "labels", "probabilities", "that", "the", "target", "value", "is", "True", "or", "margins", "(",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L433-L499
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
ImageClassifier.predict_topk
def predict_topk(self, dataset, output_type="probability", k=3, batch_size=64): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depending on the ``...
python
def predict_topk(self, dataset, output_type="probability", k=3, batch_size=64): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depending on the ``...
[ "def", "predict_topk", "(", "self", ",", "dataset", ",", "output_type", "=", "\"probability\"", ",", "k", "=", "3", ",", "batch_size", "=", "64", ")", ":", "if", "not", "isinstance", "(", "dataset", ",", "(", "_tc", ".", "SFrame", ",", "_tc", ".", "S...
Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `id`, `class`, and `probability`, `margin`, or `rank`, depending on the ``output_type`` parameter. Input dataset size must be the same as for training of the model. ...
[ "Return", "top", "-", "k", "predictions", "for", "the", "dataset", "using", "the", "trained", "model", ".", "Predictions", "are", "returned", "as", "an", "SFrame", "with", "three", "columns", ":", "id", "class", "and", "probability", "margin", "or", "rank", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L546-L609
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
ImageClassifier.evaluate
def evaluate(self, dataset, metric='auto', verbose=True, batch_size=64): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include colum...
python
def evaluate(self, dataset, metric='auto', verbose=True, batch_size=64): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include colum...
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "verbose", "=", "True", ",", "batch_size", "=", "64", ")", ":", "import", "os", ",", "json", ",", "math", "if", "(", "batch_size", "<", "1", ")", ":", "raise", "Valu...
Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the target and features used for model training. Additi...
[ "Evaluate", "the", "model", "by", "making", "predictions", "of", "target", "values", "and", "comparing", "these", "to", "actual", "values", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L611-L816
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
ImageClassifier.export_coreml
def export_coreml(self, filename): """ Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('myModel.mlmodel') """ import coremltools # First define three internal helper functions ...
python
def export_coreml(self, filename): """ Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('myModel.mlmodel') """ import coremltools # First define three internal helper functions ...
[ "def", "export_coreml", "(", "self", ",", "filename", ")", ":", "import", "coremltools", "# First define three internal helper functions", "# Internal helper function", "def", "_create_vision_feature_print_scene", "(", ")", ":", "prob_name", "=", "self", ".", "target", "+...
Save the model in Core ML format. See Also -------- save Examples -------- >>> model.export_coreml('myModel.mlmodel')
[ "Save", "the", "model", "in", "Core", "ML", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L824-L1021
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
NetGraph.make_input_layers
def make_input_layers(self): """ Extract the ordering of the input layers. """ self.input_layers = [] in_nodes = self.model._inbound_nodes if hasattr( self.model,'_inbound_nodes') else self.model.inbound_nodes if hasattr(self.model, 'input_layers'): ...
python
def make_input_layers(self): """ Extract the ordering of the input layers. """ self.input_layers = [] in_nodes = self.model._inbound_nodes if hasattr( self.model,'_inbound_nodes') else self.model.inbound_nodes if hasattr(self.model, 'input_layers'): ...
[ "def", "make_input_layers", "(", "self", ")", ":", "self", ".", "input_layers", "=", "[", "]", "in_nodes", "=", "self", ".", "model", ".", "_inbound_nodes", "if", "hasattr", "(", "self", ".", "model", ",", "'_inbound_nodes'", ")", "else", "self", ".", "m...
Extract the ordering of the input layers.
[ "Extract", "the", "ordering", "of", "the", "input", "layers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L148-L179
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
NetGraph.make_output_layers
def make_output_layers(self): """ Extract the ordering of output layers. """ self.output_layers = [] # import pytest; pytest.set_trace() if hasattr(self.model, 'output_layers'): # find corresponding output layers in CoreML model # assume output lay...
python
def make_output_layers(self): """ Extract the ordering of output layers. """ self.output_layers = [] # import pytest; pytest.set_trace() if hasattr(self.model, 'output_layers'): # find corresponding output layers in CoreML model # assume output lay...
[ "def", "make_output_layers", "(", "self", ")", ":", "self", ".", "output_layers", "=", "[", "]", "# import pytest; pytest.set_trace()", "if", "hasattr", "(", "self", ".", "model", ",", "'output_layers'", ")", ":", "# find corresponding output layers in CoreML model", ...
Extract the ordering of output layers.
[ "Extract", "the", "ordering", "of", "output", "layers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L181-L216
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
NetGraph._remove_layer_and_reconnect
def _remove_layer_and_reconnect(self, layer): """ Remove the layer, and reconnect each of its predecessor to each of its successor """ successors = self.get_successors(layer) predecessors = self.get_predecessors(layer) # remove layer's edges for succ in successors...
python
def _remove_layer_and_reconnect(self, layer): """ Remove the layer, and reconnect each of its predecessor to each of its successor """ successors = self.get_successors(layer) predecessors = self.get_predecessors(layer) # remove layer's edges for succ in successors...
[ "def", "_remove_layer_and_reconnect", "(", "self", ",", "layer", ")", ":", "successors", "=", "self", ".", "get_successors", "(", "layer", ")", "predecessors", "=", "self", ".", "get_predecessors", "(", "layer", ")", "# remove layer's edges", "for", "succ", "in"...
Remove the layer, and reconnect each of its predecessor to each of its successor
[ "Remove", "the", "layer", "and", "reconnect", "each", "of", "its", "predecessor", "to", "each", "of", "its", "successor" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L387-L421
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py
NetGraph.defuse_activation
def defuse_activation(self): """ Defuse the fused activation layers in the network. """ idx, nb_layers = 0, len(self.layer_list) while idx < nb_layers: layer = self.layer_list[idx] k_layer = self.keras_layer_map[layer] if (isinstance(k_layer, _keras.la...
python
def defuse_activation(self): """ Defuse the fused activation layers in the network. """ idx, nb_layers = 0, len(self.layer_list) while idx < nb_layers: layer = self.layer_list[idx] k_layer = self.keras_layer_map[layer] if (isinstance(k_layer, _keras.la...
[ "def", "defuse_activation", "(", "self", ")", ":", "idx", ",", "nb_layers", "=", "0", ",", "len", "(", "self", ".", "layer_list", ")", "while", "idx", "<", "nb_layers", ":", "layer", "=", "self", ".", "layer_list", "[", "idx", "]", "k_layer", "=", "s...
Defuse the fused activation layers in the network.
[ "Defuse", "the", "fused", "activation", "layers", "in", "the", "network", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L498-L524
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.date_range
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...
python
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", ")", ":", "if", "not", "isinstance", "(", "start_time", ",", "datetime", ".", "datetime", ")", ":", "raise", "TypeError", "(", "\"The ``start_time`` argument must be from type dateti...
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...
[ "Returns", "a", "new", "SArray", "that", "represents", "a", "fixed", "frequency", "datetime", "index", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L431-L475
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.from_const
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...
python
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", ")", ")", ":", "assert", "isinstance", "(", "size", ",", "(", "int", ",", "long", ")", ")", "and", "size", ">=", "0", ",", "\"size must be a positive ...
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...
[ "Constructs", "an", "SArray", "of", "size", "with", "a", "const", "value", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L478-L508
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.from_sequence
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...
python
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", ")", ":", "start", "=", "None", "stop", "=", "None", "# fill with args. This checks for from_sequence(100), from_sequence(10,100)", "if", "len", "(", "args", ")", "==", "1", ":", "stop", "=", "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: >>> tc.SArray(range(1000)) ...
[ "from_sequence", "(", "start", "=", "0", "stop", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L511-L563
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.read_json
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...
python
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", ")", ":", "proxy", "=", "UnitySArrayProxy", "(", ")", "proxy", ".", "load_from_json_record_files", "(", "_make_internal_url", "(", "filename", ")", ")", "return", "cls", "(", "_proxy", "=", "proxy", ")" ]
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 ----...
[ "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" ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L566-L590
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.where
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...
python
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", ")", ":", "true_is_sarray", "=", "isinstance", "(", "istrue", ",", "SArray", ")", "false_is_sarray", "=", "isinstance", "(", "isfalse", ",", "SArray", ...
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...
[ "Selects", "elements", "from", "either", "istrue", "or", "isfalse", "depending", "on", "the", "value", "of", "the", "condition", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L593-L675
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.save
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "if", "format", "is", "None", ":", "if", "filename", ".", "endswith", "(", "(", "'.csv'", ",", "'.csv.gz'", ...
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...
[ "Saves", "the", "SArray", "to", "file", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L705-L743
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.vector_slice
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 ...
python
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", "(", "self", ".", "dtype", "!=", "array", ".", "array", ")", "and", "(", "self", ".", "dtype", "!=", "list", ")", ":", "raise", "RuntimeError", "(", "\"Only ...
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...
[ "If", "this", "SArray", "contains", "vectors", "or", "lists", "this", "returns", "a", "new", "SArray", "containing", "each", "individual", "element", "sliced", "between", "start", "and", "end", "(", "exclusive", ")", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1370-L1451
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.element_slice
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. ...
python
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", ")", ":", "if", "self", ".", "dtype", "not", "in", "[", "str", ",", "array", ".", "array", ",", "list", "]", ":", "raise", "TypeEr...
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"]) >>> ...
[ "This", "returns", "an", "SArray", "with", "each", "element", "sliced", "accordingly", "to", "the", "slice", "specified", ".", "This", "is", "conceptually", "equivalent", "to", ":" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1453-L1504
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray._count_words
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...
python
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\"", ",", "\" \"", "]", ")", ":", "if", "(", "self", ".", "dtype", "!=", "str", ")", ...
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...
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1506-L1558
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray._count_ngrams
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`...
python
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", ")", ":", "if", "(", "self", ".", "dtype", "!=", "str", ")", ":", "raise", "TypeError", "(", "\...
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.
[ "For", "documentation", "see", "turicreate", ".", "text_analytics", ".", "count_ngrams", "()", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1560-L1594
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.dict_trim_by_keys
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...
python
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", ")", ":", "if", "not", "_is_non_string_iterable", "(", "keys", ")", ":", "keys", "=", "[", "keys", "]", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", ...
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...
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1596-L1635
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.dict_trim_by_values
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 ---------- ...
python
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", ")", ":", "if", "not", "(", "lower", "is", "None", "or", "isinstance", "(", "lower", ",", "numbers", ".", "Number", ")", ")", ":", "raise", "TypeError", ...
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...
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1637-L1686
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.dict_has_any_keys
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``. ...
python
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", ")", ":", "if", "not", "_is_non_string_iterable", "(", "keys", ")", ":", "keys", "=", "[", "keys", "]", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", ...
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...
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1745-L1781
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.dict_has_all_keys
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``. ...
python
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", ")", ":", "if", "not", "_is_non_string_iterable", "(", "keys", ")", ":", "keys", "=", "[", "keys", "]", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", ...
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...
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1783-L1819
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.apply
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 ...
python
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", ")", ":", "assert", "callable", "(", "fn", ")", ",", "\"Input function must be callable.\"", "dryrun", "=", "[", "fn", "(", "i", ...
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...
[ "apply", "(", "fn", "dtype", "=", "None", "skip_na", "=", "True", "seed", "=", "None", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1821-L1920
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.filter
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...
python
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", ")", ":", "assert", "callable", "(", "fn", ")", ",", "\"Input must be callable\"", "if", "seed", "is", "None", ":", "seed", "=", "abs", "(", "hash", "(", ...
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 ...
[ "Filter", "this", "SArray", "by", "a", "function", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1923-L1963
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.sample
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...
python
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", ")", ":", "if", "(", "fraction", ">", "1", "or", "fraction", "<", "0", ")", ":", "raise", "ValueError", "(", "'Invalid sampling rate: '", "+", "str", ...
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 ...
[ "Create", "an", "SArray", "which", "contains", "a", "subsample", "of", "the", "current", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1966-L2006
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.hash
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...
python
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", ")", ":", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "hash", "(", "seed", ")", ")" ]
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...
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2008-L2027
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.random_integers
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)
python
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", ")", ":", "if", "seed", "is", "None", ":", "seed", "=", "abs", "(", "hash", "(", "\"%0.20f\"", "%", "time", ".", "time", "(", ")", ")", ")", "%", "(", "2", "**", "31",...
Returns an SArray with random integer values.
[ "Returns", "an", "SArray", "with", "random", "integer", "values", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2030-L2036
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.argmin
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "if", "len", "(", "self", ")", "==", "0", ":", "return", "None", "if", "not", "any", "(", "[", "isinstance", "(", "self", "[", "0", "]", ",", "i",...
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 ...
[ "Get", "the", "index", "of", "the", "minimum", "numeric", "value", "in", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2201-L2231
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.mean
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...
python
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", ")", ":", "with", "cython_context", "(", ")", ":", "if", "self", ".", "dtype", "==", "_Image", ":", "from", ".", ".", "import", "extensions", "return", "extensions", ".", "generate_mean", "(", "self", ")", "else", ":", "retu...
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...
[ "Mean", "of", "all", "the", "values", "in", "the", "SArray", "or", "mean", "image", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2252-L2270
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.datetime_to_str
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 "...
python
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\"", ")", ":", "if", "(", "self", ".", "dtype", "!=", "datetime", ".", "datetime", ")", ":", "raise", "TypeError", "(", "\"datetime_to_str expects SArray of datetime as input SArray\"", ...
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[...
[ "Create", "a", "new", "SArray", "with", "all", "the", "values", "cast", "to", "str", ".", "The", "string", "format", "is", "specified", "by", "the", "format", "parameter", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2338-L2375
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.str_to_datetime
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 ...
python
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\"", ")", ":", "if", "(", "self", ".", "dtype", "!=", "str", ")", ":", "raise", "TypeError", "(", "\"str_to_datetime expects SArray of str as input SArray\"", ")", "with", "cython_cont...
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...
[ "Create", "a", "new", "SArray", "with", "all", "the", "values", "cast", "to", "datetime", ".", "The", "string", "format", "is", "specified", "by", "the", "format", "parameter", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2377-L2413
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.pixel_array_to_image
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...
python
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", ")", ":", "if", "(", "self", ".", "dtype", "!=", "array", ".", "array", ")", ":", "ra...
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...
[ "Create", "a", "new", "SArray", "with", "all", "the", "values", "cast", "to", ":", "py", ":", "class", ":", "turicreate", ".", "image", ".", "Image", "of", "uniform", "size", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2415-L2478
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.astype
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...
python
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", ")", ":", "if", "(", "dtype", "==", "_Image", ")", "and", "(", "self", ".", "dtype", "==", "array", ".", "array", ")", ":", "raise", "TypeError", "(", "\"Cannot cast...
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...
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2480-L2531
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.clip
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 ...
python
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'", ")", ")", ":", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "cli...
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 ...
[ "Create", "a", "new", "SArray", "with", "each", "value", "clipped", "to", "be", "within", "the", "given", "bounds", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2533-L2573
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.clip_lower
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...
python
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", ")", ":", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "clip", "(", "threshold", ",", "float", "(", "'nan'", ")", ")", ")" ]
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...
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2575-L2604
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.tail
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...
python
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", ")", ":", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "tail", "(", "n", ")", ")" ]
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.
[ "Get", "an", "SArray", "that", "contains", "the", "last", "n", "elements", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2637-L2652
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.fillna
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...
python
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", ")", ":", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "fill_missing_values", "(", "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 attempt to convert the value to the original SAr...
[ "Create", "new", "SArray", "with", "all", "missing", "values", "(", "None", "or", "NaN", ")", "filled", "in", "with", "the", "given", "value", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2673-L2695
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.is_topk
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...
python
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", ")", ":", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "topk_index", "(", "topk", ",", "reverse", ...
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...
[ "Create", "an", "SArray", "indicating", "which", "elements", "are", "in", "the", "top", "k", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2697-L2722
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.summary
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...
python
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", ")", ":", "from", ".", ".", "data_structures", ".", "sketch", "import", "Sketch", "if", "(", "self", ".", "dtype", "==", "_Image", ")", ":", "raise", "...
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...
[ "Summary", "statistics", "that", "can", "be", "calculated", "with", "one", "pass", "over", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2724-L2775
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.value_counts
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "return", "_SFrame", "(", "{", "'value'", ":", "self", "}", ")", ".", "groupby", "(", "'value'", ",", "{", "'count'", ":", "_aggregate", ".", "COU...
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...
[ "Return", "an", "SFrame", "containing", "counts", "of", "unique", "values", ".", "The", "resulting", "SFrame", "will", "be", "sorted", "in", "descending", "frequency", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2777-L2811
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.append
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. ...
python
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", ")", ":", "if", "type", "(", "other", ")", "is", "not", "SArray", ":", "raise", "RuntimeError", "(", "\"SArray append can only work with SArray\"", ")", "if", "self", ".", "dtype", "!=", "other", ".", "dtype", ":...
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 : ...
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2814-L2850
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.unique
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 ...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "tmp_sf", "=", "_SFrame", "(", ")", "tmp_sf", ".", "add_column", "(", "self", ",", "'X1'", ",", "inplace", "=", "True", ")", "res", "=", "tmp_sf", "."...
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...
[ "Get", "all", "unique", "values", "in", "the", "current", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2852-L2876
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.show
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...
python
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", ")", ":", "returned_plot", "=", "self", ".", "plot", "(", "title", ",", "xlabel", ",", "ylabel", ")", "returned_plot",...
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 ...
[ "Visualize", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2905-L2946
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.plot
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 ...
python
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", ")", ":", "if", "title", "==", "\"\"", ":", "title", "=", "\" \"", "if", "xlabel", "==", "\"\"", ":", "xlabel", "=...
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 -------...
[ "Create", "a", "Plot", "object", "representing", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2948-L3006
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.item_length
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:...
python
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", ")", ":", "if", "(", "self", ".", "dtype", "not", "in", "[", "list", ",", "dict", ",", "array", ".", "array", "]", ")", ":", "raise", "TypeError", "(", "\"item_length() is only applicable for SArray of type list, dict and array...
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...
[ "Length", "of", "each", "element", "in", "the", "current", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3008-L3043
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.random_split
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "temporary_sf", "=", "SFrame", "(", ")", "temporary_sf", "[", "'X1'", "]", "=", "self", "(", "train", ",", "test", ")", ...
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 ...
[ "Randomly", "split", "the", "rows", "of", "an", "SArray", "into", "two", "SArrays", ".", "The", "first", "SArray", "contains", "*", "M", "*", "rows", "sampled", "uniformly", "(", "without", "replacement", ")", "from", "the", "original", "SArray", ".", "*",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3045-L3081
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.split_datetime
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "if", "self", ".", "dtype", "!=", "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...
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3083-L3217
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.stack
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "return", "_SFrame", "(", "{", "'SArray'", ":", "se...
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...
[ "Convert", "a", "wide", "SArray", "to", "one", "or", "two", "tall", "columns", "in", "an", "SFrame", "by", "stacking", "all", "values", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3219-L3294
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.unpack
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "if", "self", ".", "...
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...
[ "Convert", "an", "SArray", "of", "list", "array", "or", "dict", "type", "to", "an", "SFrame", "with", "multiple", "columns", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3296-L3493
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.sort
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "if", "self", ".", "dtype", "not", "in", "(", "int", ",", "float", ",", "str", ",", "datetime", ".", "datetime", ")", "...
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...
[ "Sort", "all", "values", "in", "this", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3495-L3526
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.rolling_sum
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...
python
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", ")", ":", "min_observations", "=", "self", ".", "__check_min_observations", "(", "min_observations", ")", "agg_op", "=", "None", "if", "self", ".", ...
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...
[ "Calculate", "a", "new", "SArray", "of", "the", "sum", "of", "different", "subsets", "over", "this", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3640-L3743
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.rolling_max
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...
python
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", ")", ":", "min_observations", "=", "self", ".", "__check_min_observations", "(", "min_observations", ")", "agg_op", "=", "'__builtin__max__'", "return", ...
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 ...
[ "Calculate", "a", "new", "SArray", "of", "the", "maximum", "value", "of", "different", "subsets", "over", "this", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3745-L3843
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.rolling_count
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...
python
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", ")", ":", "agg_op", "=", "'__builtin__nonnull__count__'", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_rolling_apply", "(", "agg_op", ",", "window_start...
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...
[ "Count", "the", "number", "of", "non", "-", "NULL", "values", "of", "different", "subsets", "over", "this", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4146-L4221
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.cumulative_sum
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...
python
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", ")", ":", "from", ".", ".", "import", "extensions", "agg_op", "=", "\"__builtin__cum_sum__\"", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_cumulative_aggregate", "(", "agg_op", ")", ")" ]
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 ------...
[ "Return", "the", "cumulative", "sum", "of", "the", "elements", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4223-L4252
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.cumulative_mean
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...
python
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", ")", ":", "from", ".", ".", "import", "extensions", "agg_op", "=", "\"__builtin__cum_avg__\"", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_cumulative_aggregate", "(", "agg_op", ")", ")" ]
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...
[ "Return", "the", "cumulative", "mean", "of", "the", "elements", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4254-L4284
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.cumulative_min
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,...
python
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", ")", ":", "from", ".", ".", "import", "extensions", "agg_op", "=", "\"__builtin__cum_min__\"", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_cumulative_aggregate", "(", "agg_op", ")", ")" ]
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 ------- ...
[ "Return", "the", "cumulative", "minimum", "value", "of", "the", "elements", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4286-L4313
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.cumulative_max
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,...
python
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", ")", ":", "from", ".", ".", "import", "extensions", "agg_op", "=", "\"__builtin__cum_max__\"", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_cumulative_aggregate", "(", "agg_op", ")", ")" ]
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 ------- ...
[ "Return", "the", "cumulative", "maximum", "value", "of", "the", "elements", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4315-L4342
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.cumulative_std
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 ...
python
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", ")", ":", "from", ".", ".", "import", "extensions", "agg_op", "=", "\"__builtin__cum_std__\"", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_cumulative_aggregate", "(", "agg_op", ")", ")" ]
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...
[ "Return", "the", "cumulative", "standard", "deviation", "of", "the", "elements", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4344-L4371
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.cumulative_var
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...
python
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", ")", ":", "from", ".", ".", "import", "extensions", "agg_op", "=", "\"__builtin__cum_var__\"", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_cumulative_aggregate", "(", "agg_op", ")", ")" ]
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 ------- ...
[ "Return", "the", "cumulative", "variance", "of", "the", "elements", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4373-L4400
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
SArray.filter_by
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...
python
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", ")", ":", "from", ".", "sframe", "import", "SFrame", "as", "_SFrame", "column_name", "=", "'sarray'", "# Convert values to SArray", "if", "not", "isinstance", "(", "values", ",", "...
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 ---------- ...
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4402-L4480
train
apple/turicreate
src/external/xgboost/subtree/rabit/doc/conf.py
run_build_lib
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...
python
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", ")", ":", "try", ":", "retcode", "=", "subprocess", ".", "call", "(", "\"cd %s; make\"", "%", "folder", ",", "shell", "=", "True", ")", "retcode", "=", "subprocess", ".", "call", "(", "\"rm -rf _build/html/doxygen\"", "...
Run the doxygen make command in the designated folder.
[ "Run", "the", "doxygen", "make", "command", "in", "the", "designated", "folder", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/doc/conf.py#L153-L164
train
apple/turicreate
src/external/xgboost/subtree/rabit/doc/conf.py
generate_doxygen_xml
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('..') ...
python
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", ")", ":", "read_the_docs_build", "=", "os", ".", "environ", ".", "get", "(", "'READTHEDOCS'", ",", "None", ")", "==", "'True'", "if", "read_the_docs_build", ":", "run_doxygen", "(", "'..'", ")", "sys", ".", "stderr"...
Run the doxygen make commands if we're on the ReadTheDocs server
[ "Run", "the", "doxygen", "make", "commands", "if", "we", "re", "on", "the", "ReadTheDocs", "server" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/doc/conf.py#L167-L175
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
MessageToJson
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...
python
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", ")", ":", "printer", "=", "_Printer", "(", "including_default_value_fields", ",", "preserving_proto_field_name", ")", "return", ...
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...
[ "Converts", "protobuf", "message", "to", "JSON", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L89-L109
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
MessageToDict
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...
python
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", ")", ":", "printer", "=", "_Printer", "(", "including_default_value_fields", ",", "preserving_proto_field_name", ")", "# pylint: ...
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...
[ "Converts", "protobuf", "message", "to", "a", "JSON", "dictionary", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L112-L133
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
ParseDict
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...
python
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", ")", ":", "parser", "=", "_Parser", "(", "ignore_unknown_fields", ")", "parser", ".", "ConvertMessage", "(", "js_dict", ",", "message", ")", "return", "message" ]
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.
[ "Parses", "a", "JSON", "dictionary", "representation", "into", "a", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L372-L385
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_ConvertScalarFieldValue
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 ...
python
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", ")", ":", "if", "field", ".", "cpp_type", "in", "_INT_TYPES", ":", "return", "_ConvertInteger", "(", "value", ")", "elif", "field", ".", "cpp_type", "in", "_FLOA...
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.
[ "Convert", "a", "single", "scalar", "field", "value", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L606-L648
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_ConvertInteger
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...
python
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", ")", ":", "if", "isinstance", "(", "value", ",", "float", ")", "and", "not", "value", ".", "is_integer", "(", ")", ":", "raise", "ParseError", "(", "'Couldn\\'t parse integer: {0}.'", ".", "format", "(", "value", ")", ...
Convert an integer. Args: value: A scalar value to convert. Returns: The integer value. Raises: ParseError: If an integer couldn't be consumed.
[ "Convert", "an", "integer", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L651-L669
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_ConvertFloat
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: ...
python
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", ")", ":", "if", "value", "==", "'nan'", ":", "raise", "ParseError", "(", "'Couldn\\'t parse float \"nan\", use \"NaN\" instead.'", ")", "try", ":", "# Assume Python compatible syntax.", "return", "float", "(", "value", ")", "excep...
Convert an floating point number.
[ "Convert", "an", "floating", "point", "number", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L672-L688
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_ConvertBool
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...
python
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", ")", ":", "if", "require_str", ":", "if", "value", "==", "'true'", ":", "return", "True", "elif", "value", "==", "'false'", ":", "return", "False", "else", ":", "raise", "ParseError", "(", "'Expected...
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.
[ "Convert", "a", "boolean", "value", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L691-L714
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Printer._MessageToJsonObject
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...
python
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", ")", ":", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "full_name", "=", "message_descriptor", ".", "full_name", "if", "_IsWrapperMessage", "(", "message_descriptor", ")", ":", "return", "self",...
Converts message to an object according to Proto3 JSON Specification.
[ "Converts", "message", "to", "an", "object", "according", "to", "Proto3", "JSON", "Specification", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L155-L164
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Printer._RegularMessageToJsonObject
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...
python
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", ")", ":", "fields", "=", "message", ".", "ListFields", "(", ")", "try", ":", "for", "field", ",", "value", "in", "fields", ":", "if", "self", ".", "preserving_proto_field_name", ...
Converts normal message according to Proto3 JSON Specification.
[ "Converts", "normal", "message", "according", "to", "Proto3", "JSON", "Specification", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L166-L225
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Printer._FieldToJsonObject
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...
python
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", ")", ":", "if", "field", ".", "cpp_type", "==", "descriptor", ".", "FieldDescriptor", ".", "CPPTYPE_MESSAGE", ":", "return", "self", ".", "_MessageToJsonObject", "(", "value", ")", "elif", ...
Converts field value according to Proto3 JSON Specification.
[ "Converts", "field", "value", "according", "to", "Proto3", "JSON", "Specification", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L227-L256
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Printer._AnyMessageToJsonObject
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...
python
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", ")", ":", "if", "not", "message", ".", "ListFields", "(", ")", ":", "return", "{", "}", "# Must print @type first, use OrderedDict instead of {}", "js", "=", "OrderedDict", "(", ")", "type_url", "=", ...
Converts Any message according to Proto3 JSON Specification.
[ "Converts", "Any", "message", "according", "to", "Proto3", "JSON", "Specification", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L258-L277
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Printer._ValueMessageToJsonObject
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...
python
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", ")", ":", "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...
Converts Value message according to Proto3 JSON Specification.
[ "Converts", "Value", "message", "according", "to", "Proto3", "JSON", "Specification", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L285-L299
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Printer._StructMessageToJsonObject
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
python
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", ")", ":", "fields", "=", "message", ".", "fields", "ret", "=", "{", "}", "for", "key", "in", "fields", ":", "ret", "[", "key", "]", "=", "self", ".", "_ValueMessageToJsonObject", "(", "fie...
Converts Struct message according to Proto3 JSON Specification.
[ "Converts", "Struct", "message", "according", "to", "Proto3", "JSON", "Specification", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L306-L312
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Parser.ConvertMessage
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...
python
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", ")", ":", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "full_name", "=", "message_descriptor", ".", "full_name", "if", "_IsWrapperMessage", "(", "message_descriptor", ")", ":", "self",...
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.
[ "Convert", "a", "JSON", "object", "into", "a", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L398-L415
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Parser._ConvertFieldValuePair
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 = [] ...
python
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", ")", ":", "names", "=", "[", "]", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "fields_by_json_name", "=", "dict", "(", "(", "f", ".", "json_name", ",", "f", ")", "for", ...
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.
[ "Convert", "field", "value", "pairs", "into", "regular", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L417-L507
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Parser._ConvertAnyMessage
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...
python
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", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", "and", "not", "value", ":", "return", "try", ":", "type_url", "=", "value", "[", "'@type'", "]", "except", "KeyError", ...
Convert a JSON representation into Any message.
[ "Convert", "a", "JSON", "representation", "into", "Any", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L509-L531
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Parser._ConvertWrapperMessage
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))
python
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", ")", ":", "field", "=", "message", ".", "DESCRIPTOR", ".", "fields_by_name", "[", "'value'", "]", "setattr", "(", "message", ",", "'value'", ",", "_ConvertScalarFieldValue", "(", "valu...
Convert a JSON representation into Wrapper message.
[ "Convert", "a", "JSON", "representation", "into", "Wrapper", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L574-L577
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py
_Parser._ConvertMapFieldValue
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:...
python
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", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "ParseError", "(", "'Map field {0} must be in a dict which is {1}.'", ".", "format", "(", ...
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.
[ "Convert", "map", "field", "value", "for", "a", "message", "map", "field", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L579-L603
train
apple/turicreate
src/unity/python/turicreate/visualization/show.py
plot
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...
python
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", ")", ":", "title", "=", "_get_title", "(", "title", ")", "plt_ref", "=", "tc", ".", "extensions", ".", "plo...
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...
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L20-L81
train
apple/turicreate
src/unity/python/turicreate/visualization/show.py
show
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...
python
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", ")", ":", "plot", "(", "x", ",", "y", ",", "xlabel", ",", "ylabel", ",", "title", ")", ".", "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...
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L83-L143
train
apple/turicreate
src/unity/python/turicreate/visualization/show.py
scatter
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 -------...
python
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", ")", ":", "if", "(", "not", "isinstance", "(", "x", ",", "tc", ".", "data_structures", ".", "sarray", "....
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...
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L145-L193
train
apple/turicreate
src/unity/python/turicreate/visualization/show.py
categorical_heatmap
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 ...
python
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", ")", ":", "if", "(", "not", "isinstance", "(", "x", ",", "tc", ".", "data_structures", ".", "s...
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...
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L195-L242
train