partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
glob
Returns the list of files matching the given pattern in the specified directory. Both directories and patterns are supplied as portable paths. Each pattern should be non-absolute path, and can't contain "." or ".." elements. Each slash separated element of pattern can contain the following special char...
deps/src/boost_1_68_0/tools/build/src/util/path.py
def glob (dirs, patterns): """ Returns the list of files matching the given pattern in the specified directory. Both directories and patterns are supplied as portable paths. Each pattern should be non-absolute path, and can't contain "." or ".." elements. Each slash separated element of pattern can...
def glob (dirs, patterns): """ Returns the list of files matching the given pattern in the specified directory. Both directories and patterns are supplied as portable paths. Each pattern should be non-absolute path, and can't contain "." or ".." elements. Each slash separated element of pattern can...
[ "Returns", "the", "list", "of", "files", "matching", "the", "given", "pattern", "in", "the", "specified", "directory", ".", "Both", "directories", "and", "patterns", "are", "supplied", "as", "portable", "paths", ".", "Each", "pattern", "should", "be", "non", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L260-L338
[ "def", "glob", "(", "dirs", ",", "patterns", ")", ":", "# {", "# local result ;", "# if $(patterns:D)", "# {", "# # When a pattern has a directory element, we first glob for", "# # directory, and then glob for file name is the found directories.", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
glob
Returns the list of files matching the given pattern in the specified directory. Both directories and patterns are supplied as portable paths. Each pattern should be non-absolute path, and can't contain '.' or '..' elements. Each slash separated element of pattern can contain the following special char...
deps/src/boost_1_68_0/tools/build/src/util/path.py
def glob(dirs, patterns, exclude_patterns=None): """Returns the list of files matching the given pattern in the specified directory. Both directories and patterns are supplied as portable paths. Each pattern should be non-absolute path, and can't contain '.' or '..' elements. Each slash separated e...
def glob(dirs, patterns, exclude_patterns=None): """Returns the list of files matching the given pattern in the specified directory. Both directories and patterns are supplied as portable paths. Each pattern should be non-absolute path, and can't contain '.' or '..' elements. Each slash separated e...
[ "Returns", "the", "list", "of", "files", "matching", "the", "given", "pattern", "in", "the", "specified", "directory", ".", "Both", "directories", "and", "patterns", "are", "supplied", "as", "portable", "paths", ".", "Each", "pattern", "should", "be", "non", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L839-L870
[ "def", "glob", "(", "dirs", ",", "patterns", ",", "exclude_patterns", "=", "None", ")", ":", "assert", "(", "isinstance", "(", "patterns", ",", "list", ")", ")", "assert", "(", "isinstance", "(", "dirs", ",", "list", ")", ")", "if", "not", "exclude_pat...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
glob_tree
Recursive version of GLOB. Builds the glob of files while also searching in the subdirectories of the given roots. An optional set of exclusion patterns will filter out the matching entries from the result. The exclusions also apply to the subdirectory scanning, such that directories that match the ...
deps/src/boost_1_68_0/tools/build/src/util/path.py
def glob_tree(roots, patterns, exclude_patterns=None): """Recursive version of GLOB. Builds the glob of files while also searching in the subdirectories of the given roots. An optional set of exclusion patterns will filter out the matching entries from the result. The exclusions also apply to the su...
def glob_tree(roots, patterns, exclude_patterns=None): """Recursive version of GLOB. Builds the glob of files while also searching in the subdirectories of the given roots. An optional set of exclusion patterns will filter out the matching entries from the result. The exclusions also apply to the su...
[ "Recursive", "version", "of", "GLOB", ".", "Builds", "the", "glob", "of", "files", "while", "also", "searching", "in", "the", "subdirectories", "of", "the", "given", "roots", ".", "An", "optional", "set", "of", "exclusion", "patterns", "will", "filter", "out...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L872-L888
[ "def", "glob_tree", "(", "roots", ",", "patterns", ",", "exclude_patterns", "=", "None", ")", ":", "if", "not", "exclude_patterns", ":", "exclude_patterns", "=", "[", "]", "result", "=", "glob", "(", "roots", ",", "patterns", ",", "exclude_patterns", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
glob_in_parents
Recursive version of GLOB which glob sall parent directories of dir until the first match is found. Returns an empty result if no match is found
deps/src/boost_1_68_0/tools/build/src/util/path.py
def glob_in_parents(dir, patterns, upper_limit=None): """Recursive version of GLOB which glob sall parent directories of dir until the first match is found. Returns an empty result if no match is found""" assert(isinstance(dir, str)) assert(isinstance(patterns, list)) result = [] absolute...
def glob_in_parents(dir, patterns, upper_limit=None): """Recursive version of GLOB which glob sall parent directories of dir until the first match is found. Returns an empty result if no match is found""" assert(isinstance(dir, str)) assert(isinstance(patterns, list)) result = [] absolute...
[ "Recursive", "version", "of", "GLOB", "which", "glob", "sall", "parent", "directories", "of", "dir", "until", "the", "first", "match", "is", "found", ".", "Returns", "an", "empty", "result", "if", "no", "match", "is", "found" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L890-L911
[ "def", "glob_in_parents", "(", "dir", ",", "patterns", ",", "upper_limit", "=", "None", ")", ":", "assert", "(", "isinstance", "(", "dir", ",", "str", ")", ")", "assert", "(", "isinstance", "(", "patterns", ",", "list", ")", ")", "result", "=", "[", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_wrap_function_return
Recursively walks each thing in val, opening lists and dictionaries, converting all occurrences of UnityGraphProxy to an SGraph, UnitySFrameProxy to SFrame, and UnitySArrayProxy to SArray.
src/unity/python/turicreate/extensions.py
def _wrap_function_return(val): """ Recursively walks each thing in val, opening lists and dictionaries, converting all occurrences of UnityGraphProxy to an SGraph, UnitySFrameProxy to SFrame, and UnitySArrayProxy to SArray. """ if type(val) is _UnityGraphProxy: return _SGraph(_proxy = ...
def _wrap_function_return(val): """ Recursively walks each thing in val, opening lists and dictionaries, converting all occurrences of UnityGraphProxy to an SGraph, UnitySFrameProxy to SFrame, and UnitySArrayProxy to SArray. """ if type(val) is _UnityGraphProxy: return _SGraph(_proxy = ...
[ "Recursively", "walks", "each", "thing", "in", "val", "opening", "lists", "and", "dictionaries", "converting", "all", "occurrences", "of", "UnityGraphProxy", "to", "an", "SGraph", "UnitySFrameProxy", "to", "SFrame", "and", "UnitySArrayProxy", "to", "SArray", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L82-L107
[ "def", "_wrap_function_return", "(", "val", ")", ":", "if", "type", "(", "val", ")", "is", "_UnityGraphProxy", ":", "return", "_SGraph", "(", "_proxy", "=", "val", ")", "elif", "type", "(", "val", ")", "is", "_UnitySFrameProxy", ":", "return", "_SFrame", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_setattr_wrapper
A setattr wrapper call used only by _publish(). This ensures that anything published into this module is also published into tc.extensions
src/unity/python/turicreate/extensions.py
def _setattr_wrapper(mod, key, value): """ A setattr wrapper call used only by _publish(). This ensures that anything published into this module is also published into tc.extensions """ setattr(mod, key, value) if mod == _thismodule: setattr(_sys.modules[__name__], key, value)
def _setattr_wrapper(mod, key, value): """ A setattr wrapper call used only by _publish(). This ensures that anything published into this module is also published into tc.extensions """ setattr(mod, key, value) if mod == _thismodule: setattr(_sys.modules[__name__], key, value)
[ "A", "setattr", "wrapper", "call", "used", "only", "by", "_publish", "()", ".", "This", "ensures", "that", "anything", "published", "into", "this", "module", "is", "also", "published", "into", "tc", ".", "extensions" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L109-L116
[ "def", "_setattr_wrapper", "(", "mod", ",", "key", ",", "value", ")", ":", "setattr", "(", "mod", ",", "key", ",", "value", ")", "if", "mod", "==", "_thismodule", ":", "setattr", "(", "_sys", ".", "modules", "[", "__name__", "]", ",", "key", ",", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_run_toolkit_function
Dispatches arguments to a toolkit function. Parameters ---------- fnname : string The toolkit function to run arguments : list[string] The list of all the arguments the function takes. args : list The arguments that were passed kwargs : dictionary The keyword ...
src/unity/python/turicreate/extensions.py
def _run_toolkit_function(fnname, arguments, args, kwargs): """ Dispatches arguments to a toolkit function. Parameters ---------- fnname : string The toolkit function to run arguments : list[string] The list of all the arguments the function takes. args : list The ...
def _run_toolkit_function(fnname, arguments, args, kwargs): """ Dispatches arguments to a toolkit function. Parameters ---------- fnname : string The toolkit function to run arguments : list[string] The list of all the arguments the function takes. args : list The ...
[ "Dispatches", "arguments", "to", "a", "toolkit", "function", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L118-L167
[ "def", "_run_toolkit_function", "(", "fnname", ",", "arguments", ",", "args", ",", "kwargs", ")", ":", "# scan for all the arguments in args", "num_args_got", "=", "len", "(", "args", ")", "+", "len", "(", "kwargs", ")", "num_args_required", "=", "len", "(", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_class_instance_from_name
class_name is of the form modA.modB.modC.class module_path splits on "." and the import_path is then ['modA','modB','modC'] the __import__ call is really annoying but essentially it reads like: import class from modA.modB.modC - Then the module variable points to modC - Then you get the class from...
src/unity/python/turicreate/extensions.py
def _class_instance_from_name(class_name, *arg, **kwarg): """ class_name is of the form modA.modB.modC.class module_path splits on "." and the import_path is then ['modA','modB','modC'] the __import__ call is really annoying but essentially it reads like: import class from modA.modB.modC - The...
def _class_instance_from_name(class_name, *arg, **kwarg): """ class_name is of the form modA.modB.modC.class module_path splits on "." and the import_path is then ['modA','modB','modC'] the __import__ call is really annoying but essentially it reads like: import class from modA.modB.modC - The...
[ "class_name", "is", "of", "the", "form", "modA", ".", "modB", ".", "modC", ".", "class", "module_path", "splits", "on", ".", "and", "the", "import_path", "is", "then", "[", "modA", "modB", "modC", "]", "the", "__import__", "call", "is", "really", "annoyi...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L172-L190
[ "def", "_class_instance_from_name", "(", "class_name", ",", "*", "arg", ",", "*", "*", "kwarg", ")", ":", "# we first look in tc.extensions for the class name", "module_path", "=", "class_name", ".", "split", "(", "'.'", ")", "import_path", "=", "module_path", "[", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_create_class_instance
Look for the class in .extensions in case it has already been imported (perhaps as a builtin extensions hard compiled into unity_server).
src/unity/python/turicreate/extensions.py
def _create_class_instance(class_name, _proxy): """ Look for the class in .extensions in case it has already been imported (perhaps as a builtin extensions hard compiled into unity_server). """ try: return _class_instance_from_name('turicreate.extensions.' + class_name, _proxy=_proxy) ex...
def _create_class_instance(class_name, _proxy): """ Look for the class in .extensions in case it has already been imported (perhaps as a builtin extensions hard compiled into unity_server). """ try: return _class_instance_from_name('turicreate.extensions.' + class_name, _proxy=_proxy) ex...
[ "Look", "for", "the", "class", "in", ".", "extensions", "in", "case", "it", "has", "already", "been", "imported", "(", "perhaps", "as", "a", "builtin", "extensions", "hard", "compiled", "into", "unity_server", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L192-L201
[ "def", "_create_class_instance", "(", "class_name", ",", "_proxy", ")", ":", "try", ":", "return", "_class_instance_from_name", "(", "'turicreate.extensions.'", "+", "class_name", ",", "_proxy", "=", "_proxy", ")", "except", ":", "pass", "return", "_class_instance_f...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_publish
Publishes all functions and classes registered in unity_server. The functions and classes will appear in the module turicreate.extensions
src/unity/python/turicreate/extensions.py
def _publish(): import copy """ Publishes all functions and classes registered in unity_server. The functions and classes will appear in the module turicreate.extensions """ unity = _get_unity() fnlist = unity.list_toolkit_functions() # Loop through all the functions and inject it into ...
def _publish(): import copy """ Publishes all functions and classes registered in unity_server. The functions and classes will appear in the module turicreate.extensions """ unity = _get_unity() fnlist = unity.list_toolkit_functions() # Loop through all the functions and inject it into ...
[ "Publishes", "all", "functions", "and", "classes", "registered", "in", "unity_server", ".", "The", "functions", "and", "classes", "will", "appear", "in", "the", "module", "turicreate", ".", "extensions" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L319-L396
[ "def", "_publish", "(", ")", ":", "import", "copy", "unity", "=", "_get_unity", "(", ")", "fnlist", "=", "unity", ".", "list_toolkit_functions", "(", ")", "# Loop through all the functions and inject it into", "# turicreate.extensions.[blah]", "# Note that [blah] may be som...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ext_import
Loads a turicreate toolkit module (a shared library) into the tc.extensions namespace. Toolkit module created via SDK can either be directly imported, e.g. ``import example`` or via this function, e.g. ``turicreate.ext_import("example.so")``. Use ``ext_import`` when you need more namespace control, or ...
src/unity/python/turicreate/extensions.py
def ext_import(soname, module_subpath=""): """ Loads a turicreate toolkit module (a shared library) into the tc.extensions namespace. Toolkit module created via SDK can either be directly imported, e.g. ``import example`` or via this function, e.g. ``turicreate.ext_import("example.so")``. Use `...
def ext_import(soname, module_subpath=""): """ Loads a turicreate toolkit module (a shared library) into the tc.extensions namespace. Toolkit module created via SDK can either be directly imported, e.g. ``import example`` or via this function, e.g. ``turicreate.ext_import("example.so")``. Use `...
[ "Loads", "a", "turicreate", "toolkit", "module", "(", "a", "shared", "library", ")", "into", "the", "tc", ".", "extensions", "namespace", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L501-L584
[ "def", "ext_import", "(", "soname", ",", "module_subpath", "=", "\"\"", ")", ":", "unity", "=", "_get_unity", "(", ")", "import", "os", "if", "os", ".", "path", ".", "exists", "(", "soname", ")", ":", "soname", "=", "os", ".", "path", ".", "abspath",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_argument_list_from_toolkit_function_name
Given a toolkit function name, return the argument list
src/unity/python/turicreate/extensions.py
def _get_argument_list_from_toolkit_function_name(fn): """ Given a toolkit function name, return the argument list """ unity = _get_unity() fnprops = unity.describe_toolkit_function(fn) argnames = fnprops['arguments'] return argnames
def _get_argument_list_from_toolkit_function_name(fn): """ Given a toolkit function name, return the argument list """ unity = _get_unity() fnprops = unity.describe_toolkit_function(fn) argnames = fnprops['arguments'] return argnames
[ "Given", "a", "toolkit", "function", "name", "return", "the", "argument", "list" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L602-L609
[ "def", "_get_argument_list_from_toolkit_function_name", "(", "fn", ")", ":", "unity", "=", "_get_unity", "(", ")", "fnprops", "=", "unity", ".", "describe_toolkit_function", "(", "fn", ")", "argnames", "=", "fnprops", "[", "'arguments'", "]", "return", "argnames" ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_descend_namespace
Given a globals dictionary, and a name of the form "a.b.c.d", recursively walk the globals expanding caller_globals['a']['b']['c']['d'] returning the result. Raises an exception (IndexError) on failure.
src/unity/python/turicreate/extensions.py
def _descend_namespace(caller_globals, name): """ Given a globals dictionary, and a name of the form "a.b.c.d", recursively walk the globals expanding caller_globals['a']['b']['c']['d'] returning the result. Raises an exception (IndexError) on failure. """ names = name.split('.') cur = call...
def _descend_namespace(caller_globals, name): """ Given a globals dictionary, and a name of the form "a.b.c.d", recursively walk the globals expanding caller_globals['a']['b']['c']['d'] returning the result. Raises an exception (IndexError) on failure. """ names = name.split('.') cur = call...
[ "Given", "a", "globals", "dictionary", "and", "a", "name", "of", "the", "form", "a", ".", "b", ".", "c", ".", "d", "recursively", "walk", "the", "globals", "expanding", "caller_globals", "[", "a", "]", "[", "b", "]", "[", "c", "]", "[", "d", "]", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L639-L652
[ "def", "_descend_namespace", "(", "caller_globals", ",", "name", ")", ":", "names", "=", "name", ".", "split", "(", "'.'", ")", "cur", "=", "caller_globals", "for", "i", "in", "names", ":", "if", "type", "(", "cur", ")", "is", "dict", ":", "cur", "="...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_build_native_function_call
If fn can be interpreted and handled as a native function: i.e. fn is one of the extensions, or fn is a simple lambda closure using one of the extensions. fn = tc.extensions.add fn = lambda x: tc.extensions.add(5) Then, this returns a closure object, which describes the function call whi...
src/unity/python/turicreate/extensions.py
def _build_native_function_call(fn): """ If fn can be interpreted and handled as a native function: i.e. fn is one of the extensions, or fn is a simple lambda closure using one of the extensions. fn = tc.extensions.add fn = lambda x: tc.extensions.add(5) Then, this returns a closure ...
def _build_native_function_call(fn): """ If fn can be interpreted and handled as a native function: i.e. fn is one of the extensions, or fn is a simple lambda closure using one of the extensions. fn = tc.extensions.add fn = lambda x: tc.extensions.add(5) Then, this returns a closure ...
[ "If", "fn", "can", "be", "interpreted", "and", "handled", "as", "a", "native", "function", ":", "i", ".", "e", ".", "fn", "is", "one", "of", "the", "extensions", "or", "fn", "is", "a", "simple", "lambda", "closure", "using", "one", "of", "the", "exte...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L654-L734
[ "def", "_build_native_function_call", "(", "fn", ")", ":", "# See if fn is the native function itself", "native_function_name", "=", "_get_toolkit_function_name_from_function", "(", "fn", ")", "if", "native_function_name", "!=", "\"\"", ":", "# yup!", "# generate an \"identity\...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_ExtMetaPath.find_module
We have to see if fullname refers to a module we can import. Some care is needed here because: import xxx # tries to load xxx.so from any of the python import paths import aaa.bbb.xxx # tries to load aaa/bbb/xxx.so from any of the python import paths
src/unity/python/turicreate/extensions.py
def find_module(self, fullname, submodule_path=None): """ We have to see if fullname refers to a module we can import. Some care is needed here because: import xxx # tries to load xxx.so from any of the python import paths import aaa.bbb.xxx # tries to load aaa/bbb/xxx.so from...
def find_module(self, fullname, submodule_path=None): """ We have to see if fullname refers to a module we can import. Some care is needed here because: import xxx # tries to load xxx.so from any of the python import paths import aaa.bbb.xxx # tries to load aaa/bbb/xxx.so from...
[ "We", "have", "to", "see", "if", "fullname", "refers", "to", "a", "module", "we", "can", "import", ".", "Some", "care", "is", "needed", "here", "because", ":" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L409-L450
[ "def", "find_module", "(", "self", ",", "fullname", ",", "submodule_path", "=", "None", ")", ":", "# first see if we have this particular so has been loaded by", "# turicreate's extension library before", "ret", "=", "self", ".", "try_find_module", "(", "fullname", ",", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
main
Print lines of input along with output.
src/unity/python/doc/source/sphinx_turicreate_ext/pycon.py
def main(): """ Print lines of input along with output. """ source_lines = (line.rstrip() for line in sys.stdin) console = InteractiveInterpreter() console.runsource('import turicreate') source = '' try: while True: source = source_lines.next() more = cons...
def main(): """ Print lines of input along with output. """ source_lines = (line.rstrip() for line in sys.stdin) console = InteractiveInterpreter() console.runsource('import turicreate') source = '' try: while True: source = source_lines.next() more = cons...
[ "Print", "lines", "of", "input", "along", "with", "output", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/doc/source/sphinx_turicreate_ext/pycon.py#L10-L30
[ "def", "main", "(", ")", ":", "source_lines", "=", "(", "line", ".", "rstrip", "(", ")", "for", "line", "in", "sys", ".", "stdin", ")", "console", "=", "InteractiveInterpreter", "(", ")", "console", ".", "runsource", "(", "'import turicreate'", ")", "sou...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GetTypeChecker
Returns a type checker for a message field of the specified types. Args: field: FieldDescriptor object for this field. Returns: An instance of TypeChecker which can be used to verify the types of values assigned to a field of the specified type.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py
def GetTypeChecker(field): """Returns a type checker for a message field of the specified types. Args: field: FieldDescriptor object for this field. Returns: An instance of TypeChecker which can be used to verify the types of values assigned to a field of the specified type. """ if (field.cpp_ty...
def GetTypeChecker(field): """Returns a type checker for a message field of the specified types. Args: field: FieldDescriptor object for this field. Returns: An instance of TypeChecker which can be used to verify the types of values assigned to a field of the specified type. """ if (field.cpp_ty...
[ "Returns", "a", "type", "checker", "for", "a", "message", "field", "of", "the", "specified", "types", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py#L65-L84
[ "def", "GetTypeChecker", "(", "field", ")", ":", "if", "(", "field", ".", "cpp_type", "==", "_FieldDescriptor", ".", "CPPTYPE_STRING", "and", "field", ".", "type", "==", "_FieldDescriptor", ".", "TYPE_STRING", ")", ":", "return", "UnicodeValueChecker", "(", ")...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TypeChecker.CheckValue
Type check the provided value and return it. The returned value might have been normalized to another type.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py
def CheckValue(self, proposed_value): """Type check the provided value and return it. The returned value might have been normalized to another type. """ if not isinstance(proposed_value, self._acceptable_types): message = ('%.1024r has type %s, but expected one of: %s' % (propose...
def CheckValue(self, proposed_value): """Type check the provided value and return it. The returned value might have been normalized to another type. """ if not isinstance(proposed_value, self._acceptable_types): message = ('%.1024r has type %s, but expected one of: %s' % (propose...
[ "Type", "check", "the", "provided", "value", "and", "return", "it", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py#L101-L110
[ "def", "CheckValue", "(", "self", ",", "proposed_value", ")", ":", "if", "not", "isinstance", "(", "proposed_value", ",", "self", ".", "_acceptable_types", ")", ":", "message", "=", "(", "'%.1024r has type %s, but expected one of: %s'", "%", "(", "proposed_value", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
python_source
Generate executable python source code from an ast node. :param ast: ast node :param file: file to write output to.
src/unity/python/turicreate/meta/asttools/visitors/pysourcegen.py
def python_source(ast, file=sys.stdout): ''' Generate executable python source code from an ast node. :param ast: ast node :param file: file to write output to. ''' gen = SourceGen() gen.visit(ast) gen.dump(file)
def python_source(ast, file=sys.stdout): ''' Generate executable python source code from an ast node. :param ast: ast node :param file: file to write output to. ''' gen = SourceGen() gen.visit(ast) gen.dump(file)
[ "Generate", "executable", "python", "source", "code", "from", "an", "ast", "node", ".", ":", "param", "ast", ":", "ast", "node", ":", "param", "file", ":", "file", "to", "write", "output", "to", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/pysourcegen.py#L854-L863
[ "def", "python_source", "(", "ast", ",", "file", "=", "sys", ".", "stdout", ")", ":", "gen", "=", "SourceGen", "(", ")", "gen", ".", "visit", "(", "ast", ")", "gen", ".", "dump", "(", "file", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
CEscape
Escape a bytes string for use in an ascii protocol buffer. text.encode('string_escape') does not seem to satisfy our needs as it encodes unprintable characters using two-digit hex escapes whereas our C++ unescaping function allows hex escapes to be any length. So, "\0011".encode('string_escape') ends up being...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py
def CEscape(text, as_utf8): """Escape a bytes string for use in an ascii protocol buffer. text.encode('string_escape') does not seem to satisfy our needs as it encodes unprintable characters using two-digit hex escapes whereas our C++ unescaping function allows hex escapes to be any length. So, "\0011".enco...
def CEscape(text, as_utf8): """Escape a bytes string for use in an ascii protocol buffer. text.encode('string_escape') does not seem to satisfy our needs as it encodes unprintable characters using two-digit hex escapes whereas our C++ unescaping function allows hex escapes to be any length. So, "\0011".enco...
[ "Escape", "a", "bytes", "string", "for", "use", "in", "an", "ascii", "protocol", "buffer", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py#L59-L79
[ "def", "CEscape", "(", "text", ",", "as_utf8", ")", ":", "# PY3 hack: make Ord work for str and bytes:", "# //platforms/networking/data uses unicode here, hence basestring.", "Ord", "=", "ord", "if", "isinstance", "(", "text", ",", "six", ".", "string_types", ")", "else",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
CUnescape
Unescape a text string with C-style escape sequences to UTF-8 bytes.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py
def CUnescape(text): """Unescape a text string with C-style escape sequences to UTF-8 bytes.""" def ReplaceHex(m): # Only replace the match if the number of leading back slashes is odd. i.e. # the slash itself is not escaped. if len(m.group(1)) & 1: return m.group(1) + 'x0' + m.group(2) retur...
def CUnescape(text): """Unescape a text string with C-style escape sequences to UTF-8 bytes.""" def ReplaceHex(m): # Only replace the match if the number of leading back slashes is odd. i.e. # the slash itself is not escaped. if len(m.group(1)) & 1: return m.group(1) + 'x0' + m.group(2) retur...
[ "Unescape", "a", "text", "string", "with", "C", "-", "style", "escape", "sequences", "to", "UTF", "-", "8", "bytes", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py#L87-L107
[ "def", "CUnescape", "(", "text", ")", ":", "def", "ReplaceHex", "(", "m", ")", ":", "# Only replace the match if the number of leading back slashes is odd. i.e.", "# the slash itself is not escaped.", "if", "len", "(", "m", ".", "group", "(", "1", ")", ")", "&", "1"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
reset
Clear the module state. This is mainly for testing purposes. Note that this must be called _after_ resetting the module 'feature'.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def reset (): """ Clear the module state. This is mainly for testing purposes. Note that this must be called _after_ resetting the module 'feature'. """ global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache __register_features () # Stores ...
def reset (): """ Clear the module state. This is mainly for testing purposes. Note that this must be called _after_ resetting the module 'feature'. """ global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache __register_features () # Stores ...
[ "Clear", "the", "module", "state", ".", "This", "is", "mainly", "for", "testing", "purposes", ".", "Note", "that", "this", "must", "be", "called", "_after_", "resetting", "the", "module", "feature", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L32-L54
[ "def", "reset", "(", ")", ":", "global", "__prefixes_suffixes", ",", "__suffixes_to_types", ",", "__types", ",", "__rule_names_to_types", ",", "__target_suffixes_cache", "__register_features", "(", ")", "# Stores suffixes for generated targets.", "__prefixes_suffixes", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
register
Registers a target type, possibly derived from a 'base-type'. If 'suffixes' are provided, they list all the suffixes that mean a file is of 'type'. Also, the first element gives the suffix to be used when constructing and object of 'type'. type: a string suffixes: None or a seque...
deps/src/boost_1_68_0/tools/build/src/build/type.py
def register (type, suffixes = [], base_type = None): """ Registers a target type, possibly derived from a 'base-type'. If 'suffixes' are provided, they list all the suffixes that mean a file is of 'type'. Also, the first element gives the suffix to be used when constructing and object of 't...
def register (type, suffixes = [], base_type = None): """ Registers a target type, possibly derived from a 'base-type'. If 'suffixes' are provided, they list all the suffixes that mean a file is of 'type'. Also, the first element gives the suffix to be used when constructing and object of 't...
[ "Registers", "a", "target", "type", "possibly", "derived", "from", "a", "base", "-", "type", ".", "If", "suffixes", "are", "provided", "they", "list", "all", "the", "suffixes", "that", "mean", "a", "file", "is", "of", "type", ".", "Also", "the", "first",...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L59-L115
[ "def", "register", "(", "type", ",", "suffixes", "=", "[", "]", ",", "base_type", "=", "None", ")", ":", "# Type names cannot contain hyphens, because when used as", "# feature-values they will be interpreted as composite features", "# which need to be decomposed.", "if", "__re...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
register_suffixes
Specifies that targets with suffix from 'suffixes' have the type 'type'. If a different type is already specified for any of syffixes, issues an error.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def register_suffixes (suffixes, type): """ Specifies that targets with suffix from 'suffixes' have the type 'type'. If a different type is already specified for any of syffixes, issues an error. """ assert is_iterable_typed(suffixes, basestring) assert isinstance(type, basestring) for s in ...
def register_suffixes (suffixes, type): """ Specifies that targets with suffix from 'suffixes' have the type 'type'. If a different type is already specified for any of syffixes, issues an error. """ assert is_iterable_typed(suffixes, basestring) assert isinstance(type, basestring) for s in ...
[ "Specifies", "that", "targets", "with", "suffix", "from", "suffixes", "have", "the", "type", "type", ".", "If", "a", "different", "type", "is", "already", "specified", "for", "any", "of", "syffixes", "issues", "an", "error", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L123-L135
[ "def", "register_suffixes", "(", "suffixes", ",", "type", ")", ":", "assert", "is_iterable_typed", "(", "suffixes", ",", "basestring", ")", "assert", "isinstance", "(", "type", ",", "basestring", ")", "for", "s", "in", "suffixes", ":", "if", "s", "in", "__...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
set_scanner
Sets a scanner class that will be used for this 'type'.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def set_scanner (type, scanner): """ Sets a scanner class that will be used for this 'type'. """ if __debug__: from .scanner import Scanner assert isinstance(type, basestring) assert issubclass(scanner, Scanner) validate (type) __types [type]['scanner'] = scanner
def set_scanner (type, scanner): """ Sets a scanner class that will be used for this 'type'. """ if __debug__: from .scanner import Scanner assert isinstance(type, basestring) assert issubclass(scanner, Scanner) validate (type) __types [type]['scanner'] = scanner
[ "Sets", "a", "scanner", "class", "that", "will", "be", "used", "for", "this", "type", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L150-L158
[ "def", "set_scanner", "(", "type", ",", "scanner", ")", ":", "if", "__debug__", ":", "from", ".", "scanner", "import", "Scanner", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "issubclass", "(", "scanner", ",", "Scanner", ")", "val...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
get_scanner
Returns a scanner instance appropriate to 'type' and 'property_set'.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def get_scanner (type, prop_set): """ Returns a scanner instance appropriate to 'type' and 'property_set'. """ if __debug__: from .property_set import PropertySet assert isinstance(type, basestring) assert isinstance(prop_set, PropertySet) if registered (type): scanner_ty...
def get_scanner (type, prop_set): """ Returns a scanner instance appropriate to 'type' and 'property_set'. """ if __debug__: from .property_set import PropertySet assert isinstance(type, basestring) assert isinstance(prop_set, PropertySet) if registered (type): scanner_ty...
[ "Returns", "a", "scanner", "instance", "appropriate", "to", "type", "and", "property_set", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L160-L173
[ "def", "get_scanner", "(", "type", ",", "prop_set", ")", ":", "if", "__debug__", ":", "from", ".", "property_set", "import", "PropertySet", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "isinstance", "(", "prop_set", ",", "PropertySet"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
all_bases
Returns type and all of its bases, in the order of their distance from type.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def all_bases (type): """ Returns type and all of its bases, in the order of their distance from type. """ assert isinstance(type, basestring) result = [] while type: result.append (type) type = __types [type]['base'] return result
def all_bases (type): """ Returns type and all of its bases, in the order of their distance from type. """ assert isinstance(type, basestring) result = [] while type: result.append (type) type = __types [type]['base'] return result
[ "Returns", "type", "and", "all", "of", "its", "bases", "in", "the", "order", "of", "their", "distance", "from", "type", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L181-L190
[ "def", "all_bases", "(", "type", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "result", "=", "[", "]", "while", "type", ":", "result", ".", "append", "(", "type", ")", "type", "=", "__types", "[", "type", "]", "[", "'base'",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
all_derived
Returns type and all classes that derive from it, in the order of their distance from type.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def all_derived (type): """ Returns type and all classes that derive from it, in the order of their distance from type. """ assert isinstance(type, basestring) result = [type] for d in __types [type]['derived']: result.extend (all_derived (d)) return result
def all_derived (type): """ Returns type and all classes that derive from it, in the order of their distance from type. """ assert isinstance(type, basestring) result = [type] for d in __types [type]['derived']: result.extend (all_derived (d)) return result
[ "Returns", "type", "and", "all", "classes", "that", "derive", "from", "it", "in", "the", "order", "of", "their", "distance", "from", "type", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L192-L200
[ "def", "all_derived", "(", "type", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "result", "=", "[", "type", "]", "for", "d", "in", "__types", "[", "type", "]", "[", "'derived'", "]", ":", "result", ".", "extend", "(", "all_d...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
is_derived
Returns true if 'type' is 'base' or has 'base' as its direct or indirect base.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def is_derived (type, base): """ Returns true if 'type' is 'base' or has 'base' as its direct or indirect base. """ assert isinstance(type, basestring) assert isinstance(base, basestring) # TODO: this isn't very efficient, especially for bases close to type if base in all_bases (type): r...
def is_derived (type, base): """ Returns true if 'type' is 'base' or has 'base' as its direct or indirect base. """ assert isinstance(type, basestring) assert isinstance(base, basestring) # TODO: this isn't very efficient, especially for bases close to type if base in all_bases (type): r...
[ "Returns", "true", "if", "type", "is", "base", "or", "has", "base", "as", "its", "direct", "or", "indirect", "base", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L202-L211
[ "def", "is_derived", "(", "type", ",", "base", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "isinstance", "(", "base", ",", "basestring", ")", "# TODO: this isn't very efficient, especially for bases close to type", "if", "base", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
is_subtype
Same as is_derived. Should be removed.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def is_subtype (type, base): """ Same as is_derived. Should be removed. """ assert isinstance(type, basestring) assert isinstance(base, basestring) # TODO: remove this method return is_derived (type, base)
def is_subtype (type, base): """ Same as is_derived. Should be removed. """ assert isinstance(type, basestring) assert isinstance(base, basestring) # TODO: remove this method return is_derived (type, base)
[ "Same", "as", "is_derived", ".", "Should", "be", "removed", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L213-L219
[ "def", "is_subtype", "(", "type", ",", "base", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "isinstance", "(", "base", ",", "basestring", ")", "# TODO: remove this method", "return", "is_derived", "(", "type", ",", "base", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
set_generated_target_suffix
Sets a target suffix that should be used when generating target of 'type' with the specified properties. Can be called with empty properties if no suffix for 'type' was specified yet. This does not automatically specify that files 'suffix' have 'type' --- two different types can use the ...
deps/src/boost_1_68_0/tools/build/src/build/type.py
def set_generated_target_suffix (type, properties, suffix): """ Sets a target suffix that should be used when generating target of 'type' with the specified properties. Can be called with empty properties if no suffix for 'type' was specified yet. This does not automatically specify that fil...
def set_generated_target_suffix (type, properties, suffix): """ Sets a target suffix that should be used when generating target of 'type' with the specified properties. Can be called with empty properties if no suffix for 'type' was specified yet. This does not automatically specify that fil...
[ "Sets", "a", "target", "suffix", "that", "should", "be", "used", "when", "generating", "target", "of", "type", "with", "the", "specified", "properties", ".", "Can", "be", "called", "with", "empty", "properties", "if", "no", "suffix", "for", "type", "was", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L222-L238
[ "def", "set_generated_target_suffix", "(", "type", ",", "properties", ",", "suffix", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "properties", ",", "basestring", ")", "assert", "isinstance", "(", "su...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
change_generated_target_suffix
Change the suffix previously registered for this type/properties combination. If suffix is not yet specified, sets it.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def change_generated_target_suffix (type, properties, suffix): """ Change the suffix previously registered for this type/properties combination. If suffix is not yet specified, sets it. """ assert isinstance(type, basestring) assert is_iterable_typed(properties, basestring) assert isinstance...
def change_generated_target_suffix (type, properties, suffix): """ Change the suffix previously registered for this type/properties combination. If suffix is not yet specified, sets it. """ assert isinstance(type, basestring) assert is_iterable_typed(properties, basestring) assert isinstance...
[ "Change", "the", "suffix", "previously", "registered", "for", "this", "type", "/", "properties", "combination", ".", "If", "suffix", "is", "not", "yet", "specified", "sets", "it", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L242-L249
[ "def", "change_generated_target_suffix", "(", "type", ",", "properties", ",", "suffix", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "properties", ",", "basestring", ")", "assert", "isinstance", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generated_target_ps
Returns suffix that should be used when generating target of 'type', with the specified properties. If not suffix were specified for 'type', returns suffix for base type, if any.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def generated_target_ps(is_suffix, type, prop_set): """ Returns suffix that should be used when generating target of 'type', with the specified properties. If not suffix were specified for 'type', returns suffix for base type, if any. """ if __debug__: from .property_set import Prope...
def generated_target_ps(is_suffix, type, prop_set): """ Returns suffix that should be used when generating target of 'type', with the specified properties. If not suffix were specified for 'type', returns suffix for base type, if any. """ if __debug__: from .property_set import Prope...
[ "Returns", "suffix", "that", "should", "be", "used", "when", "generating", "target", "of", "type", "with", "the", "specified", "properties", ".", "If", "not", "suffix", "were", "specified", "for", "type", "returns", "suffix", "for", "base", "type", "if", "an...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L334-L351
[ "def", "generated_target_ps", "(", "is_suffix", ",", "type", ",", "prop_set", ")", ":", "if", "__debug__", ":", "from", ".", "property_set", "import", "PropertySet", "assert", "isinstance", "(", "is_suffix", ",", "(", "int", ",", "bool", ")", ")", "assert", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
type
Returns file type given it's name. If there are several dots in filename, tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and "so" will be tried.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def type(filename): """ Returns file type given it's name. If there are several dots in filename, tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and "so" will be tried. """ assert isinstance(filename, basestring) while 1: filename, suffix = os.path.splitext...
def type(filename): """ Returns file type given it's name. If there are several dots in filename, tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and "so" will be tried. """ assert isinstance(filename, basestring) while 1: filename, suffix = os.path.splitext...
[ "Returns", "file", "type", "given", "it", "s", "name", ".", "If", "there", "are", "several", "dots", "in", "filename", "tries", "each", "suffix", ".", "E", ".", "g", ".", "for", "name", "of", "file", ".", "so", ".", "1", ".", "2", "suffixes", "2", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L353-L365
[ "def", "type", "(", "filename", ")", ":", "assert", "isinstance", "(", "filename", ",", "basestring", ")", "while", "1", ":", "filename", ",", "suffix", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "not", "suffix", ":", "return"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
register_type
Register the given type on the specified OSes, or on remaining OSes if os is not specified. This rule is injected into each of the type modules for the sake of convenience.
deps/src/boost_1_68_0/tools/build/src/build/type.py
def register_type (type, suffixes, base_type = None, os = []): """ Register the given type on the specified OSes, or on remaining OSes if os is not specified. This rule is injected into each of the type modules for the sake of convenience. """ assert isinstance(type, basestring) assert ...
def register_type (type, suffixes, base_type = None, os = []): """ Register the given type on the specified OSes, or on remaining OSes if os is not specified. This rule is injected into each of the type modules for the sake of convenience. """ assert isinstance(type, basestring) assert ...
[ "Register", "the", "given", "type", "on", "the", "specified", "OSes", "or", "on", "remaining", "OSes", "if", "os", "is", "not", "specified", ".", "This", "rule", "is", "injected", "into", "each", "of", "the", "type", "modules", "for", "the", "sake", "of"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L368-L381
[ "def", "register_type", "(", "type", ",", "suffixes", ",", "base_type", "=", "None", ",", "os", "=", "[", "]", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "suffixes", ",", "basestring", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProgressTablePrinter.print_row
keys of kwargs must be the names passed to __init__(...) as `column_names`
src/unity/python/turicreate/util/_progress_table_printer.py
def print_row(self, **kwargs): ''' keys of kwargs must be the names passed to __init__(...) as `column_names` ''' meta_string = '|' for key in self.column_names: float_specifier = '' if isinstance(kwargs[key], float): float_specifier = '.3f...
def print_row(self, **kwargs): ''' keys of kwargs must be the names passed to __init__(...) as `column_names` ''' meta_string = '|' for key in self.column_names: float_specifier = '' if isinstance(kwargs[key], float): float_specifier = '.3f...
[ "keys", "of", "kwargs", "must", "be", "the", "names", "passed", "to", "__init__", "(", "...", ")", "as", "column_names" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_progress_table_printer.py#L27-L40
[ "def", "print_row", "(", "self", ",", "*", "*", "kwargs", ")", ":", "meta_string", "=", "'|'", "for", "key", "in", "self", ".", "column_names", ":", "float_specifier", "=", "''", "if", "isinstance", "(", "kwargs", "[", "key", "]", ",", "float", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
process_features
Parameters ---------- features : list[str] | str | None, optional Column names of features to be transformed. If None, all columns are selected. If string, that column is transformed. If list of strings, this list of column names is selected. exclude : list[str] | str | None, option...
src/unity/python/turicreate/toolkits/_feature_engineering/_internal_utils.py
def process_features(features, exclude): """ Parameters ---------- features : list[str] | str | None, optional Column names of features to be transformed. If None, all columns are selected. If string, that column is transformed. If list of strings, this list of column names is se...
def process_features(features, exclude): """ Parameters ---------- features : list[str] | str | None, optional Column names of features to be transformed. If None, all columns are selected. If string, that column is transformed. If list of strings, this list of column names is se...
[ "Parameters", "----------", "features", ":", "list", "[", "str", "]", "|", "str", "|", "None", "optional", "Column", "names", "of", "features", "to", "be", "transformed", ".", "If", "None", "all", "columns", "are", "selected", ".", "If", "string", "that", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_internal_utils.py#L83-L137
[ "def", "process_features", "(", "features", ",", "exclude", ")", ":", "# Check types", "_raise_error_if_not_of_type", "(", "features", ",", "[", "NoneType", ",", "str", ",", "list", "]", ",", "'features'", ")", "_raise_error_if_not_of_type", "(", "exclude", ",", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
pretty_print_list
Pretty print a list to be readable.
src/unity/python/turicreate/toolkits/_feature_engineering/_internal_utils.py
def pretty_print_list(lst, name = 'features', repr_format=True): """ Pretty print a list to be readable. """ if not lst or len(lst) < 8: if repr_format: return lst.__repr__() else: return ', '.join(map(str, lst)) else: topk = ', '.join(map(str, lst[:3])) ...
def pretty_print_list(lst, name = 'features', repr_format=True): """ Pretty print a list to be readable. """ if not lst or len(lst) < 8: if repr_format: return lst.__repr__() else: return ', '.join(map(str, lst)) else: topk = ', '.join(map(str, lst[:3])) ...
[ "Pretty", "print", "a", "list", "to", "be", "readable", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_internal_utils.py#L140-L159
[ "def", "pretty_print_list", "(", "lst", ",", "name", "=", "'features'", ",", "repr_format", "=", "True", ")", ":", "if", "not", "lst", "or", "len", "(", "lst", ")", "<", "8", ":", "if", "repr_format", ":", "return", "lst", ".", "__repr__", "(", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_elementwise_name_from_keras_layer
Get the keras layer name from the activation name.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def _get_elementwise_name_from_keras_layer(keras_layer): """ Get the keras layer name from the activation name. """ mode = keras_layer.mode if mode == 'sum': return 'ADD' elif mode == 'mul': return 'MULTIPLY' elif mode == 'concat': if len(keras_layer.input_shape[0]) =...
def _get_elementwise_name_from_keras_layer(keras_layer): """ Get the keras layer name from the activation name. """ mode = keras_layer.mode if mode == 'sum': return 'ADD' elif mode == 'mul': return 'MULTIPLY' elif mode == 'concat': if len(keras_layer.input_shape[0]) =...
[ "Get", "the", "keras", "layer", "name", "from", "the", "activation", "name", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L68-L105
[ "def", "_get_elementwise_name_from_keras_layer", "(", "keras_layer", ")", ":", "mode", "=", "keras_layer", ".", "mode", "if", "mode", "==", "'sum'", ":", "return", "'ADD'", "elif", "mode", "==", "'mul'", ":", "return", "'MULTIPLY'", "elif", "mode", "==", "'con...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_same_elements_per_channel
Test if a 3D (H,W,C) matrix x has the same element in each (H,W) matrix for each channel
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def _same_elements_per_channel(x): """ Test if a 3D (H,W,C) matrix x has the same element in each (H,W) matrix for each channel """ eps = 1e-5 dims = x.shape for c in range(dims[-1]): xc = x[:,:,c].flatten() if not np.all(np.absolute(xc - xc[0]) < eps): return False ...
def _same_elements_per_channel(x): """ Test if a 3D (H,W,C) matrix x has the same element in each (H,W) matrix for each channel """ eps = 1e-5 dims = x.shape for c in range(dims[-1]): xc = x[:,:,c].flatten() if not np.all(np.absolute(xc - xc[0]) < eps): return False ...
[ "Test", "if", "a", "3D", "(", "H", "W", "C", ")", "matrix", "x", "has", "the", "same", "element", "in", "each", "(", "H", "W", ")", "matrix", "for", "each", "channel" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L107-L117
[ "def", "_same_elements_per_channel", "(", "x", ")", ":", "eps", "=", "1e-5", "dims", "=", "x", ".", "shape", "for", "c", "in", "range", "(", "dims", "[", "-", "1", "]", ")", ":", "xc", "=", "x", "[", ":", ",", ":", ",", "c", "]", ".", "flatte...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_dense
Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_dense(builder, layer, input_names, output_names, keras_layer): """Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output...
def convert_dense(builder, layer, input_names, output_names, keras_layer): """Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output...
[ "Convert", "a", "dense", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L119-L145
[ "def", "convert_dense", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_activation
Convert an activation layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_activation(builder, layer, input_names, output_names, keras_layer): """Convert an activation layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input...
def convert_activation(builder, layer, input_names, output_names, keras_layer): """Convert an activation layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input...
[ "Convert", "an", "activation", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L147-L202
[ "def", "convert_activation", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_padding
Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_padding(builder, layer, input_names, output_names, keras_layer): """Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural networ...
def convert_padding(builder, layer, input_names, output_names, keras_layer): """Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural networ...
[ "Convert", "padding", "layer", "from", "keras", "to", "coreml", ".", "Keras", "only", "supports", "zero", "padding", "at", "this", "time", ".", "Parameters", "----------", "keras_layer", ":", "layer", "A", "keras", "layer", "object", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L309-L334
[ "def", "convert_padding", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_cropping
Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_cropping(builder, layer, input_names, output_names, keras_layer): """Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural netwo...
def convert_cropping(builder, layer, input_names, output_names, keras_layer): """Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural netwo...
[ "Convert", "padding", "layer", "from", "keras", "to", "coreml", ".", "Keras", "only", "supports", "zero", "padding", "at", "this", "time", ".", "Parameters", "----------", "keras_layer", ":", "layer", "A", "keras", "layer", "object", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L336-L361
[ "def", "convert_cropping", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_upsample
Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_upsample(builder, layer, input_names, output_names, keras_layer): """Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and...
def convert_upsample(builder, layer, input_names, output_names, keras_layer): """Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and...
[ "Convert", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L396-L419
[ "def", "convert_upsample", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_convolution
Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_convolution(builder, layer, input_names, output_names, keras_layer): """Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input ...
def convert_convolution(builder, layer, input_names, output_names, keras_layer): """Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input ...
[ "Convert", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L421-L472
[ "def", "convert_convolution", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_convolution1d
Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_convolution1d(builder, layer, input_names, output_names, keras_layer): """Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get inpu...
def convert_convolution1d(builder, layer, input_names, output_names, keras_layer): """Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get inpu...
[ "Convert", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L474-L524
[ "def", "convert_convolution1d", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_lstm
Convert an LSTM layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_lstm(builder, layer, input_names, output_names, keras_layer): """Convert an LSTM layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = keras_la...
def convert_lstm(builder, layer, input_names, output_names, keras_layer): """Convert an LSTM layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = keras_la...
[ "Convert", "an", "LSTM", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L526-L599
[ "def", "convert_lstm", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "hidden_size", "=", "keras_layer", ".", "output_dim", "input_size", "=", "keras_layer", ".", "input_shape", "[", "-", "1", "]", "if", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_simple_rnn
Convert an SimpleRNN layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_simple_rnn(builder, layer, input_names, output_names, keras_layer): """Convert an SimpleRNN layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input ...
def convert_simple_rnn(builder, layer, input_names, output_names, keras_layer): """Convert an SimpleRNN layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input ...
[ "Convert", "an", "SimpleRNN", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L602-L649
[ "def", "convert_simple_rnn", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "hidden_size", "=", "keras_layer", ".", "output_dim", "input_size", "=", "keras_layer", ".", "input_shape"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_gru
Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_gru(builder, layer, input_names, output_names, keras_layer): """Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = keras_layer...
def convert_gru(builder, layer, input_names, output_names, keras_layer): """Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = keras_layer...
[ "Convert", "a", "GRU", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L651-L705
[ "def", "convert_gru", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "hidden_size", "=", "keras_layer", ".", "output_dim", "input_size", "=", "keras_layer", ".", "input_shape", "[", "-", "1", "]", "output_a...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_bidirectional
Convert a bidirectional layer from keras to coreml. Currently assumes the units are LSTMs. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_bidirectional(builder, layer, input_names, output_names, keras_layer): """Convert a bidirectional layer from keras to coreml. Currently assumes the units are LSTMs. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A ne...
def convert_bidirectional(builder, layer, input_names, output_names, keras_layer): """Convert a bidirectional layer from keras to coreml. Currently assumes the units are LSTMs. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A ne...
[ "Convert", "a", "bidirectional", "layer", "from", "keras", "to", "coreml", ".", "Currently", "assumes", "the", "units", "are", "LSTMs", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L708-L830
[ "def", "convert_bidirectional", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_size", "=", "keras_layer", ".", "input_shape", "[", "-", "1", "]", "lstm_layer", "=", "keras_layer", ".", "forward_layer",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_batchnorm
Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_batchnorm(builder, layer, input_names, output_names, keras_layer): """ Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output names input_name, output_name = (input_names[0], ...
def convert_batchnorm(builder, layer, input_names, output_names, keras_layer): """ Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output names input_name, output_name = (input_names[0], ...
[ "Parameters", "keras_layer", ":", "layer", "A", "keras", "layer", "object", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L832-L876
[ "def", "convert_batchnorm", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_flatten
Convert a flatten layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_flatten(builder, layer, input_names, output_names, keras_layer): """Convert a flatten layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, output...
def convert_flatten(builder, layer, input_names, output_names, keras_layer): """Convert a flatten layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, output...
[ "Convert", "a", "flatten", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L878-L900
[ "def", "convert_flatten", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", "]", ")", "# blob_order ==...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_softmax
Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_softmax(builder, layer, input_names, output_names, keras_layer): """Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, output...
def convert_softmax(builder, layer, input_names, output_names, keras_layer): """Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, output...
[ "Convert", "a", "softmax", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L902-L916
[ "def", "convert_softmax", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", "]", ")", "builder", "."...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_permute
Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
def convert_permute(builder, layer, input_names, output_names, keras_layer): """Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, output...
def convert_permute(builder, layer, input_names, output_names, keras_layer): """Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, output...
[ "Convert", "a", "softmax", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L918-L950
[ "def", "convert_permute", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", "]", ")", "keras_dims", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
sge_submit
customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args arguments to launch each job this usually includes th...
src/external/xgboost/subtree/rabit/tracker/rabit_sge.py
def sge_submit(nslave, worker_args, worker_envs): """ customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args arg...
def sge_submit(nslave, worker_args, worker_envs): """ customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args arg...
[ "customized", "submit", "script", "that", "submit", "nslave", "jobs", "each", "must", "contain", "args", "as", "parameter", "note", "this", "can", "be", "a", "lambda", "function", "containing", "additional", "parameters", "in", "input", "Parameters", "nslave", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_sge.py#L47-L67
[ "def", "sge_submit", "(", "nslave", ",", "worker_args", ",", "worker_envs", ")", ":", "env_arg", "=", "','", ".", "join", "(", "[", "'%s=\\\"%s\\\"'", "%", "(", "k", ",", "str", "(", "v", ")", ")", "for", "k", ",", "v", "in", "worker_envs", ".", "i...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
dump_ast
Returns a string representing the ast. :param ast: the ast to print. :param indent: how far to indent a newline. :param newline: The newline character.
src/unity/python/turicreate/meta/asttools/visitors/print_visitor.py
def dump_ast(ast, indent=' ', newline='\n'): ''' Returns a string representing the ast. :param ast: the ast to print. :param indent: how far to indent a newline. :param newline: The newline character. ''' visitor = ASTPrinter(indent=indent, level=0, newline=newline) v...
def dump_ast(ast, indent=' ', newline='\n'): ''' Returns a string representing the ast. :param ast: the ast to print. :param indent: how far to indent a newline. :param newline: The newline character. ''' visitor = ASTPrinter(indent=indent, level=0, newline=newline) v...
[ "Returns", "a", "string", "representing", "the", "ast", ".", ":", "param", "ast", ":", "the", "ast", "to", "print", ".", ":", "param", "indent", ":", "how", "far", "to", "indent", "a", "newline", ".", ":", "param", "newline", ":", "The", "newline", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/print_visitor.py#L151-L164
[ "def", "dump_ast", "(", "ast", ",", "indent", "=", "' '", ",", "newline", "=", "'\\n'", ")", ":", "visitor", "=", "ASTPrinter", "(", "indent", "=", "indent", ",", "level", "=", "0", ",", "newline", "=", "newline", ")", "visitor", ".", "visit", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
print_ast
Pretty print an ast node. :param ast: the ast to print. :param indent: how far to indent a newline. :param initlevel: starting indent level :param newline: The newline character. :param file: file object to print to To print a short ast you may want to use:: node = ast.par...
src/unity/python/turicreate/meta/asttools/visitors/print_visitor.py
def print_ast(ast, indent=' ', initlevel=0, newline='\n', file=sys.stdout): ''' Pretty print an ast node. :param ast: the ast to print. :param indent: how far to indent a newline. :param initlevel: starting indent level :param newline: The newline character. :param file: file object to ...
def print_ast(ast, indent=' ', initlevel=0, newline='\n', file=sys.stdout): ''' Pretty print an ast node. :param ast: the ast to print. :param indent: how far to indent a newline. :param initlevel: starting indent level :param newline: The newline character. :param file: file object to ...
[ "Pretty", "print", "an", "ast", "node", ".", ":", "param", "ast", ":", "the", "ast", "to", "print", ".", ":", "param", "indent", ":", "how", "far", "to", "indent", "a", "newline", ".", ":", "param", "initlevel", ":", "starting", "indent", "level", ":...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/print_visitor.py#L166-L185
[ "def", "print_ast", "(", "ast", ",", "indent", "=", "' '", ",", "initlevel", "=", "0", ",", "newline", "=", "'\\n'", ",", "file", "=", "sys", ".", "stdout", ")", ":", "visitor", "=", "ASTPrinter", "(", "indent", "=", "indent", ",", "level", "=", "i...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ctypes2numpy
Convert a ctypes pointer array to a numpy array.
src/external/xgboost/python-package/xgboost/core.py
def ctypes2numpy(cptr, length, dtype): """Convert a ctypes pointer array to a numpy array. """ if not isinstance(cptr, ctypes.POINTER(ctypes.c_float)): raise RuntimeError('expected float pointer') res = np.zeros(length, dtype=dtype) if not ctypes.memmove(res.ctypes.data, cptr, length * res.s...
def ctypes2numpy(cptr, length, dtype): """Convert a ctypes pointer array to a numpy array. """ if not isinstance(cptr, ctypes.POINTER(ctypes.c_float)): raise RuntimeError('expected float pointer') res = np.zeros(length, dtype=dtype) if not ctypes.memmove(res.ctypes.data, cptr, length * res.s...
[ "Convert", "a", "ctypes", "pointer", "array", "to", "a", "numpy", "array", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L109-L117
[ "def", "ctypes2numpy", "(", "cptr", ",", "length", ",", "dtype", ")", ":", "if", "not", "isinstance", "(", "cptr", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_float", ")", ")", ":", "raise", "RuntimeError", "(", "'expected float pointer'", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_maybe_from_pandas
Extract internal data from pd.DataFrame
src/external/xgboost/python-package/xgboost/core.py
def _maybe_from_pandas(data, feature_names, feature_types): """ Extract internal data from pd.DataFrame """ try: import pandas as pd except ImportError: return data, feature_names, feature_types if not isinstance(data, pd.DataFrame): return data, feature_names, feature_types ...
def _maybe_from_pandas(data, feature_names, feature_types): """ Extract internal data from pd.DataFrame """ try: import pandas as pd except ImportError: return data, feature_names, feature_types if not isinstance(data, pd.DataFrame): return data, feature_names, feature_types ...
[ "Extract", "internal", "data", "from", "pd", ".", "DataFrame" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L141-L161
[ "def", "_maybe_from_pandas", "(", "data", ",", "feature_names", ",", "feature_types", ")", ":", "try", ":", "import", "pandas", "as", "pd", "except", "ImportError", ":", "return", "data", ",", "feature_names", ",", "feature_types", "if", "not", "isinstance", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix._init_from_csr
Initialize data from a CSR matrix.
src/external/xgboost/python-package/xgboost/core.py
def _init_from_csr(self, csr): """ Initialize data from a CSR matrix. """ if len(csr.indices) != len(csr.data): raise ValueError('length mismatch: {} vs {}'.format(len(csr.indices), len(csr.data))) self.handle = ctypes.c_void_p() _check_call(_LIB.XGDMatrixCrea...
def _init_from_csr(self, csr): """ Initialize data from a CSR matrix. """ if len(csr.indices) != len(csr.data): raise ValueError('length mismatch: {} vs {}'.format(len(csr.indices), len(csr.data))) self.handle = ctypes.c_void_p() _check_call(_LIB.XGDMatrixCrea...
[ "Initialize", "data", "from", "a", "CSR", "matrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L235-L246
[ "def", "_init_from_csr", "(", "self", ",", "csr", ")", ":", "if", "len", "(", "csr", ".", "indices", ")", "!=", "len", "(", "csr", ".", "data", ")", ":", "raise", "ValueError", "(", "'length mismatch: {} vs {}'", ".", "format", "(", "len", "(", "csr", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix._init_from_csc
Initialize data from a CSC matrix.
src/external/xgboost/python-package/xgboost/core.py
def _init_from_csc(self, csc): """ Initialize data from a CSC matrix. """ if len(csc.indices) != len(csc.data): raise ValueError('length mismatch: {} vs {}'.format(len(csc.indices), len(csc.data))) self.handle = ctypes.c_void_p() _check_call(_LIB.XGDMatrixCrea...
def _init_from_csc(self, csc): """ Initialize data from a CSC matrix. """ if len(csc.indices) != len(csc.data): raise ValueError('length mismatch: {} vs {}'.format(len(csc.indices), len(csc.data))) self.handle = ctypes.c_void_p() _check_call(_LIB.XGDMatrixCrea...
[ "Initialize", "data", "from", "a", "CSC", "matrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L248-L259
[ "def", "_init_from_csc", "(", "self", ",", "csc", ")", ":", "if", "len", "(", "csc", ".", "indices", ")", "!=", "len", "(", "csc", ".", "data", ")", ":", "raise", "ValueError", "(", "'length mismatch: {} vs {}'", ".", "format", "(", "len", "(", "csc", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix._init_from_npy2d
Initialize data from a 2-D numpy matrix.
src/external/xgboost/python-package/xgboost/core.py
def _init_from_npy2d(self, mat, missing): """ Initialize data from a 2-D numpy matrix. """ if len(mat.shape) != 2: raise ValueError('Input numpy.ndarray must be 2 dimensional') data = np.array(mat.reshape(mat.size), dtype=np.float32) self.handle = ctypes.c_voi...
def _init_from_npy2d(self, mat, missing): """ Initialize data from a 2-D numpy matrix. """ if len(mat.shape) != 2: raise ValueError('Input numpy.ndarray must be 2 dimensional') data = np.array(mat.reshape(mat.size), dtype=np.float32) self.handle = ctypes.c_voi...
[ "Initialize", "data", "from", "a", "2", "-", "D", "numpy", "matrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L261-L272
[ "def", "_init_from_npy2d", "(", "self", ",", "mat", ",", "missing", ")", ":", "if", "len", "(", "mat", ".", "shape", ")", "!=", "2", ":", "raise", "ValueError", "(", "'Input numpy.ndarray must be 2 dimensional'", ")", "data", "=", "np", ".", "array", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.get_float_info
Get float property from the DMatrix. Parameters ---------- field: str The field name of the information Returns ------- info : array a numpy array of float information of the data
src/external/xgboost/python-package/xgboost/core.py
def get_float_info(self, field): """Get float property from the DMatrix. Parameters ---------- field: str The field name of the information Returns ------- info : array a numpy array of float information of the data """ le...
def get_float_info(self, field): """Get float property from the DMatrix. Parameters ---------- field: str The field name of the information Returns ------- info : array a numpy array of float information of the data """ le...
[ "Get", "float", "property", "from", "the", "DMatrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L277-L296
[ "def", "get_float_info", "(", "self", ",", "field", ")", ":", "length", "=", "ctypes", ".", "c_ulong", "(", ")", "ret", "=", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_float", ")", "(", ")", "_check_call", "(", "_LIB", ".", "XGDMatrixGetFloatInfo",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.get_uint_info
Get unsigned integer property from the DMatrix. Parameters ---------- field: str The field name of the information Returns ------- info : array a numpy array of float information of the data
src/external/xgboost/python-package/xgboost/core.py
def get_uint_info(self, field): """Get unsigned integer property from the DMatrix. Parameters ---------- field: str The field name of the information Returns ------- info : array a numpy array of float information of the data """ ...
def get_uint_info(self, field): """Get unsigned integer property from the DMatrix. Parameters ---------- field: str The field name of the information Returns ------- info : array a numpy array of float information of the data """ ...
[ "Get", "unsigned", "integer", "property", "from", "the", "DMatrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L298-L317
[ "def", "get_uint_info", "(", "self", ",", "field", ")", ":", "length", "=", "ctypes", ".", "c_ulong", "(", ")", "ret", "=", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_uint", ")", "(", ")", "_check_call", "(", "_LIB", ".", "XGDMatrixGetUIntInfo", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.set_float_info
Set float type property into the DMatrix. Parameters ---------- field: str The field name of the information data: numpy array The array ofdata to be set
src/external/xgboost/python-package/xgboost/core.py
def set_float_info(self, field, data): """Set float type property into the DMatrix. Parameters ---------- field: str The field name of the information data: numpy array The array ofdata to be set """ _check_call(_LIB.XGDMatrixSetFloatInfo...
def set_float_info(self, field, data): """Set float type property into the DMatrix. Parameters ---------- field: str The field name of the information data: numpy array The array ofdata to be set """ _check_call(_LIB.XGDMatrixSetFloatInfo...
[ "Set", "float", "type", "property", "into", "the", "DMatrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L319-L333
[ "def", "set_float_info", "(", "self", ",", "field", ",", "data", ")", ":", "_check_call", "(", "_LIB", ".", "XGDMatrixSetFloatInfo", "(", "self", ".", "handle", ",", "c_str", "(", "field", ")", ",", "c_array", "(", "ctypes", ".", "c_float", ",", "data", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.set_uint_info
Set uint type property into the DMatrix. Parameters ---------- field: str The field name of the information data: numpy array The array ofdata to be set
src/external/xgboost/python-package/xgboost/core.py
def set_uint_info(self, field, data): """Set uint type property into the DMatrix. Parameters ---------- field: str The field name of the information data: numpy array The array ofdata to be set """ _check_call(_LIB.XGDMatrixSetUIntInfo(se...
def set_uint_info(self, field, data): """Set uint type property into the DMatrix. Parameters ---------- field: str The field name of the information data: numpy array The array ofdata to be set """ _check_call(_LIB.XGDMatrixSetUIntInfo(se...
[ "Set", "uint", "type", "property", "into", "the", "DMatrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L335-L349
[ "def", "set_uint_info", "(", "self", ",", "field", ",", "data", ")", ":", "_check_call", "(", "_LIB", ".", "XGDMatrixSetUIntInfo", "(", "self", ".", "handle", ",", "c_str", "(", "field", ")", ",", "c_array", "(", "ctypes", ".", "c_uint", ",", "data", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.save_binary
Save DMatrix to an XGBoost buffer. Parameters ---------- fname : string Name of the output buffer file. silent : bool (optional; default: True) If set, the output is suppressed.
src/external/xgboost/python-package/xgboost/core.py
def save_binary(self, fname, silent=True): """Save DMatrix to an XGBoost buffer. Parameters ---------- fname : string Name of the output buffer file. silent : bool (optional; default: True) If set, the output is suppressed. """ _check_call...
def save_binary(self, fname, silent=True): """Save DMatrix to an XGBoost buffer. Parameters ---------- fname : string Name of the output buffer file. silent : bool (optional; default: True) If set, the output is suppressed. """ _check_call...
[ "Save", "DMatrix", "to", "an", "XGBoost", "buffer", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L351-L363
[ "def", "save_binary", "(", "self", ",", "fname", ",", "silent", "=", "True", ")", ":", "_check_call", "(", "_LIB", ".", "XGDMatrixSaveBinary", "(", "self", ".", "handle", ",", "c_str", "(", "fname", ")", ",", "int", "(", "silent", ")", ")", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.num_row
Get the number of rows in the DMatrix. Returns ------- number of rows : int
src/external/xgboost/python-package/xgboost/core.py
def num_row(self): """Get the number of rows in the DMatrix. Returns ------- number of rows : int """ ret = ctypes.c_ulong() _check_call(_LIB.XGDMatrixNumRow(self.handle, ctypes.byref(ret))) return ret.value
def num_row(self): """Get the number of rows in the DMatrix. Returns ------- number of rows : int """ ret = ctypes.c_ulong() _check_call(_LIB.XGDMatrixNumRow(self.handle, ctypes.byref(ret))) return ret.value
[ "Get", "the", "number", "of", "rows", "in", "the", "DMatrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L440-L450
[ "def", "num_row", "(", "self", ")", ":", "ret", "=", "ctypes", ".", "c_ulong", "(", ")", "_check_call", "(", "_LIB", ".", "XGDMatrixNumRow", "(", "self", ".", "handle", ",", "ctypes", ".", "byref", "(", "ret", ")", ")", ")", "return", "ret", ".", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.num_col
Get the number of columns (features) in the DMatrix. Returns ------- number of columns : int
src/external/xgboost/python-package/xgboost/core.py
def num_col(self): """Get the number of columns (features) in the DMatrix. Returns ------- number of columns : int """ ret = ctypes.c_uint() _check_call(_LIB.XGDMatrixNumCol(self.handle, ctypes.byref(ret))) return ...
def num_col(self): """Get the number of columns (features) in the DMatrix. Returns ------- number of columns : int """ ret = ctypes.c_uint() _check_call(_LIB.XGDMatrixNumCol(self.handle, ctypes.byref(ret))) return ...
[ "Get", "the", "number", "of", "columns", "(", "features", ")", "in", "the", "DMatrix", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L452-L462
[ "def", "num_col", "(", "self", ")", ":", "ret", "=", "ctypes", ".", "c_uint", "(", ")", "_check_call", "(", "_LIB", ".", "XGDMatrixNumCol", "(", "self", ".", "handle", ",", "ctypes", ".", "byref", "(", "ret", ")", ")", ")", "return", "ret", ".", "v...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.slice
Slice the DMatrix and return a new DMatrix that only contains `rindex`. Parameters ---------- rindex : list List of indices to be selected. Returns ------- res : DMatrix A new DMatrix containing only selected indices.
src/external/xgboost/python-package/xgboost/core.py
def slice(self, rindex): """Slice the DMatrix and return a new DMatrix that only contains `rindex`. Parameters ---------- rindex : list List of indices to be selected. Returns ------- res : DMatrix A new DMatrix containing only selected i...
def slice(self, rindex): """Slice the DMatrix and return a new DMatrix that only contains `rindex`. Parameters ---------- rindex : list List of indices to be selected. Returns ------- res : DMatrix A new DMatrix containing only selected i...
[ "Slice", "the", "DMatrix", "and", "return", "a", "new", "DMatrix", "that", "only", "contains", "rindex", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L464-L483
[ "def", "slice", "(", "self", ",", "rindex", ")", ":", "res", "=", "DMatrix", "(", "None", ",", "feature_names", "=", "self", ".", "feature_names", ")", "res", ".", "handle", "=", "ctypes", ".", "c_void_p", "(", ")", "_check_call", "(", "_LIB", ".", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.feature_names
Set feature names (column labels). Parameters ---------- feature_names : list or None Labels for features. None will reset existing feature names
src/external/xgboost/python-package/xgboost/core.py
def feature_names(self, feature_names): """Set feature names (column labels). Parameters ---------- feature_names : list or None Labels for features. None will reset existing feature names """ if not feature_names is None: # validate feature name ...
def feature_names(self, feature_names): """Set feature names (column labels). Parameters ---------- feature_names : list or None Labels for features. None will reset existing feature names """ if not feature_names is None: # validate feature name ...
[ "Set", "feature", "names", "(", "column", "labels", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L506-L530
[ "def", "feature_names", "(", "self", ",", "feature_names", ")", ":", "if", "not", "feature_names", "is", "None", ":", "# validate feature name", "if", "not", "isinstance", "(", "feature_names", ",", "list", ")", ":", "feature_names", "=", "list", "(", "feature...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DMatrix.feature_types
Set feature types (column types). This is for displaying the results and unrelated to the learning process. Parameters ---------- feature_types : list or None Labels for features. None will reset existing feature names
src/external/xgboost/python-package/xgboost/core.py
def feature_types(self, feature_types): """Set feature types (column types). This is for displaying the results and unrelated to the learning process. Parameters ---------- feature_types : list or None Labels for features. None will reset existing feature na...
def feature_types(self, feature_types): """Set feature types (column types). This is for displaying the results and unrelated to the learning process. Parameters ---------- feature_types : list or None Labels for features. None will reset existing feature na...
[ "Set", "feature", "types", "(", "column", "types", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L533-L565
[ "def", "feature_types", "(", "self", ",", "feature_types", ")", ":", "if", "not", "feature_types", "is", "None", ":", "if", "self", ".", "feature_names", "is", "None", ":", "msg", "=", "'Unable to set feature types before setting names'", "raise", "ValueError", "(...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.update
Update for one iteration, with objective function calculated internally. Parameters ---------- dtrain : DMatrix Training data. iteration : int Current iteration number. fobj : function Customized objective function.
src/external/xgboost/python-package/xgboost/core.py
def update(self, dtrain, iteration, fobj=None): """ Update for one iteration, with objective function calculated internally. Parameters ---------- dtrain : DMatrix Training data. iteration : int Current iteration number. fobj : function ...
def update(self, dtrain, iteration, fobj=None): """ Update for one iteration, with objective function calculated internally. Parameters ---------- dtrain : DMatrix Training data. iteration : int Current iteration number. fobj : function ...
[ "Update", "for", "one", "iteration", "with", "objective", "function", "calculated", "internally", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L664-L686
[ "def", "update", "(", "self", ",", "dtrain", ",", "iteration", ",", "fobj", "=", "None", ")", ":", "if", "not", "isinstance", "(", "dtrain", ",", "DMatrix", ")", ":", "raise", "TypeError", "(", "'invalid training matrix: {}'", ".", "format", "(", "type", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.boost
Boost the booster for one iteration, with customized gradient statistics. Parameters ---------- dtrain : DMatrix The training DMatrix. grad : list The first order of gradient. hess : list The second order of gradient.
src/external/xgboost/python-package/xgboost/core.py
def boost(self, dtrain, grad, hess): """ Boost the booster for one iteration, with customized gradient statistics. Parameters ---------- dtrain : DMatrix The training DMatrix. grad : list The first order of gradient. hess : list ...
def boost(self, dtrain, grad, hess): """ Boost the booster for one iteration, with customized gradient statistics. Parameters ---------- dtrain : DMatrix The training DMatrix. grad : list The first order of gradient. hess : list ...
[ "Boost", "the", "booster", "for", "one", "iteration", "with", "customized", "gradient", "statistics", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L688-L710
[ "def", "boost", "(", "self", ",", "dtrain", ",", "grad", ",", "hess", ")", ":", "if", "len", "(", "grad", ")", "!=", "len", "(", "hess", ")", ":", "raise", "ValueError", "(", "'grad / hess length mismatch: {} / {}'", ".", "format", "(", "len", "(", "gr...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.eval_set
Evaluate a set of data. Parameters ---------- evals : list of tuples (DMatrix, string) List of items to be evaluated. iteration : int Current iteration. feval : function Custom evaluation function. Returns ------- res...
src/external/xgboost/python-package/xgboost/core.py
def eval_set(self, evals, iteration=0, feval=None): # pylint: disable=invalid-name """Evaluate a set of data. Parameters ---------- evals : list of tuples (DMatrix, string) List of items to be evaluated. iteration : int Current iteration. ...
def eval_set(self, evals, iteration=0, feval=None): # pylint: disable=invalid-name """Evaluate a set of data. Parameters ---------- evals : list of tuples (DMatrix, string) List of items to be evaluated. iteration : int Current iteration. ...
[ "Evaluate", "a", "set", "of", "data", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L712-L750
[ "def", "eval_set", "(", "self", ",", "evals", ",", "iteration", "=", "0", ",", "feval", "=", "None", ")", ":", "# pylint: disable=invalid-name", "if", "feval", "is", "None", ":", "for", "d", "in", "evals", ":", "if", "not", "isinstance", "(", "d", "[",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.predict
Predict with data. NOTE: This function is not thread safe. For each booster object, predict can only be called from one thread. If you want to run prediction using multiple thread, call bst.copy() to make copies of model object and then call predict Parameters...
src/external/xgboost/python-package/xgboost/core.py
def predict(self, data, output_margin=False, ntree_limit=0, pred_leaf=False): """ Predict with data. NOTE: This function is not thread safe. For each booster object, predict can only be called from one thread. If you want to run prediction using multiple thread, call...
def predict(self, data, output_margin=False, ntree_limit=0, pred_leaf=False): """ Predict with data. NOTE: This function is not thread safe. For each booster object, predict can only be called from one thread. If you want to run prediction using multiple thread, call...
[ "Predict", "with", "data", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L774-L824
[ "def", "predict", "(", "self", ",", "data", ",", "output_margin", "=", "False", ",", "ntree_limit", "=", "0", ",", "pred_leaf", "=", "False", ")", ":", "option_mask", "=", "0x00", "if", "output_margin", ":", "option_mask", "|=", "0x01", "if", "pred_leaf", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.save_raw
Save the model to a in memory buffer represetation Returns ------- a in memory buffer represetation of the model
src/external/xgboost/python-package/xgboost/core.py
def save_raw(self): """ Save the model to a in memory buffer represetation Returns ------- a in memory buffer represetation of the model """ length = ctypes.c_ulong() cptr = ctypes.POINTER(ctypes.c_char)() _check_call(_LIB.XGBoosterGetModelRaw(sel...
def save_raw(self): """ Save the model to a in memory buffer represetation Returns ------- a in memory buffer represetation of the model """ length = ctypes.c_ulong() cptr = ctypes.POINTER(ctypes.c_char)() _check_call(_LIB.XGBoosterGetModelRaw(sel...
[ "Save", "the", "model", "to", "a", "in", "memory", "buffer", "represetation" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L840-L853
[ "def", "save_raw", "(", "self", ")", ":", "length", "=", "ctypes", ".", "c_ulong", "(", ")", "cptr", "=", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_char", ")", "(", ")", "_check_call", "(", "_LIB", ".", "XGBoosterGetModelRaw", "(", "self", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.load_model
Load the model from a file. Parameters ---------- fname : string or a memory buffer Input file name or memory buffer(see also save_raw)
src/external/xgboost/python-package/xgboost/core.py
def load_model(self, fname): """ Load the model from a file. Parameters ---------- fname : string or a memory buffer Input file name or memory buffer(see also save_raw) """ if isinstance(fname, STRING_TYPES): # assume file name if os.path...
def load_model(self, fname): """ Load the model from a file. Parameters ---------- fname : string or a memory buffer Input file name or memory buffer(see also save_raw) """ if isinstance(fname, STRING_TYPES): # assume file name if os.path...
[ "Load", "the", "model", "from", "a", "file", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L855-L873
[ "def", "load_model", "(", "self", ",", "fname", ")", ":", "if", "isinstance", "(", "fname", ",", "STRING_TYPES", ")", ":", "# assume file name", "if", "os", ".", "path", ".", "exists", "(", "fname", ")", ":", "_LIB", ".", "XGBoosterLoadModel", "(", "self...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.dump_model
Dump model into a text file. Parameters ---------- foout : string Output file name. fmap : string, optional Name of the file containing feature map names. with_stats : bool (optional) Controls whether the split statistics are output.
src/external/xgboost/python-package/xgboost/core.py
def dump_model(self, fout, fmap='', with_stats=False): """ Dump model into a text file. Parameters ---------- foout : string Output file name. fmap : string, optional Name of the file containing feature map names. with_stats : bool (option...
def dump_model(self, fout, fmap='', with_stats=False): """ Dump model into a text file. Parameters ---------- foout : string Output file name. fmap : string, optional Name of the file containing feature map names. with_stats : bool (option...
[ "Dump", "model", "into", "a", "text", "file", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L875-L898
[ "def", "dump_model", "(", "self", ",", "fout", ",", "fmap", "=", "''", ",", "with_stats", "=", "False", ")", ":", "if", "isinstance", "(", "fout", ",", "STRING_TYPES", ")", ":", "fout", "=", "open", "(", "fout", ",", "'w'", ")", "need_close", "=", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.get_dump
Returns the dump the model as a list of strings.
src/external/xgboost/python-package/xgboost/core.py
def get_dump(self, fmap='', with_stats=False): """ Returns the dump the model as a list of strings. """ length = ctypes.c_ulong() sarr = ctypes.POINTER(ctypes.c_char_p)() if self.feature_names is not None and fmap == '': flen = int(len(self.feature_names)) ...
def get_dump(self, fmap='', with_stats=False): """ Returns the dump the model as a list of strings. """ length = ctypes.c_ulong() sarr = ctypes.POINTER(ctypes.c_char_p)() if self.feature_names is not None and fmap == '': flen = int(len(self.feature_names)) ...
[ "Returns", "the", "dump", "the", "model", "as", "a", "list", "of", "strings", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L900-L934
[ "def", "get_dump", "(", "self", ",", "fmap", "=", "''", ",", "with_stats", "=", "False", ")", ":", "length", "=", "ctypes", ".", "c_ulong", "(", ")", "sarr", "=", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_char_p", ")", "(", ")", "if", "self"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster.get_fscore
Get feature importance of each feature. Parameters ---------- fmap: str (optional) The name of feature map file
src/external/xgboost/python-package/xgboost/core.py
def get_fscore(self, fmap=''): """Get feature importance of each feature. Parameters ---------- fmap: str (optional) The name of feature map file """ trees = self.get_dump(fmap) fmap = {} for tree in trees: for line in tree.split('\...
def get_fscore(self, fmap=''): """Get feature importance of each feature. Parameters ---------- fmap: str (optional) The name of feature map file """ trees = self.get_dump(fmap) fmap = {} for tree in trees: for line in tree.split('\...
[ "Get", "feature", "importance", "of", "each", "feature", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L936-L957
[ "def", "get_fscore", "(", "self", ",", "fmap", "=", "''", ")", ":", "trees", "=", "self", ".", "get_dump", "(", "fmap", ")", "fmap", "=", "{", "}", "for", "tree", "in", "trees", ":", "for", "line", "in", "tree", ".", "split", "(", "'\\n'", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Booster._validate_features
Validate Booster and data's feature_names are identical. Set feature_names and feature_types from DMatrix
src/external/xgboost/python-package/xgboost/core.py
def _validate_features(self, data): """ Validate Booster and data's feature_names are identical. Set feature_names and feature_types from DMatrix """ if self.feature_names is None: self.feature_names = data.feature_names self.feature_types = data.feature_t...
def _validate_features(self, data): """ Validate Booster and data's feature_names are identical. Set feature_names and feature_types from DMatrix """ if self.feature_names is None: self.feature_names = data.feature_names self.feature_types = data.feature_t...
[ "Validate", "Booster", "and", "data", "s", "feature_names", "are", "identical", ".", "Set", "feature_names", "and", "feature_types", "from", "DMatrix" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L959-L972
[ "def", "_validate_features", "(", "self", ",", "data", ")", ":", "if", "self", ".", "feature_names", "is", "None", ":", "self", ".", "feature_names", "=", "data", ".", "feature_names", "self", ".", "feature_types", "=", "data", ".", "feature_types", "else", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
disassembler
Disassemble a code object. :param co: code object :param lasti: internal :yields: Instructions.
src/unity/python/turicreate/meta/bytecodetools/disassembler_.py
def disassembler(co, lasti= -1): """Disassemble a code object. :param co: code object :param lasti: internal :yields: Instructions. """ code = co.co_code labels = dis.findlabels(code) linestarts = dict(dis.findlinestarts(co)) i = 0 extended_arg = 0 lineno = 0 ...
def disassembler(co, lasti= -1): """Disassemble a code object. :param co: code object :param lasti: internal :yields: Instructions. """ code = co.co_code labels = dis.findlabels(code) linestarts = dict(dis.findlinestarts(co)) i = 0 extended_arg = 0 lineno = 0 ...
[ "Disassemble", "a", "code", "object", ".", ":", "param", "co", ":", "code", "object", ":", "param", "lasti", ":", "internal", ":", "yields", ":", "Instructions", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/bytecodetools/disassembler_.py#L58-L111
[ "def", "disassembler", "(", "co", ",", "lasti", "=", "-", "1", ")", ":", "code", "=", "co", ".", "co_code", "labels", "=", "dis", ".", "findlabels", "(", "code", ")", "linestarts", "=", "dict", "(", "dis", ".", "findlinestarts", "(", "co", ")", ")"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
transform
Matches all elements of 'list' agains the 'pattern' and returns a list of the elements indicated by indices of all successfull matches. If 'indices' is omitted returns a list of first paranthethised groups of all successfull matches.
deps/src/boost_1_68_0/tools/build/src/util/regex.py
def transform (list, pattern, indices = [1]): """ Matches all elements of 'list' agains the 'pattern' and returns a list of the elements indicated by indices of all successfull matches. If 'indices' is omitted returns a list of first paranthethised groups of all successfull matches. ...
def transform (list, pattern, indices = [1]): """ Matches all elements of 'list' agains the 'pattern' and returns a list of the elements indicated by indices of all successfull matches. If 'indices' is omitted returns a list of first paranthethised groups of all successfull matches. ...
[ "Matches", "all", "elements", "of", "list", "agains", "the", "pattern", "and", "returns", "a", "list", "of", "the", "elements", "indicated", "by", "indices", "of", "all", "successfull", "matches", ".", "If", "indices", "is", "omitted", "returns", "a", "list"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/regex.py#L11-L27
[ "def", "transform", "(", "list", ",", "pattern", ",", "indices", "=", "[", "1", "]", ")", ":", "result", "=", "[", "]", "for", "e", "in", "list", ":", "m", "=", "re", ".", "match", "(", "pattern", ",", "e", ")", "if", "m", ":", "for", "i", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
replace
Replaces occurrences of a match string in a given string and returns the new string. The match string can be a regex expression. Args: s (str): the string to modify pattern (str): the search expression replacement (str): the string to replace each match with
deps/src/boost_1_68_0/tools/build/src/util/regex.py
def replace(s, pattern, replacement): """Replaces occurrences of a match string in a given string and returns the new string. The match string can be a regex expression. Args: s (str): the string to modify pattern (str): the search expression replacement (str): the...
def replace(s, pattern, replacement): """Replaces occurrences of a match string in a given string and returns the new string. The match string can be a regex expression. Args: s (str): the string to modify pattern (str): the search expression replacement (str): the...
[ "Replaces", "occurrences", "of", "a", "match", "string", "in", "a", "given", "string", "and", "returns", "the", "new", "string", ".", "The", "match", "string", "can", "be", "a", "regex", "expression", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/regex.py#L31-L50
[ "def", "replace", "(", "s", ",", "pattern", ",", "replacement", ")", ":", "# the replacement string may contain invalid backreferences (like \\1 or \\g)", "# which will cause python's regex to blow up. Since this should emulate", "# the jam version exactly and the jam version didn't support"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
replace_list
Replaces occurrences of a match string in a given list of strings and returns a list of new strings. The match string can be a regex expression. Args: items (list): the list of strings to modify. match (str): the search expression. replacement (str): the string to replace ...
deps/src/boost_1_68_0/tools/build/src/util/regex.py
def replace_list(items, match, replacement): """Replaces occurrences of a match string in a given list of strings and returns a list of new strings. The match string can be a regex expression. Args: items (list): the list of strings to modify. match (str): the search expression...
def replace_list(items, match, replacement): """Replaces occurrences of a match string in a given list of strings and returns a list of new strings. The match string can be a regex expression. Args: items (list): the list of strings to modify. match (str): the search expression...
[ "Replaces", "occurrences", "of", "a", "match", "string", "in", "a", "given", "list", "of", "strings", "and", "returns", "a", "list", "of", "new", "strings", ".", "The", "match", "string", "can", "be", "a", "regex", "expression", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/regex.py#L54-L63
[ "def", "replace_list", "(", "items", ",", "match", ",", "replacement", ")", ":", "return", "[", "replace", "(", "item", ",", "match", ",", "replacement", ")", "for", "item", "in", "items", "]" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a topic model from the given data set. A topic model assumes each document is a mixture of a set of topics, where for each topic some words are more likely than others. One statistical approach to do this is called a "topic model". This method learns a topic model for the given document collectio...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def create(dataset, num_topics=10, initial_topics=None, alpha=None, beta=.1, num_iterations=10, num_burnin=5, associations=None, verbose=False, print_interval=10, validation_set=None, method='auto'):...
def create(dataset, num_topics=10, initial_topics=None, alpha=None, beta=.1, num_iterations=10, num_burnin=5, associations=None, verbose=False, print_interval=10, validation_set=None, method='auto'):...
[ "Create", "a", "topic", "model", "from", "the", "given", "data", "set", ".", "A", "topic", "model", "assumes", "each", "document", "is", "a", "mixture", "of", "a", "set", "of", "topics", "where", "for", "each", "topic", "some", "words", "are", "more", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L35-L271
[ "def", "create", "(", "dataset", ",", "num_topics", "=", "10", ",", "initial_topics", "=", "None", ",", "alpha", "=", "None", ",", "beta", "=", ".1", ",", "num_iterations", "=", "10", ",", "num_burnin", "=", "5", ",", "associations", "=", "None", ",", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
perplexity
Compute the perplexity of a set of test documents given a set of predicted topics. Let theta be the matrix of document-topic probabilities, where theta_ik = p(topic k | document i). Let Phi be the matrix of term-topic probabilities, where phi_jk = p(word j | topic k). Then for each word in each do...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def perplexity(test_data, predictions, topics, vocabulary): """ Compute the perplexity of a set of test documents given a set of predicted topics. Let theta be the matrix of document-topic probabilities, where theta_ik = p(topic k | document i). Let Phi be the matrix of term-topic probabilities...
def perplexity(test_data, predictions, topics, vocabulary): """ Compute the perplexity of a set of test documents given a set of predicted topics. Let theta be the matrix of document-topic probabilities, where theta_ik = p(topic k | document i). Let Phi be the matrix of term-topic probabilities...
[ "Compute", "the", "perplexity", "of", "a", "set", "of", "test", "documents", "given", "a", "set", "of", "predicted", "topics", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L740-L826
[ "def", "perplexity", "(", "test_data", ",", "predictions", ",", "topics", ",", "vocabulary", ")", ":", "test_data", "=", "_check_input", "(", "test_data", ")", "assert", "isinstance", "(", "predictions", ",", "_SArray", ")", ",", "\"Predictions must be an SArray o...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TopicModel._get_summary_struct
Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of list of tuples) A list of summary sections...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of lis...
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of lis...
[ "Returns", "a", "structured", "description", "of", "the", "model", "including", "(", "where", "relevant", ")", "the", "schema", "of", "the", "training", "data", "description", "of", "the", "training", "data", "training", "statistics", "and", "model", "hyperparam...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L303-L338
[ "def", "_get_summary_struct", "(", "self", ")", ":", "section_titles", "=", "[", "'Schema'", ",", "'Settings'", "]", "vocab_length", "=", "len", "(", "self", ".", "vocabulary", ")", "verbose", "=", "self", ".", "verbose", "==", "1", "sections", "=", "[", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TopicModel._get
Return the value of a given field. The list of all queryable fields is detailed below, and can be obtained with the :py:func:`~TopicModel._list_fields` method. +-----------------------+----------------------------------------------+ | Field | Description ...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def _get(self, field): """ Return the value of a given field. The list of all queryable fields is detailed below, and can be obtained with the :py:func:`~TopicModel._list_fields` method. +-----------------------+----------------------------------------------+ | Fiel...
def _get(self, field): """ Return the value of a given field. The list of all queryable fields is detailed below, and can be obtained with the :py:func:`~TopicModel._list_fields` method. +-----------------------+----------------------------------------------+ | Fiel...
[ "Return", "the", "value", "of", "a", "given", "field", ".", "The", "list", "of", "all", "queryable", "fields", "is", "detailed", "below", "and", "can", "be", "obtained", "with", "the", ":", "py", ":", "func", ":", "~TopicModel", ".", "_list_fields", "met...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L362-L394
[ "def", "_get", "(", "self", ",", "field", ")", ":", "opts", "=", "{", "'model'", ":", "self", ".", "__proxy__", ",", "'field'", ":", "field", "}", "response", "=", "_turicreate", ".", "extensions", ".", "_text", ".", "topicmodel_get_value", "(", "opts", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TopicModel._training_stats
Return a dictionary of statistics collected during creation of the model. These statistics are also available with the ``get`` method and are described in more detail in that method's documentation. Returns ------- out : dict Dictionary of statistics compiled during ...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def _training_stats(self): """ Return a dictionary of statistics collected during creation of the model. These statistics are also available with the ``get`` method and are described in more detail in that method's documentation. Returns ------- out : dict ...
def _training_stats(self): """ Return a dictionary of statistics collected during creation of the model. These statistics are also available with the ``get`` method and are described in more detail in that method's documentation. Returns ------- out : dict ...
[ "Return", "a", "dictionary", "of", "statistics", "collected", "during", "creation", "of", "the", "model", ".", "These", "statistics", "are", "also", "available", "with", "the", "get", "method", "and", "are", "described", "in", "more", "detail", "in", "that", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L396-L428
[ "def", "_training_stats", "(", "self", ")", ":", "fields", "=", "self", ".", "_list_fields", "(", ")", "stat_fields", "=", "[", "'training_time'", ",", "'training_iterations'", "]", "if", "'validation_perplexity'", "in", "fields", ":", "stat_fields", ".", "appen...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TopicModel.get_topics
Get the words associated with a given topic. The score column is the probability of choosing that word given that you have chosen a particular topic. Parameters ---------- topic_ids : list of int, optional The topics to retrieve words. Topic ids are zero-based. ...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def get_topics(self, topic_ids=None, num_words=5, cdf_cutoff=1.0, output_type='topic_probabilities'): """ Get the words associated with a given topic. The score column is the probability of choosing that word given that you have chosen a particular topic. Par...
def get_topics(self, topic_ids=None, num_words=5, cdf_cutoff=1.0, output_type='topic_probabilities'): """ Get the words associated with a given topic. The score column is the probability of choosing that word given that you have chosen a particular topic. Par...
[ "Get", "the", "words", "associated", "with", "a", "given", "topic", ".", "The", "score", "column", "is", "the", "probability", "of", "choosing", "that", "word", "given", "that", "you", "have", "chosen", "a", "particular", "topic", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L430-L568
[ "def", "get_topics", "(", "self", ",", "topic_ids", "=", "None", ",", "num_words", "=", "5", ",", "cdf_cutoff", "=", "1.0", ",", "output_type", "=", "'topic_probabilities'", ")", ":", "_check_categorical_option_type", "(", "'output_type'", ",", "output_type", ",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TopicModel.predict
Use the model to predict topics for each document. The provided `dataset` should be an SArray object where each element is a dict representing a single document in bag-of-words format, where keys are words and values are their corresponding counts. If `dataset` is an SFrame, then it must...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def predict(self, dataset, output_type='assignment', num_burnin=None): """ Use the model to predict topics for each document. The provided `dataset` should be an SArray object where each element is a dict representing a single document in bag-of-words format, where keys are words...
def predict(self, dataset, output_type='assignment', num_burnin=None): """ Use the model to predict topics for each document. The provided `dataset` should be an SArray object where each element is a dict representing a single document in bag-of-words format, where keys are words...
[ "Use", "the", "model", "to", "predict", "topics", "for", "each", "document", ".", "The", "provided", "dataset", "should", "be", "an", "SArray", "object", "where", "each", "element", "is", "a", "dict", "representing", "a", "single", "document", "in", "bag", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L570-L660
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'assignment'", ",", "num_burnin", "=", "None", ")", ":", "dataset", "=", "_check_input", "(", "dataset", ")", "if", "num_burnin", "is", "None", ":", "num_burnin", "=", "self", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
TopicModel.evaluate
Estimate the model's ability to predict new data. Imagine you have a corpus of books. One common approach to evaluating topic models is to train on the first half of all of the books and see how well the model predicts the second half of each book. This method returns a metric called pe...
src/unity/python/turicreate/toolkits/topic_model/topic_model.py
def evaluate(self, train_data, test_data=None, metric='perplexity'): """ Estimate the model's ability to predict new data. Imagine you have a corpus of books. One common approach to evaluating topic models is to train on the first half of all of the books and see how well the model ...
def evaluate(self, train_data, test_data=None, metric='perplexity'): """ Estimate the model's ability to predict new data. Imagine you have a corpus of books. One common approach to evaluating topic models is to train on the first half of all of the books and see how well the model ...
[ "Estimate", "the", "model", "s", "ability", "to", "predict", "new", "data", ".", "Imagine", "you", "have", "a", "corpus", "of", "books", ".", "One", "common", "approach", "to", "evaluating", "topic", "models", "is", "to", "train", "on", "the", "first", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/topic_model/topic_model.py#L663-L731
[ "def", "evaluate", "(", "self", ",", "train_data", ",", "test_data", "=", "None", ",", "metric", "=", "'perplexity'", ")", ":", "train_data", "=", "_check_input", "(", "train_data", ")", "if", "test_data", "is", "None", ":", "test_data", "=", "train_data", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
bbox_to_ybox
Convert from corner bounding box to center/shape
src/unity/python/turicreate/toolkits/object_detector/_detection.py
def bbox_to_ybox(bbox): """Convert from corner bounding box to center/shape""" return [ (bbox[1] + bbox[3]) / 2, (bbox[0] + bbox[2]) / 2, (bbox[3] - bbox[1]), (bbox[2] - bbox[0]), ]
def bbox_to_ybox(bbox): """Convert from corner bounding box to center/shape""" return [ (bbox[1] + bbox[3]) / 2, (bbox[0] + bbox[2]) / 2, (bbox[3] - bbox[1]), (bbox[2] - bbox[0]), ]
[ "Convert", "from", "corner", "bounding", "box", "to", "center", "/", "shape" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/_detection.py#L17-L24
[ "def", "bbox_to_ybox", "(", "bbox", ")", ":", "return", "[", "(", "bbox", "[", "1", "]", "+", "bbox", "[", "3", "]", ")", "/", "2", ",", "(", "bbox", "[", "0", "]", "+", "bbox", "[", "2", "]", ")", "/", "2", ",", "(", "bbox", "[", "3", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_raise_error_if_not_drawing_classifier_input_sframe
Performs some sanity checks on the SFrame provided as input to `turicreate.drawing_classifier.create` and raises a ToolkitError if something in the dataset is missing or wrong.
src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py
def _raise_error_if_not_drawing_classifier_input_sframe( dataset, feature, target): """ Performs some sanity checks on the SFrame provided as input to `turicreate.drawing_classifier.create` and raises a ToolkitError if something in the dataset is missing or wrong. """ from turicreate.toolki...
def _raise_error_if_not_drawing_classifier_input_sframe( dataset, feature, target): """ Performs some sanity checks on the SFrame provided as input to `turicreate.drawing_classifier.create` and raises a ToolkitError if something in the dataset is missing or wrong. """ from turicreate.toolki...
[ "Performs", "some", "sanity", "checks", "on", "the", "SFrame", "provided", "as", "input", "to", "turicreate", ".", "drawing_classifier", ".", "create", "and", "raises", "a", "ToolkitError", "if", "something", "in", "the", "dataset", "is", "missing", "or", "wro...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py#L22-L45
[ "def", "_raise_error_if_not_drawing_classifier_input_sframe", "(", "dataset", ",", "feature", ",", "target", ")", ":", "from", "turicreate", ".", "toolkits", ".", "_internal_utils", "import", "_raise_error_if_not_sframe", "_raise_error_if_not_sframe", "(", "dataset", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a :class:`DrawingClassifier` model. Parameters ---------- dataset : SFrame Input data. The columns named by the ``feature`` and ``target`` parameters will be extracted for training the drawing classifier. target : string Name of the column containing the target variable....
src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py
def create(input_dataset, target, feature=None, validation_set='auto', warm_start='auto', batch_size=256, max_iterations=100, verbose=True): """ Create a :class:`DrawingClassifier` model. Parameters ---------- dataset : SFrame Input data. The columns named by the ``...
def create(input_dataset, target, feature=None, validation_set='auto', warm_start='auto', batch_size=256, max_iterations=100, verbose=True): """ Create a :class:`DrawingClassifier` model. Parameters ---------- dataset : SFrame Input data. The columns named by the ``...
[ "Create", "a", ":", "class", ":", "DrawingClassifier", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py#L47-L329
[ "def", "create", "(", "input_dataset", ",", "target", ",", "feature", "=", "None", ",", "validation_set", "=", "'auto'", ",", "warm_start", "=", "'auto'", ",", "batch_size", "=", "256", ",", "max_iterations", "=", "100", ",", "verbose", "=", "True", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DrawingClassifier.export_coreml
Save the model in Core ML format. The Core ML model takes a grayscale drawing of fixed size as input and produces two outputs: `classLabel` and `labelProbabilities`. The first one, `classLabel` is an integer or string (depending on the classes the model was trained on) to store the la...
src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py
def export_coreml(self, filename, verbose=False): """ Save the model in Core ML format. The Core ML model takes a grayscale drawing of fixed size as input and produces two outputs: `classLabel` and `labelProbabilities`. The first one, `classLabel` is an integer or string (depe...
def export_coreml(self, filename, verbose=False): """ Save the model in Core ML format. The Core ML model takes a grayscale drawing of fixed size as input and produces two outputs: `classLabel` and `labelProbabilities`. The first one, `classLabel` is an integer or string (depe...
[ "Save", "the", "model", "in", "Core", "ML", "format", ".", "The", "Core", "ML", "model", "takes", "a", "grayscale", "drawing", "of", "fixed", "size", "as", "input", "and", "produces", "two", "outputs", ":", "classLabel", "and", "labelProbabilities", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py#L435-L519
[ "def", "export_coreml", "(", "self", ",", "filename", ",", "verbose", "=", "False", ")", ":", "import", "mxnet", "as", "_mx", "from", ".", ".", "_mxnet", ".", "_mxnet_to_coreml", "import", "_mxnet_converter", "import", "coremltools", "as", "_coremltools", "bat...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DrawingClassifier._predict_with_probabilities
Predict with probabilities. The core prediction part that both `evaluate` and `predict` share. Returns an SFrame with two columns, self.target, and "probabilities". The column with column name, self.target, contains the predictions made by the model for the provided dataset. ...
src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py
def _predict_with_probabilities(self, input_dataset, batch_size=None, verbose=True): """ Predict with probabilities. The core prediction part that both `evaluate` and `predict` share. Returns an SFrame with two columns, self.target, and "probabilities". The column wit...
def _predict_with_probabilities(self, input_dataset, batch_size=None, verbose=True): """ Predict with probabilities. The core prediction part that both `evaluate` and `predict` share. Returns an SFrame with two columns, self.target, and "probabilities". The column wit...
[ "Predict", "with", "probabilities", ".", "The", "core", "prediction", "part", "that", "both", "evaluate", "and", "predict", "share", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py#L522-L601
[ "def", "_predict_with_probabilities", "(", "self", ",", "input_dataset", ",", "batch_size", "=", "None", ",", "verbose", "=", "True", ")", ":", "from", ".", ".", "_mxnet", "import", "_mxnet_utils", "import", "mxnet", "as", "_mx", "from", ".", "_sframe_loader",...
74514c3f99e25b46f22c6e02977fe3da69221c2e