repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
Subvariant.implicit_includes
def implicit_includes (self, feature, target_type): """ Returns the properties which specify implicit include paths to generated headers. This traverses all targets in this subvariant, and subvariants referred by <implcit-dependecy>properties. For all targets which are of typ...
python
def implicit_includes (self, feature, target_type): """ Returns the properties which specify implicit include paths to generated headers. This traverses all targets in this subvariant, and subvariants referred by <implcit-dependecy>properties. For all targets which are of typ...
[ "def", "implicit_includes", "(", "self", ",", "feature", ",", "target_type", ")", ":", "assert", "isinstance", "(", "feature", ",", "basestring", ")", "assert", "isinstance", "(", "target_type", ",", "basestring", ")", "if", "not", "target_type", ":", "key", ...
Returns the properties which specify implicit include paths to generated headers. This traverses all targets in this subvariant, and subvariants referred by <implcit-dependecy>properties. For all targets which are of type 'target-type' (or for all targets, if 'target_type...
[ "Returns", "the", "properties", "which", "specify", "implicit", "include", "paths", "to", "generated", "headers", ".", "This", "traverses", "all", "targets", "in", "this", "subvariant", "and", "subvariants", "referred", "by", "<implcit", "-", "dependecy", ">", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L1131-L1154
train
apple/turicreate
src/unity/python/turicreate/meta/asttools/__init__.py
cmp_ast
def cmp_ast(node1, node2): ''' Compare if two nodes are equal. ''' if type(node1) != type(node2): return False if isinstance(node1, (list, tuple)): if len(node1) != len(node2): return False for left, right in zip(node1, node2): if not cmp_ast(left, ...
python
def cmp_ast(node1, node2): ''' Compare if two nodes are equal. ''' if type(node1) != type(node2): return False if isinstance(node1, (list, tuple)): if len(node1) != len(node2): return False for left, right in zip(node1, node2): if not cmp_ast(left, ...
[ "def", "cmp_ast", "(", "node1", ",", "node2", ")", ":", "if", "type", "(", "node1", ")", "!=", "type", "(", "node2", ")", ":", "return", "False", "if", "isinstance", "(", "node1", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "len", "(", ...
Compare if two nodes are equal.
[ "Compare", "if", "two", "nodes", "are", "equal", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/__init__.py#L23-L49
train
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
create_more_container_files
def create_more_container_files(sourceDir, suffix, maxElements, containers, containers2): """Creates additional files for the individual MPL-containers.""" # Create files for each MPL-container with 20 to 'maxElements' elements # which will be used during generation. for container in containers: ...
python
def create_more_container_files(sourceDir, suffix, maxElements, containers, containers2): """Creates additional files for the individual MPL-containers.""" # Create files for each MPL-container with 20 to 'maxElements' elements # which will be used during generation. for container in containers: ...
[ "def", "create_more_container_files", "(", "sourceDir", ",", "suffix", ",", "maxElements", ",", "containers", ",", "containers2", ")", ":", "# Create files for each MPL-container with 20 to 'maxElements' elements", "# which will be used during generation.", "for", "container", "i...
Creates additional files for the individual MPL-containers.
[ "Creates", "additional", "files", "for", "the", "individual", "MPL", "-", "containers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L21-L53
train
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
create_input_for_numbered_sequences
def create_input_for_numbered_sequences(headerDir, sourceDir, containers, maxElements): """Creates additional source- and header-files for the numbered sequence MPL-containers.""" # Create additional container-list without "map". containersWithoutMap = containers[:] try: containersWithoutMap.rem...
python
def create_input_for_numbered_sequences(headerDir, sourceDir, containers, maxElements): """Creates additional source- and header-files for the numbered sequence MPL-containers.""" # Create additional container-list without "map". containersWithoutMap = containers[:] try: containersWithoutMap.rem...
[ "def", "create_input_for_numbered_sequences", "(", "headerDir", ",", "sourceDir", ",", "containers", ",", "maxElements", ")", ":", "# Create additional container-list without \"map\".", "containersWithoutMap", "=", "containers", "[", ":", "]", "try", ":", "containersWithout...
Creates additional source- and header-files for the numbered sequence MPL-containers.
[ "Creates", "additional", "source", "-", "and", "header", "-", "files", "for", "the", "numbered", "sequence", "MPL", "-", "containers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L56-L67
train
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
adjust_container_limits_for_variadic_sequences
def adjust_container_limits_for_variadic_sequences(headerDir, containers, maxElements): """Adjusts the limits of variadic sequence MPL-containers.""" for container in containers: headerFile = os.path.join( headerDir, "limits", container + ".hpp" ) regexMatch = r'(define\s+BOOST_MPL_LIMIT_' + c...
python
def adjust_container_limits_for_variadic_sequences(headerDir, containers, maxElements): """Adjusts the limits of variadic sequence MPL-containers.""" for container in containers: headerFile = os.path.join( headerDir, "limits", container + ".hpp" ) regexMatch = r'(define\s+BOOST_MPL_LIMIT_' + c...
[ "def", "adjust_container_limits_for_variadic_sequences", "(", "headerDir", ",", "containers", ",", "maxElements", ")", ":", "for", "container", "in", "containers", ":", "headerFile", "=", "os", ".", "path", ".", "join", "(", "headerDir", ",", "\"limits\"", ",", ...
Adjusts the limits of variadic sequence MPL-containers.
[ "Adjusts", "the", "limits", "of", "variadic", "sequence", "MPL", "-", "containers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L70-L78
train
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
current_boost_dir
def current_boost_dir(): """Returns the (relative) path to the Boost source-directory this file is located in (if any).""" # Path to directory containing this script. path = os.path.dirname( os.path.realpath(__file__) ) # Making sure it is located in "${boost-dir}/libs/mpl/preprocessed". for directo...
python
def current_boost_dir(): """Returns the (relative) path to the Boost source-directory this file is located in (if any).""" # Path to directory containing this script. path = os.path.dirname( os.path.realpath(__file__) ) # Making sure it is located in "${boost-dir}/libs/mpl/preprocessed". for directo...
[ "def", "current_boost_dir", "(", ")", ":", "# Path to directory containing this script.", "path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", "# Making sure it is located in \"${boost-dir}/libs/mpl/preproce...
Returns the (relative) path to the Boost source-directory this file is located in (if any).
[ "Returns", "the", "(", "relative", ")", "path", "to", "the", "Boost", "source", "-", "directory", "this", "file", "is", "located", "in", "(", "if", "any", ")", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L81-L92
train
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
to_positive_multiple_of_10
def to_positive_multiple_of_10(string): """Converts a string into its encoded positive integer (greater zero) or throws an exception.""" try: value = int(string) except ValueError: msg = '"%r" is not a positive multiple of 10 (greater zero).' % string raise argparse.ArgumentTypeError...
python
def to_positive_multiple_of_10(string): """Converts a string into its encoded positive integer (greater zero) or throws an exception.""" try: value = int(string) except ValueError: msg = '"%r" is not a positive multiple of 10 (greater zero).' % string raise argparse.ArgumentTypeError...
[ "def", "to_positive_multiple_of_10", "(", "string", ")", ":", "try", ":", "value", "=", "int", "(", "string", ")", "except", "ValueError", ":", "msg", "=", "'\"%r\" is not a positive multiple of 10 (greater zero).'", "%", "string", "raise", "argparse", ".", "Argumen...
Converts a string into its encoded positive integer (greater zero) or throws an exception.
[ "Converts", "a", "string", "into", "its", "encoded", "positive", "integer", "(", "greater", "zero", ")", "or", "throws", "an", "exception", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L96-L106
train
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
main
def main(): """The main function.""" # Find the current Boost source-directory in which this script is located. sourceDir = current_boost_dir() if sourceDir == None: sourceDir = "" # Prepare and run cmdline-parser. cmdlineParser = argparse.ArgumentParser(description="A generato...
python
def main(): """The main function.""" # Find the current Boost source-directory in which this script is located. sourceDir = current_boost_dir() if sourceDir == None: sourceDir = "" # Prepare and run cmdline-parser. cmdlineParser = argparse.ArgumentParser(description="A generato...
[ "def", "main", "(", ")", ":", "# Find the current Boost source-directory in which this script is located.", "sourceDir", "=", "current_boost_dir", "(", ")", "if", "sourceDir", "==", "None", ":", "sourceDir", "=", "\"\"", "# Prepare and run cmdline-parser.", "cmdlineParser", ...
The main function.
[ "The", "main", "function", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L118-L246
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py
NeuralNetworkBuilder.add_inner_product
def add_inner_product(self, name, W, b, input_channels, output_channels, has_bias, input_name, output_name, **kwargs): """ Add an inner product layer to the model. Parameters ---------- name: str The name of this layer W: numpy.array...
python
def add_inner_product(self, name, W, b, input_channels, output_channels, has_bias, input_name, output_name, **kwargs): """ Add an inner product layer to the model. Parameters ---------- name: str The name of this layer W: numpy.array...
[ "def", "add_inner_product", "(", "self", ",", "name", ",", "W", ",", "b", ",", "input_channels", ",", "output_channels", ",", "has_bias", ",", "input_name", ",", "output_name", ",", "*", "*", "kwargs", ")", ":", "spec", "=", "self", ".", "spec", "nn_spec...
Add an inner product layer to the model. Parameters ---------- name: str The name of this layer W: numpy.array or bytes() Weight matrix of shape (output_channels, input_channels) If W is of type bytes(), i.e. quantized, other quantization related argu...
[ "Add", "an", "inner", "product", "layer", "to", "the", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L394-L471
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py
NeuralNetworkBuilder.add_convolution
def add_convolution(self, name, kernel_channels, output_channels, height, width, stride_height, stride_width, border_mode, groups, W, b, has_bias, is_deconv = False, output_shape = None, input_name = 'data', output_name = 'out', dilation_factors = [1,1], paddi...
python
def add_convolution(self, name, kernel_channels, output_channels, height, width, stride_height, stride_width, border_mode, groups, W, b, has_bias, is_deconv = False, output_shape = None, input_name = 'data', output_name = 'out', dilation_factors = [1,1], paddi...
[ "def", "add_convolution", "(", "self", ",", "name", ",", "kernel_channels", ",", "output_channels", ",", "height", ",", "width", ",", "stride_height", ",", "stride_width", ",", "border_mode", ",", "groups", ",", "W", ",", "b", ",", "has_bias", ",", "is_decon...
Add a convolution layer to the network. Please see the ConvolutionLayerParams in Core ML neural network protobuf message for more information about input and output blob dimensions. Parameters ---------- name: str The name of this layer. kernel_channels: int...
[ "Add", "a", "convolution", "layer", "to", "the", "network", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L967-L1167
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py
NeuralNetworkBuilder.add_resize_bilinear
def add_resize_bilinear(self, name, input_name, output_name, target_height=1, target_width=1, mode='ALIGN_ENDPOINTS_MODE'): """ Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ...
python
def add_resize_bilinear(self, name, input_name, output_name, target_height=1, target_width=1, mode='ALIGN_ENDPOINTS_MODE'): """ Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ...
[ "def", "add_resize_bilinear", "(", "self", ",", "name", ",", "input_name", ",", "output_name", ",", "target_height", "=", "1", ",", "target_width", "=", "1", ",", "mode", "=", "'ALIGN_ENDPOINTS_MODE'", ")", ":", "spec", "=", "self", ".", "spec", "nn_spec", ...
Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ---------- name: str The name of this layer. input_name: str The input blob name of this layer. output_name: str ...
[ "Add", "resize", "bilinear", "layer", "to", "the", "model", ".", "A", "layer", "that", "resizes", "the", "input", "to", "a", "given", "spatial", "size", "using", "bilinear", "interpolation", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L2612-L2657
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py
NeuralNetworkBuilder.add_crop_resize
def add_crop_resize(self, name, input_names, output_name, target_height=1, target_width=1, mode='STRICT_ALIGN_ENDPOINTS_MODE', normalized_roi=False, box_indices_mode='CORNERS_HEIGHT_FIRST', spatial_scale=1.0)...
python
def add_crop_resize(self, name, input_names, output_name, target_height=1, target_width=1, mode='STRICT_ALIGN_ENDPOINTS_MODE', normalized_roi=False, box_indices_mode='CORNERS_HEIGHT_FIRST', spatial_scale=1.0)...
[ "def", "add_crop_resize", "(", "self", ",", "name", ",", "input_names", ",", "output_name", ",", "target_height", "=", "1", ",", "target_width", "=", "1", ",", "mode", "=", "'STRICT_ALIGN_ENDPOINTS_MODE'", ",", "normalized_roi", "=", "False", ",", "box_indices_m...
Add crop resize layer to the model. A layer that extracts cropped spatial patches or RoIs (regions of interest) from the input and resizes them to a pre-specified size using bilinear interpolation. Note that RoI Align layer can be implemented with this layer followed by a pooling layer. Kindly r...
[ "Add", "crop", "resize", "layer", "to", "the", "model", ".", "A", "layer", "that", "extracts", "cropped", "spatial", "patches", "or", "RoIs", "(", "regions", "of", "interest", ")", "from", "the", "input", "and", "resizes", "them", "to", "a", "pre", "-", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L2659-L2753
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkit_serialize_summary_struct
def _toolkit_serialize_summary_struct(model, sections, section_titles): """ Serialize model summary into a dict with ordered lists of sections and section titles Parameters ---------- model : Model object sections : Ordered list of lists (sections) of tuples (field,value) [ [(fi...
python
def _toolkit_serialize_summary_struct(model, sections, section_titles): """ Serialize model summary into a dict with ordered lists of sections and section titles Parameters ---------- model : Model object sections : Ordered list of lists (sections) of tuples (field,value) [ [(fi...
[ "def", "_toolkit_serialize_summary_struct", "(", "model", ",", "sections", ",", "section_titles", ")", ":", "output_dict", "=", "dict", "(", ")", "output_dict", "[", "'sections'", "]", "=", "[", "[", "(", "field", "[", "0", "]", ",", "__extract_model_summary_v...
Serialize model summary into a dict with ordered lists of sections and section titles Parameters ---------- model : Model object sections : Ordered list of lists (sections) of tuples (field,value) [ [(field1, value1), (field2, value2)], [(field3, value3), (field4, value4)], ...
[ "Serialize", "model", "summary", "into", "a", "dict", "with", "ordered", "lists", "of", "sections", "and", "section", "titles" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L34-L61
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_add_docstring
def _add_docstring(format_dict): """ Format a doc-string on the fly. @arg format_dict: A dictionary to format the doc-strings Example: @add_docstring({'context': __doc_string_context}) def predict(x): ''' {context} >> model.predict(data) '...
python
def _add_docstring(format_dict): """ Format a doc-string on the fly. @arg format_dict: A dictionary to format the doc-strings Example: @add_docstring({'context': __doc_string_context}) def predict(x): ''' {context} >> model.predict(data) '...
[ "def", "_add_docstring", "(", "format_dict", ")", ":", "def", "add_docstring_context", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "wr...
Format a doc-string on the fly. @arg format_dict: A dictionary to format the doc-strings Example: @add_docstring({'context': __doc_string_context}) def predict(x): ''' {context} >> model.predict(data) ''' return x
[ "Format", "a", "doc", "-", "string", "on", "the", "fly", ".", "@arg", "format_dict", ":", "A", "dictionary", "to", "format", "the", "doc", "-", "strings", "Example", ":" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L64-L83
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_find_only_column_of_type
def _find_only_column_of_type(sframe, target_type, type_name, col_name): """ Finds the only column in `SFrame` with a type specified by `target_type`. If there are zero or more than one such columns, an exception will be raised. The name and type of the target column should be provided as strings fo...
python
def _find_only_column_of_type(sframe, target_type, type_name, col_name): """ Finds the only column in `SFrame` with a type specified by `target_type`. If there are zero or more than one such columns, an exception will be raised. The name and type of the target column should be provided as strings fo...
[ "def", "_find_only_column_of_type", "(", "sframe", ",", "target_type", ",", "type_name", ",", "col_name", ")", ":", "image_column_name", "=", "None", "if", "type", "(", "target_type", ")", "!=", "list", ":", "target_type", "=", "[", "target_type", "]", "for", ...
Finds the only column in `SFrame` with a type specified by `target_type`. If there are zero or more than one such columns, an exception will be raised. The name and type of the target column should be provided as strings for the purpose of error feedback.
[ "Finds", "the", "only", "column", "in", "SFrame", "with", "a", "type", "specified", "by", "target_type", ".", "If", "there", "are", "zero", "or", "more", "than", "one", "such", "columns", "an", "exception", "will", "be", "raised", ".", "The", "name", "an...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L86-L103
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_find_only_image_column
def _find_only_image_column(sframe): """ Finds the only column in `sframe` with a type of turicreate.Image. If there are zero or more than one image columns, an exception will be raised. """ from turicreate import Image return _find_only_column_of_type(sframe, target_type=Image, ...
python
def _find_only_image_column(sframe): """ Finds the only column in `sframe` with a type of turicreate.Image. If there are zero or more than one image columns, an exception will be raised. """ from turicreate import Image return _find_only_column_of_type(sframe, target_type=Image, ...
[ "def", "_find_only_image_column", "(", "sframe", ")", ":", "from", "turicreate", "import", "Image", "return", "_find_only_column_of_type", "(", "sframe", ",", "target_type", "=", "Image", ",", "type_name", "=", "'image'", ",", "col_name", "=", "'feature'", ")" ]
Finds the only column in `sframe` with a type of turicreate.Image. If there are zero or more than one image columns, an exception will be raised.
[ "Finds", "the", "only", "column", "in", "sframe", "with", "a", "type", "of", "turicreate", ".", "Image", ".", "If", "there", "are", "zero", "or", "more", "than", "one", "image", "columns", "an", "exception", "will", "be", "raised", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L105-L113
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_find_only_drawing_column
def _find_only_drawing_column(sframe): """ Finds the only column that can be interpreted as a drawing feature column. A drawing column can be a stroke-based drawing column (with dtype list) or a bitmap-based drawing column (with dtype turicreate.Image) If there are zero or more than one drawing...
python
def _find_only_drawing_column(sframe): """ Finds the only column that can be interpreted as a drawing feature column. A drawing column can be a stroke-based drawing column (with dtype list) or a bitmap-based drawing column (with dtype turicreate.Image) If there are zero or more than one drawing...
[ "def", "_find_only_drawing_column", "(", "sframe", ")", ":", "from", "turicreate", "import", "Image", "bitmap_success", ",", "stroke_success", "=", "False", ",", "False", "bitmap_error", ",", "stroke_error", "=", "None", ",", "None", "feature", "=", "None", "try...
Finds the only column that can be interpreted as a drawing feature column. A drawing column can be a stroke-based drawing column (with dtype list) or a bitmap-based drawing column (with dtype turicreate.Image) If there are zero or more than one drawing columns, an exception will be raised.
[ "Finds", "the", "only", "column", "that", "can", "be", "interpreted", "as", "a", "drawing", "feature", "column", ".", "A", "drawing", "column", "can", "be", "a", "stroke", "-", "based", "drawing", "column", "(", "with", "dtype", "list", ")", "or", "a", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L115-L201
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_SGraphFromJsonTree
def _SGraphFromJsonTree(json_str): """ Convert the Json Tree to SGraph """ g = json.loads(json_str) vertices = [_Vertex(x['id'], dict([(str(k), v) for k, v in _six.iteritems(x) if k != 'id'])) for x in g['vertices']] edges = [...
python
def _SGraphFromJsonTree(json_str): """ Convert the Json Tree to SGraph """ g = json.loads(json_str) vertices = [_Vertex(x['id'], dict([(str(k), v) for k, v in _six.iteritems(x) if k != 'id'])) for x in g['vertices']] edges = [...
[ "def", "_SGraphFromJsonTree", "(", "json_str", ")", ":", "g", "=", "json", ".", "loads", "(", "json_str", ")", "vertices", "=", "[", "_Vertex", "(", "x", "[", "'id'", "]", ",", "dict", "(", "[", "(", "str", "(", "k", ")", ",", "v", ")", "for", ...
Convert the Json Tree to SGraph
[ "Convert", "the", "Json", "Tree", "to", "SGraph" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L203-L217
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_summarize_coefficients
def _summarize_coefficients(top_coefs, bottom_coefs): """ Return a tuple of sections and section titles. Sections are pretty print of model coefficients Parameters ---------- top_coefs : SFrame of top k coefficients bottom_coefs : SFrame of bottom k coefficients Returns ------- ...
python
def _summarize_coefficients(top_coefs, bottom_coefs): """ Return a tuple of sections and section titles. Sections are pretty print of model coefficients Parameters ---------- top_coefs : SFrame of top k coefficients bottom_coefs : SFrame of bottom k coefficients Returns ------- ...
[ "def", "_summarize_coefficients", "(", "top_coefs", ",", "bottom_coefs", ")", ":", "def", "get_row_name", "(", "row", ")", ":", "if", "row", "[", "'index'", "]", "is", "None", ":", "return", "row", "[", "'name'", "]", "else", ":", "return", "\"%s[%s]\"", ...
Return a tuple of sections and section titles. Sections are pretty print of model coefficients Parameters ---------- top_coefs : SFrame of top k coefficients bottom_coefs : SFrame of bottom k coefficients Returns ------- (sections, section_titles) : tuple sections : list ...
[ "Return", "a", "tuple", "of", "sections", "and", "section", "titles", ".", "Sections", "are", "pretty", "print", "of", "model", "coefficients" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L223-L264
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkit_get_topk_bottomk
def _toolkit_get_topk_bottomk(values, k=5): """ Returns a tuple of the top k values from the positive and negative values in a SArray Parameters ---------- values : SFrame of model coefficients k: Maximum number of largest positive and k lowest negative numbers to return Returns -...
python
def _toolkit_get_topk_bottomk(values, k=5): """ Returns a tuple of the top k values from the positive and negative values in a SArray Parameters ---------- values : SFrame of model coefficients k: Maximum number of largest positive and k lowest negative numbers to return Returns -...
[ "def", "_toolkit_get_topk_bottomk", "(", "values", ",", "k", "=", "5", ")", ":", "top_values", "=", "values", ".", "topk", "(", "'value'", ",", "k", "=", "k", ")", "top_values", "=", "top_values", "[", "top_values", "[", "'value'", "]", ">", "0", "]", ...
Returns a tuple of the top k values from the positive and negative values in a SArray Parameters ---------- values : SFrame of model coefficients k: Maximum number of largest positive and k lowest negative numbers to return Returns ------- (topk_positive, bottomk_positive) : tuple ...
[ "Returns", "a", "tuple", "of", "the", "top", "k", "values", "from", "the", "positive", "and", "negative", "values", "in", "a", "SArray" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L266-L294
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
__extract_model_summary_value
def __extract_model_summary_value(model, value): """ Extract a model summary field value """ field_value = None if isinstance(value, _precomputed_field): field_value = value.field else: field_value = model._get(value) if isinstance(field_value, float): try: ...
python
def __extract_model_summary_value(model, value): """ Extract a model summary field value """ field_value = None if isinstance(value, _precomputed_field): field_value = value.field else: field_value = model._get(value) if isinstance(field_value, float): try: ...
[ "def", "__extract_model_summary_value", "(", "model", ",", "value", ")", ":", "field_value", "=", "None", "if", "isinstance", "(", "value", ",", "_precomputed_field", ")", ":", "field_value", "=", "value", ".", "field", "else", ":", "field_value", "=", "model"...
Extract a model summary field value
[ "Extract", "a", "model", "summary", "field", "value" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L320-L334
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_make_repr_table_from_sframe
def _make_repr_table_from_sframe(X): """ Serializes an SFrame to a list of strings, that, when printed, creates a well-formatted table. """ assert isinstance(X, _SFrame) column_names = X.column_names() out_data = [ [None]*len(column_names) for i in range(X.num_rows())] column_sizes = [le...
python
def _make_repr_table_from_sframe(X): """ Serializes an SFrame to a list of strings, that, when printed, creates a well-formatted table. """ assert isinstance(X, _SFrame) column_names = X.column_names() out_data = [ [None]*len(column_names) for i in range(X.num_rows())] column_sizes = [le...
[ "def", "_make_repr_table_from_sframe", "(", "X", ")", ":", "assert", "isinstance", "(", "X", ",", "_SFrame", ")", "column_names", "=", "X", ".", "column_names", "(", ")", "out_data", "=", "[", "[", "None", "]", "*", "len", "(", "column_names", ")", "for"...
Serializes an SFrame to a list of strings, that, when printed, creates a well-formatted table.
[ "Serializes", "an", "SFrame", "to", "a", "list", "of", "strings", "that", "when", "printed", "creates", "a", "well", "-", "formatted", "table", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L336-L359
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkit_repr_print
def _toolkit_repr_print(model, fields, section_titles, width = None): """ Display a toolkit repr according to some simple rules. Parameters ---------- model : Turi Create model fields: List of lists of tuples Each tuple should be (display_name, field_name), where field_name can ...
python
def _toolkit_repr_print(model, fields, section_titles, width = None): """ Display a toolkit repr according to some simple rules. Parameters ---------- model : Turi Create model fields: List of lists of tuples Each tuple should be (display_name, field_name), where field_name can ...
[ "def", "_toolkit_repr_print", "(", "model", ",", "fields", ",", "section_titles", ",", "width", "=", "None", ")", ":", "assert", "len", "(", "section_titles", ")", "==", "len", "(", "fields", ")", ",", "\"The number of section titles ({0}) \"", ".", "format", ...
Display a toolkit repr according to some simple rules. Parameters ---------- model : Turi Create model fields: List of lists of tuples Each tuple should be (display_name, field_name), where field_name can be a string or a _precomputed_field object. section_titles: List of section...
[ "Display", "a", "toolkit", "repr", "according", "to", "some", "simple", "rules", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L362-L446
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_map_unity_proxy_to_object
def _map_unity_proxy_to_object(value): """ Map returning value, if it is unity SFrame, SArray, map it """ vtype = type(value) if vtype in _proxy_map: return _proxy_map[vtype](value) elif vtype == list: return [_map_unity_proxy_to_object(v) for v in value] elif vtype == dict: ...
python
def _map_unity_proxy_to_object(value): """ Map returning value, if it is unity SFrame, SArray, map it """ vtype = type(value) if vtype in _proxy_map: return _proxy_map[vtype](value) elif vtype == list: return [_map_unity_proxy_to_object(v) for v in value] elif vtype == dict: ...
[ "def", "_map_unity_proxy_to_object", "(", "value", ")", ":", "vtype", "=", "type", "(", "value", ")", "if", "vtype", "in", "_proxy_map", ":", "return", "_proxy_map", "[", "vtype", "]", "(", "value", ")", "elif", "vtype", "==", "list", ":", "return", "[",...
Map returning value, if it is unity SFrame, SArray, map it
[ "Map", "returning", "value", "if", "it", "is", "unity", "SFrame", "SArray", "map", "it" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L448-L460
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkits_select_columns
def _toolkits_select_columns(dataset, columns): """ Same as select columns but redirect runtime error to ToolkitError. """ try: return dataset.select_columns(columns) except RuntimeError: missing_features = list(set(columns).difference(set(dataset.column_names()))) raise Tool...
python
def _toolkits_select_columns(dataset, columns): """ Same as select columns but redirect runtime error to ToolkitError. """ try: return dataset.select_columns(columns) except RuntimeError: missing_features = list(set(columns).difference(set(dataset.column_names()))) raise Tool...
[ "def", "_toolkits_select_columns", "(", "dataset", ",", "columns", ")", ":", "try", ":", "return", "dataset", ".", "select_columns", "(", "columns", ")", "except", "RuntimeError", ":", "missing_features", "=", "list", "(", "set", "(", "columns", ")", ".", "d...
Same as select columns but redirect runtime error to ToolkitError.
[ "Same", "as", "select", "columns", "but", "redirect", "runtime", "error", "to", "ToolkitError", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L462-L471
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_if_column_exists
def _raise_error_if_column_exists(dataset, column_name = 'dataset', dataset_variable_name = 'dataset', column_name_error_message_name = 'column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must...
python
def _raise_error_if_column_exists(dataset, column_name = 'dataset', dataset_variable_name = 'dataset', column_name_error_message_name = 'column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must...
[ "def", "_raise_error_if_column_exists", "(", "dataset", ",", "column_name", "=", "'dataset'", ",", "dataset_variable_name", "=", "'dataset'", ",", "column_name_error_message_name", "=", "'column_name'", ")", ":", "err_msg", "=", "'The SFrame {0} must contain the column {1}.'"...
Check if a column exists in an SFrame with error message.
[ "Check", "if", "a", "column", "exists", "in", "an", "SFrame", "with", "error", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L473-L483
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_check_categorical_option_type
def _check_categorical_option_type(option_name, option_value, possible_values): """ Check whether or not the requested option is one of the allowed values. """ err_msg = '{0} is not a valid option for {1}. '.format(option_value, option_name) err_msg += ' Expected one of: '.format(possible_values) ...
python
def _check_categorical_option_type(option_name, option_value, possible_values): """ Check whether or not the requested option is one of the allowed values. """ err_msg = '{0} is not a valid option for {1}. '.format(option_value, option_name) err_msg += ' Expected one of: '.format(possible_values) ...
[ "def", "_check_categorical_option_type", "(", "option_name", ",", "option_value", ",", "possible_values", ")", ":", "err_msg", "=", "'{0} is not a valid option for {1}. '", ".", "format", "(", "option_value", ",", "option_name", ")", "err_msg", "+=", "' Expected one of: '...
Check whether or not the requested option is one of the allowed values.
[ "Check", "whether", "or", "not", "the", "requested", "option", "is", "one", "of", "the", "allowed", "values", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L485-L494
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_if_not_sarray
def _raise_error_if_not_sarray(dataset, variable_name="SArray"): """ Check if the input is an SArray. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SArray." if not isinstance(dataset, _SArray): raise ToolkitError(err_msg % variable_name)
python
def _raise_error_if_not_sarray(dataset, variable_name="SArray"): """ Check if the input is an SArray. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SArray." if not isinstance(dataset, _SArray): raise ToolkitError(err_msg % variable_name)
[ "def", "_raise_error_if_not_sarray", "(", "dataset", ",", "variable_name", "=", "\"SArray\"", ")", ":", "err_msg", "=", "\"Input %s is not an SArray.\"", "if", "not", "isinstance", "(", "dataset", ",", "_SArray", ")", ":", "raise", "ToolkitError", "(", "err_msg", ...
Check if the input is an SArray. Provide a proper error message otherwise.
[ "Check", "if", "the", "input", "is", "an", "SArray", ".", "Provide", "a", "proper", "error", "message", "otherwise", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L496-L503
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_if_not_sframe
def _raise_error_if_not_sframe(dataset, variable_name="SFrame"): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SFrame. If it is a Pandas DataFrame," err_msg += " you may use the to_sframe() function to convert it to an SFrame." ...
python
def _raise_error_if_not_sframe(dataset, variable_name="SFrame"): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SFrame. If it is a Pandas DataFrame," err_msg += " you may use the to_sframe() function to convert it to an SFrame." ...
[ "def", "_raise_error_if_not_sframe", "(", "dataset", ",", "variable_name", "=", "\"SFrame\"", ")", ":", "err_msg", "=", "\"Input %s is not an SFrame. If it is a Pandas DataFrame,\"", "err_msg", "+=", "\" you may use the to_sframe() function to convert it to an SFrame.\"", "if", "no...
Check if the input is an SFrame. Provide a proper error message otherwise.
[ "Check", "if", "the", "input", "is", "an", "SFrame", ".", "Provide", "a", "proper", "error", "message", "otherwise", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L511-L520
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_if_sframe_empty
def _raise_error_if_sframe_empty(dataset, variable_name="SFrame"): """ Check if the input is empty. """ err_msg = "Input %s either has no rows or no columns. A non-empty SFrame " err_msg += "is required." if dataset.num_rows() == 0 or dataset.num_columns() == 0: raise ToolkitError(err_m...
python
def _raise_error_if_sframe_empty(dataset, variable_name="SFrame"): """ Check if the input is empty. """ err_msg = "Input %s either has no rows or no columns. A non-empty SFrame " err_msg += "is required." if dataset.num_rows() == 0 or dataset.num_columns() == 0: raise ToolkitError(err_m...
[ "def", "_raise_error_if_sframe_empty", "(", "dataset", ",", "variable_name", "=", "\"SFrame\"", ")", ":", "err_msg", "=", "\"Input %s either has no rows or no columns. A non-empty SFrame \"", "err_msg", "+=", "\"is required.\"", "if", "dataset", ".", "num_rows", "(", ")", ...
Check if the input is empty.
[ "Check", "if", "the", "input", "is", "empty", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L522-L530
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_evaluation_metric_is_valid
def _raise_error_evaluation_metric_is_valid(metric, allowed_metrics): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Evaluation metric '%s' not recognized. The supported evaluation" err_msg += " metrics are (%s)." if metric not in allowed_metr...
python
def _raise_error_evaluation_metric_is_valid(metric, allowed_metrics): """ Check if the input is an SFrame. Provide a proper error message otherwise. """ err_msg = "Evaluation metric '%s' not recognized. The supported evaluation" err_msg += " metrics are (%s)." if metric not in allowed_metr...
[ "def", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "allowed_metrics", ")", ":", "err_msg", "=", "\"Evaluation metric '%s' not recognized. The supported evaluation\"", "err_msg", "+=", "\" metrics are (%s).\"", "if", "metric", "not", "in", "allowed_metrics", "...
Check if the input is an SFrame. Provide a proper error message otherwise.
[ "Check", "if", "the", "input", "is", "an", "SFrame", ".", "Provide", "a", "proper", "error", "message", "otherwise", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L541-L552
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_numeric_param_check_range
def _numeric_param_check_range(variable_name, variable_value, range_bottom, range_top): """ Checks if numeric parameter is within given range """ err_msg = "%s must be between %i and %i" if variable_value < range_bottom or variable_value > range_top: raise ToolkitError(err_msg % (variable_n...
python
def _numeric_param_check_range(variable_name, variable_value, range_bottom, range_top): """ Checks if numeric parameter is within given range """ err_msg = "%s must be between %i and %i" if variable_value < range_bottom or variable_value > range_top: raise ToolkitError(err_msg % (variable_n...
[ "def", "_numeric_param_check_range", "(", "variable_name", ",", "variable_value", ",", "range_bottom", ",", "range_top", ")", ":", "err_msg", "=", "\"%s must be between %i and %i\"", "if", "variable_value", "<", "range_bottom", "or", "variable_value", ">", "range_top", ...
Checks if numeric parameter is within given range
[ "Checks", "if", "numeric", "parameter", "is", "within", "given", "range" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L554-L561
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_validate_data
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
python
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
[ "def", "_validate_data", "(", "dataset", ",", "target", ",", "features", "=", "None", ",", "validation_set", "=", "'auto'", ")", ":", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"training dataset\"", ")", "# Determine columns to keep", "if", "features", "is...
Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. features : list[string], optional List of feature names used. validation_s...
[ "Validate", "and", "canonicalize", "training", "and", "validation", "data", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L563-L625
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_validate_row_label
def _validate_row_label(dataset, label=None, default_label='__id'): """ Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset....
python
def _validate_row_label(dataset, label=None, default_label='__id'): """ Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset....
[ "def", "_validate_row_label", "(", "dataset", ",", "label", "=", "None", ",", "default_label", "=", "'__id'", ")", ":", "## If no label is provided, set it to be a default and add a row number to", "# dataset. Check that this new name does not conflict with an existing", "# name.",...
Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset. label : str, optional Name of the column containing row labels. ...
[ "Validate", "a", "row", "label", "column", ".", "If", "the", "row", "label", "is", "not", "specified", "a", "column", "is", "created", "with", "row", "numbers", "named", "with", "the", "string", "in", "the", "default_label", "parameter", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L627-L682
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_mac_ver
def _mac_ver(): """ Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple. """ import platform import sys if sys.platform == 'darwin': ver_str = platform.mac_ver()[0] return tuple([int(v) for v in v...
python
def _mac_ver(): """ Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple. """ import platform import sys if sys.platform == 'darwin': ver_str = platform.mac_ver()[0] return tuple([int(v) for v in v...
[ "def", "_mac_ver", "(", ")", ":", "import", "platform", "import", "sys", "if", "sys", ".", "platform", "==", "'darwin'", ":", "ver_str", "=", "platform", ".", "mac_ver", "(", ")", "[", "0", "]", "return", "tuple", "(", "[", "int", "(", "v", ")", "f...
Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple.
[ "Returns", "Mac", "version", "as", "a", "tuple", "of", "integers", "making", "it", "easy", "to", "do", "proper", "version", "comparisons", ".", "On", "non", "-", "Macs", "it", "returns", "an", "empty", "tuple", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L698-L709
train
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_print_neural_compute_device
def _print_neural_compute_device(cuda_gpus, use_mps, cuda_mem_req=None, has_mps_impl=True): """ Print a message making it clear to the user what compute resource is used in neural network training. """ num_cuda_gpus = len(cuda_gpus) if num_cuda_gpus >= 1: gpu_names = ', '.join(gpu['name'...
python
def _print_neural_compute_device(cuda_gpus, use_mps, cuda_mem_req=None, has_mps_impl=True): """ Print a message making it clear to the user what compute resource is used in neural network training. """ num_cuda_gpus = len(cuda_gpus) if num_cuda_gpus >= 1: gpu_names = ', '.join(gpu['name'...
[ "def", "_print_neural_compute_device", "(", "cuda_gpus", ",", "use_mps", ",", "cuda_mem_req", "=", "None", ",", "has_mps_impl", "=", "True", ")", ":", "num_cuda_gpus", "=", "len", "(", "cuda_gpus", ")", "if", "num_cuda_gpus", ">=", "1", ":", "gpu_names", "=", ...
Print a message making it clear to the user what compute resource is used in neural network training.
[ "Print", "a", "message", "making", "it", "clear", "to", "the", "user", "what", "compute", "resource", "is", "used", "in", "neural", "network", "training", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L711-L733
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
_GetMessageFromFactory
def _GetMessageFromFactory(factory, full_name): """Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is n...
python
def _GetMessageFromFactory(factory, full_name): """Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is n...
[ "def", "_GetMessageFromFactory", "(", "factory", ",", "full_name", ")", ":", "proto_descriptor", "=", "factory", ".", "pool", ".", "FindMessageTypeByName", "(", "full_name", ")", "proto_cls", "=", "factory", ".", "GetPrototype", "(", "proto_descriptor", ")", "retu...
Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is not found in the factory's descriptor pool.
[ "Get", "a", "proto", "class", "from", "the", "MessageFactory", "by", "name", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L44-L57
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
MakeSimpleProtoClass
def MakeSimpleProtoClass(fields, full_name=None, pool=None): """Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherw...
python
def MakeSimpleProtoClass(fields, full_name=None, pool=None): """Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherw...
[ "def", "MakeSimpleProtoClass", "(", "fields", ",", "full_name", "=", "None", ",", "pool", "=", "None", ")", ":", "factory", "=", "message_factory", ".", "MessageFactory", "(", "pool", "=", "pool", ")", "if", "full_name", "is", "not", "None", ":", "try", ...
Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherwise the fields will be sorted by name. full_name: opti...
[ "Create", "a", "Protobuf", "class", "whose", "fields", "are", "basic", "types", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L60-L113
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
_MakeFileDescriptorProto
def _MakeFileDescriptorProto(proto_file_name, full_name, field_items): """Populate FileDescriptorProto for MessageFactory's DescriptorPool.""" package, name = full_name.rsplit('.', 1) file_proto = descriptor_pb2.FileDescriptorProto() file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name) f...
python
def _MakeFileDescriptorProto(proto_file_name, full_name, field_items): """Populate FileDescriptorProto for MessageFactory's DescriptorPool.""" package, name = full_name.rsplit('.', 1) file_proto = descriptor_pb2.FileDescriptorProto() file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name) f...
[ "def", "_MakeFileDescriptorProto", "(", "proto_file_name", ",", "full_name", ",", "field_items", ")", ":", "package", ",", "name", "=", "full_name", ".", "rsplit", "(", "'.'", ",", "1", ")", "file_proto", "=", "descriptor_pb2", ".", "FileDescriptorProto", "(", ...
Populate FileDescriptorProto for MessageFactory's DescriptorPool.
[ "Populate", "FileDescriptorProto", "for", "MessageFactory", "s", "DescriptorPool", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L116-L130
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_classifier.py
convert
def convert(model, input_name, output_features): """Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeClassifier A trained scikit-learn tree model. input_name: str Name of the input columns. output_name: str Name of the...
python
def convert(model, input_name, output_features): """Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeClassifier A trained scikit-learn tree model. input_name: str Name of the input columns. output_name: str Name of the...
[ "def", "convert", "(", "model", ",", "input_name", ",", "output_features", ")", ":", "if", "not", "(", "HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "_sklearn_util", ".", "check_expected...
Convert a decision tree model to protobuf format. Parameters ---------- decision_tree : DecisionTreeClassifier A trained scikit-learn tree model. input_name: str Name of the input columns. output_name: str Name of the output columns. Returns ------- model_spec...
[ "Convert", "a", "decision", "tree", "model", "to", "protobuf", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_classifier.py#L18-L45
train
apple/turicreate
src/unity/python/turicreate/toolkits/_coreml_utils.py
_get_model_metadata
def _get_model_metadata(model_class, metadata, version=None): """ Returns user-defined metadata, making sure information all models should have is also available, as a dictionary """ from turicreate import __version__ info = { 'turicreate_version': __version__, 'type': model_cla...
python
def _get_model_metadata(model_class, metadata, version=None): """ Returns user-defined metadata, making sure information all models should have is also available, as a dictionary """ from turicreate import __version__ info = { 'turicreate_version': __version__, 'type': model_cla...
[ "def", "_get_model_metadata", "(", "model_class", ",", "metadata", ",", "version", "=", "None", ")", ":", "from", "turicreate", "import", "__version__", "info", "=", "{", "'turicreate_version'", ":", "__version__", ",", "'type'", ":", "model_class", ",", "}", ...
Returns user-defined metadata, making sure information all models should have is also available, as a dictionary
[ "Returns", "user", "-", "defined", "metadata", "making", "sure", "information", "all", "models", "should", "have", "is", "also", "available", "as", "a", "dictionary" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_coreml_utils.py#L16-L29
train
apple/turicreate
src/unity/python/turicreate/toolkits/_coreml_utils.py
_set_model_metadata
def _set_model_metadata(mlmodel, model_class, metadata, version=None): """ Sets user-defined metadata, making sure information all models should have is also available """ info = _get_model_metadata(model_class, metadata, version) mlmodel.user_defined_metadata.update(info)
python
def _set_model_metadata(mlmodel, model_class, metadata, version=None): """ Sets user-defined metadata, making sure information all models should have is also available """ info = _get_model_metadata(model_class, metadata, version) mlmodel.user_defined_metadata.update(info)
[ "def", "_set_model_metadata", "(", "mlmodel", ",", "model_class", ",", "metadata", ",", "version", "=", "None", ")", ":", "info", "=", "_get_model_metadata", "(", "model_class", ",", "metadata", ",", "version", ")", "mlmodel", ".", "user_defined_metadata", ".", ...
Sets user-defined metadata, making sure information all models should have is also available
[ "Sets", "user", "-", "defined", "metadata", "making", "sure", "information", "all", "models", "should", "have", "is", "also", "available" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_coreml_utils.py#L32-L38
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
_ToCamelCase
def _ToCamelCase(name): """Converts name to camel-case and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': if result: capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c # L...
python
def _ToCamelCase(name): """Converts name to camel-case and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': if result: capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c # L...
[ "def", "_ToCamelCase", "(", "name", ")", ":", "capitalize_next", "=", "False", "result", "=", "[", "]", "for", "c", "in", "name", ":", "if", "c", "==", "'_'", ":", "if", "result", ":", "capitalize_next", "=", "True", "elif", "capitalize_next", ":", "re...
Converts name to camel-case and returns it.
[ "Converts", "name", "to", "camel", "-", "case", "and", "returns", "it", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L873-L891
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
_ToJsonName
def _ToJsonName(name): """Converts name to Json name and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c return ''.join(result)
python
def _ToJsonName(name): """Converts name to Json name and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c return ''.join(result)
[ "def", "_ToJsonName", "(", "name", ")", ":", "capitalize_next", "=", "False", "result", "=", "[", "]", "for", "c", "in", "name", ":", "if", "c", "==", "'_'", ":", "capitalize_next", "=", "True", "elif", "capitalize_next", ":", "result", ".", "append", ...
Converts name to Json name and returns it.
[ "Converts", "name", "to", "Json", "name", "and", "returns", "it", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L902-L916
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
DescriptorBase._SetOptions
def _SetOptions(self, options, options_class_name): """Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2. """ self._options = options self._options_class_name = options_class_name # Does this descr...
python
def _SetOptions(self, options, options_class_name): """Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2. """ self._options = options self._options_class_name = options_class_name # Does this descr...
[ "def", "_SetOptions", "(", "self", ",", "options", ",", "options_class_name", ")", ":", "self", ".", "_options", "=", "options", "self", ".", "_options_class_name", "=", "options_class_name", "# Does this descriptor have non-default options?", "self", ".", "has_options"...
Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2.
[ "Sets", "the", "descriptor", "s", "options" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L106-L116
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
DescriptorBase.GetOptions
def GetOptions(self): """Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor. """ if self._options: return self._options from google.protobuf import descriptor_pb2 try: options_class = getattr(descriptor_pb2, self._...
python
def GetOptions(self): """Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor. """ if self._options: return self._options from google.protobuf import descriptor_pb2 try: options_class = getattr(descriptor_pb2, self._...
[ "def", "GetOptions", "(", "self", ")", ":", "if", "self", ".", "_options", ":", "return", "self", ".", "_options", "from", "google", ".", "protobuf", "import", "descriptor_pb2", "try", ":", "options_class", "=", "getattr", "(", "descriptor_pb2", ",", "self",...
Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor.
[ "Retrieves", "descriptor", "options", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L118-L133
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
_NestedDescriptorBase.CopyToProto
def CopyToProto(self, proto): """Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments. """ if (self.file is not None and self._serialized_...
python
def CopyToProto(self, proto): """Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments. """ if (self.file is not None and self._serialized_...
[ "def", "CopyToProto", "(", "self", ",", "proto", ")", ":", "if", "(", "self", ".", "file", "is", "not", "None", "and", "self", ".", "_serialized_start", "is", "not", "None", "and", "self", ".", "_serialized_end", "is", "not", "None", ")", ":", "proto",...
Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments.
[ "Copies", "this", "to", "the", "matching", "proto", "in", "descriptor_pb2", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L174-L189
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
Descriptor.EnumValueName
def EnumValueName(self, enum, value): """Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyErr...
python
def EnumValueName(self, enum, value): """Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyErr...
[ "def", "EnumValueName", "(", "self", ",", "enum", ",", "value", ")", ":", "return", "self", ".", "enum_types_by_name", "[", "enum", "]", ".", "values_by_number", "[", "value", "]", ".", "name" ]
Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyError if either the Enum doesn't exist or the va...
[ "Returns", "the", "string", "name", "of", "an", "enum", "value", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L321-L337
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
resolve_reference
def resolve_reference(target_reference, project): """ Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference. """ # Separate target name from properties override assert isinsta...
python
def resolve_reference(target_reference, project): """ Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference. """ # Separate target name from properties override assert isinsta...
[ "def", "resolve_reference", "(", "target_reference", ",", "project", ")", ":", "# Separate target name from properties override", "assert", "isinstance", "(", "target_reference", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", ...
Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference.
[ "Given", "a", "target_reference", "made", "in", "context", "of", "project", "returns", "the", "AbstractTarget", "instance", "that", "is", "referred", "to", "as", "well", "as", "properties", "explicitly", "specified", "for", "this", "reference", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L841-L864
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
generate_from_reference
def generate_from_reference(target_reference, project, property_set_): """ Attempts to generate the target given by target reference, which can refer both to a main target or to a file. Returns a list consisting of - usage requirements - generated virtual targets, if any target_reference: Targe...
python
def generate_from_reference(target_reference, project, property_set_): """ Attempts to generate the target given by target reference, which can refer both to a main target or to a file. Returns a list consisting of - usage requirements - generated virtual targets, if any target_reference: Targe...
[ "def", "generate_from_reference", "(", "target_reference", ",", "project", ",", "property_set_", ")", ":", "assert", "isinstance", "(", "target_reference", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "assert", "isinstan...
Attempts to generate the target given by target reference, which can refer both to a main target or to a file. Returns a list consisting of - usage requirements - generated virtual targets, if any target_reference: Target reference project: Project where the reference is made prop...
[ "Attempts", "to", "generate", "the", "target", "given", "by", "target", "reference", "which", "can", "refer", "both", "to", "a", "main", "target", "or", "to", "a", "file", ".", "Returns", "a", "list", "consisting", "of", "-", "usage", "requirements", "-", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L866-L886
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.main_target_alternative
def main_target_alternative (self, target): """ Registers the specified target as a main target alternatives. Returns 'target'. """ assert isinstance(target, AbstractTarget) target.project ().add_alternative (target) return target
python
def main_target_alternative (self, target): """ Registers the specified target as a main target alternatives. Returns 'target'. """ assert isinstance(target, AbstractTarget) target.project ().add_alternative (target) return target
[ "def", "main_target_alternative", "(", "self", ",", "target", ")", ":", "assert", "isinstance", "(", "target", ",", "AbstractTarget", ")", "target", ".", "project", "(", ")", ".", "add_alternative", "(", "target", ")", "return", "target" ]
Registers the specified target as a main target alternatives. Returns 'target'.
[ "Registers", "the", "specified", "target", "as", "a", "main", "target", "alternatives", ".", "Returns", "target", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L107-L113
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.main_target_sources
def main_target_sources (self, sources, main_target_name, no_renaming=0): """Return the list of sources to use, if main target rule is invoked with 'sources'. If there are any objects in 'sources', they are treated as main target instances, and the name of such targets are adjusted to be...
python
def main_target_sources (self, sources, main_target_name, no_renaming=0): """Return the list of sources to use, if main target rule is invoked with 'sources'. If there are any objects in 'sources', they are treated as main target instances, and the name of such targets are adjusted to be...
[ "def", "main_target_sources", "(", "self", ",", "sources", ",", "main_target_name", ",", "no_renaming", "=", "0", ")", ":", "assert", "is_iterable_typed", "(", "sources", ",", "basestring", ")", "assert", "isinstance", "(", "main_target_name", ",", "basestring", ...
Return the list of sources to use, if main target rule is invoked with 'sources'. If there are any objects in 'sources', they are treated as main target instances, and the name of such targets are adjusted to be '<name_of_this_target>__<name_of_source_target>'. Such renaming is disabled ...
[ "Return", "the", "list", "of", "sources", "to", "use", "if", "main", "target", "rule", "is", "invoked", "with", "sources", ".", "If", "there", "are", "any", "objects", "in", "sources", "they", "are", "treated", "as", "main", "target", "instances", "and", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L115-L145
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.main_target_requirements
def main_target_requirements(self, specification, project): """Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specificat...
python
def main_target_requirements(self, specification, project): """Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specificat...
[ "def", "main_target_requirements", "(", "self", ",", "specification", ",", "project", ")", ":", "assert", "is_iterable_typed", "(", "specification", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "# create a copy since the l...
Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specification' are the properties xplicitly specified for a main target...
[ "Returns", "the", "requirement", "to", "use", "when", "declaring", "a", "main", "target", "which", "are", "obtained", "by", "-", "translating", "all", "specified", "property", "paths", "and", "-", "refining", "project", "requirements", "with", "the", "one", "s...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L148-L167
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.main_target_usage_requirements
def main_target_usage_requirements (self, specification, project): """ Returns the use requirement to use when declaraing a main target, which are obtained by - translating all specified property paths, and - adding project's usage requirements specification: Use...
python
def main_target_usage_requirements (self, specification, project): """ Returns the use requirement to use when declaraing a main target, which are obtained by - translating all specified property paths, and - adding project's usage requirements specification: Use...
[ "def", "main_target_usage_requirements", "(", "self", ",", "specification", ",", "project", ")", ":", "assert", "is_iterable_typed", "(", "specification", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "project_usage_require...
Returns the use requirement to use when declaraing a main target, which are obtained by - translating all specified property paths, and - adding project's usage requirements specification: Use-properties explicitly specified for a main target project: ...
[ "Returns", "the", "use", "requirement", "to", "use", "when", "declaraing", "a", "main", "target", "which", "are", "obtained", "by", "-", "translating", "all", "specified", "property", "paths", "and", "-", "adding", "project", "s", "usage", "requirements", "spe...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L169-L188
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.main_target_default_build
def main_target_default_build (self, specification, project): """ Return the default build value to use when declaring a main target, which is obtained by using specified value if not empty and parent's default build attribute otherwise. specification: Default build explicit...
python
def main_target_default_build (self, specification, project): """ Return the default build value to use when declaring a main target, which is obtained by using specified value if not empty and parent's default build attribute otherwise. specification: Default build explicit...
[ "def", "main_target_default_build", "(", "self", ",", "specification", ",", "project", ")", ":", "assert", "is_iterable_typed", "(", "specification", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "if", "specification", ...
Return the default build value to use when declaring a main target, which is obtained by using specified value if not empty and parent's default build attribute otherwise. specification: Default build explicitly specified for a main target project: Project where t...
[ "Return", "the", "default", "build", "value", "to", "use", "when", "declaring", "a", "main", "target", "which", "is", "obtained", "by", "using", "specified", "value", "if", "not", "empty", "and", "parent", "s", "default", "build", "attribute", "otherwise", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L190-L202
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.start_building
def start_building (self, main_target_instance): """ Helper rules to detect cycles in main target references. """ assert isinstance(main_target_instance, MainTarget) if id(main_target_instance) in self.targets_being_built_: names = [] for t in self.targets_being_b...
python
def start_building (self, main_target_instance): """ Helper rules to detect cycles in main target references. """ assert isinstance(main_target_instance, MainTarget) if id(main_target_instance) in self.targets_being_built_: names = [] for t in self.targets_being_b...
[ "def", "start_building", "(", "self", ",", "main_target_instance", ")", ":", "assert", "isinstance", "(", "main_target_instance", ",", "MainTarget", ")", "if", "id", "(", "main_target_instance", ")", "in", "self", ".", "targets_being_built_", ":", "names", "=", ...
Helper rules to detect cycles in main target references.
[ "Helper", "rules", "to", "detect", "cycles", "in", "main", "target", "references", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L204-L215
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.create_typed_target
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
python
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
[ "def", "create_typed_target", "(", "self", ",", "type", ",", "project", ",", "name", ",", "sources", ",", "requirements", ",", "default_build", ",", "usage_requirements", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "isinsta...
Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified by the user in Jamfile corresponding to 'project'.
[ "Creates", "a", "TypedTarget", "with", "the", "specified", "properties", ".", "The", "name", "sources", "requirements", "default_build", "and", "usage_requirements", "are", "assumed", "to", "be", "in", "the", "form", "specified", "by", "the", "user", "in", "Jamf...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L222-L237
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.generate
def generate (self, ps): """ Generates all possible targets contained in this project. """ assert isinstance(ps, property_set.PropertySet) self.manager_.targets().log( "Building project '%s' with '%s'" % (self.name (), str(ps))) self.manager_.targets().increase_indent...
python
def generate (self, ps): """ Generates all possible targets contained in this project. """ assert isinstance(ps, property_set.PropertySet) self.manager_.targets().log( "Building project '%s' with '%s'" % (self.name (), str(ps))) self.manager_.targets().increase_indent...
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "targets", "(", ")", ".", "log", "(", "\"Building project '%s' with '%s'\"", "%", "(", "self...
Generates all possible targets contained in this project.
[ "Generates", "all", "possible", "targets", "contained", "in", "this", "project", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L433-L448
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.targets_to_build
def targets_to_build (self): """ Computes and returns a list of AbstractTarget instances which must be built when this project is built. """ result = [] if not self.built_main_targets_: self.build_main_targets () # Collect all main targets here, except f...
python
def targets_to_build (self): """ Computes and returns a list of AbstractTarget instances which must be built when this project is built. """ result = [] if not self.built_main_targets_: self.build_main_targets () # Collect all main targets here, except f...
[ "def", "targets_to_build", "(", "self", ")", ":", "result", "=", "[", "]", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "# Collect all main targets here, except for \"explicit\" ones.", "for", "n", ",", "t", "i...
Computes and returns a list of AbstractTarget instances which must be built when this project is built.
[ "Computes", "and", "returns", "a", "list", "of", "AbstractTarget", "instances", "which", "must", "be", "built", "when", "this", "project", "is", "built", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L450-L469
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.mark_targets_as_explicit
def mark_targets_as_explicit (self, target_names): """Add 'target' to the list of targets in this project that should be build only by explicit request.""" # Record the name of the target, not instance, since this # rule is called before main target instaces are created. assert ...
python
def mark_targets_as_explicit (self, target_names): """Add 'target' to the list of targets in this project that should be build only by explicit request.""" # Record the name of the target, not instance, since this # rule is called before main target instaces are created. assert ...
[ "def", "mark_targets_as_explicit", "(", "self", ",", "target_names", ")", ":", "# Record the name of the target, not instance, since this", "# rule is called before main target instaces are created.", "assert", "is_iterable_typed", "(", "target_names", ",", "basestring", ")", "self...
Add 'target' to the list of targets in this project that should be build only by explicit request.
[ "Add", "target", "to", "the", "list", "of", "targets", "in", "this", "project", "that", "should", "be", "build", "only", "by", "explicit", "request", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L471-L478
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.add_alternative
def add_alternative (self, target_instance): """ Add new target alternative. """ assert isinstance(target_instance, AbstractTarget) if self.built_main_targets_: raise IllegalOperation ("add-alternative called when main targets are already created for project '%s'" % self.full...
python
def add_alternative (self, target_instance): """ Add new target alternative. """ assert isinstance(target_instance, AbstractTarget) if self.built_main_targets_: raise IllegalOperation ("add-alternative called when main targets are already created for project '%s'" % self.full...
[ "def", "add_alternative", "(", "self", ",", "target_instance", ")", ":", "assert", "isinstance", "(", "target_instance", ",", "AbstractTarget", ")", "if", "self", ".", "built_main_targets_", ":", "raise", "IllegalOperation", "(", "\"add-alternative called when main targ...
Add new target alternative.
[ "Add", "new", "target", "alternative", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L484-L491
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.has_main_target
def has_main_target (self, name): """Tells if a main target with the specified name exists.""" assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets() return name in self.main_target_
python
def has_main_target (self, name): """Tells if a main target with the specified name exists.""" assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets() return name in self.main_target_
[ "def", "has_main_target", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "return", "name", "in", "self", "....
Tells if a main target with the specified name exists.
[ "Tells", "if", "a", "main", "target", "with", "the", "specified", "name", "exists", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L500-L506
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.create_main_target
def create_main_target (self, name): """ Returns a 'MainTarget' class instance corresponding to the 'name'. """ assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets () return self.main_targets_.get (name, None)
python
def create_main_target (self, name): """ Returns a 'MainTarget' class instance corresponding to the 'name'. """ assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets () return self.main_targets_.get (name, None)
[ "def", "create_main_target", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "return", "self", ".", "main_targ...
Returns a 'MainTarget' class instance corresponding to the 'name'.
[ "Returns", "a", "MainTarget", "class", "instance", "corresponding", "to", "the", "name", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L508-L515
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.find_really
def find_really(self, id): """ Find and return the target with the specified id, treated relative to self. """ assert isinstance(id, basestring) result = None current_location = self.get ('location') __re_split_project_target = re.compile (r'(.*)//(.*)') ...
python
def find_really(self, id): """ Find and return the target with the specified id, treated relative to self. """ assert isinstance(id, basestring) result = None current_location = self.get ('location') __re_split_project_target = re.compile (r'(.*)//(.*)') ...
[ "def", "find_really", "(", "self", ",", "id", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "result", "=", "None", "current_location", "=", "self", ".", "get", "(", "'location'", ")", "__re_split_project_target", "=", "re", ".", "com...
Find and return the target with the specified id, treated relative to self.
[ "Find", "and", "return", "the", "target", "with", "the", "specified", "id", "treated", "relative", "to", "self", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L518-L588
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.add_constant
def add_constant(self, name, value, path=0): """Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project. """ assert ...
python
def add_constant(self, name, value, path=0): """Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project. """ assert ...
[ "def", "add_constant", "(", "self", ",", "name", ",", "value", ",", "path", "=", "0", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "assert", "isinstance", "(", ...
Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project.
[ "Adds", "a", "new", "constant", "for", "this", "project", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L619-L646
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
MainTarget.add_alternative
def add_alternative (self, target): """ Add a new alternative for this target. """ assert isinstance(target, BasicTarget) d = target.default_build () if self.alternatives_ and self.default_build_ != d: get_manager().errors()("default build must be identical in all al...
python
def add_alternative (self, target): """ Add a new alternative for this target. """ assert isinstance(target, BasicTarget) d = target.default_build () if self.alternatives_ and self.default_build_ != d: get_manager().errors()("default build must be identical in all al...
[ "def", "add_alternative", "(", "self", ",", "target", ")", ":", "assert", "isinstance", "(", "target", ",", "BasicTarget", ")", "d", "=", "target", ".", "default_build", "(", ")", "if", "self", ".", "alternatives_", "and", "self", ".", "default_build_", "!...
Add a new alternative for this target.
[ "Add", "a", "new", "alternative", "for", "this", "target", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L676-L691
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
MainTarget.__select_alternatives
def __select_alternatives (self, property_set_, debug): """ Returns the best viable alternative for this property_set See the documentation for selection rules. # TODO: shouldn't this be 'alternative' (singular)? """ # When selecting alternatives we have to consider defau...
python
def __select_alternatives (self, property_set_, debug): """ Returns the best viable alternative for this property_set See the documentation for selection rules. # TODO: shouldn't this be 'alternative' (singular)? """ # When selecting alternatives we have to consider defau...
[ "def", "__select_alternatives", "(", "self", ",", "property_set_", ",", "debug", ")", ":", "# When selecting alternatives we have to consider defaults,", "# for example:", "# lib l : l.cpp : <variant>debug ;", "# lib l : l_opt.cpp : <variant>release ;", "# won't work unless we add ...
Returns the best viable alternative for this property_set See the documentation for selection rules. # TODO: shouldn't this be 'alternative' (singular)?
[ "Returns", "the", "best", "viable", "alternative", "for", "this", "property_set", "See", "the", "documentation", "for", "selection", "rules", ".", "#", "TODO", ":", "shouldn", "t", "this", "be", "alternative", "(", "singular", ")", "?" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L693-L746
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
MainTarget.generate
def generate (self, ps): """ Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative. """ ...
python
def generate (self, ps): """ Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative. """ ...
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "targets", "(", ")", ".", "start_building", "(", "self", ")", "# We want composite properties ...
Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative.
[ "Select", "an", "alternative", "for", "this", "main", "target", "by", "finding", "all", "alternatives", "which", "requirements", "are", "satisfied", "by", "properties", "and", "picking", "the", "one", "with", "longest", "requirements", "set", ".", "Returns", "th...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L752-L774
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
MainTarget.__generate_really
def __generate_really (self, prop_set): """ Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible...
python
def __generate_really (self, prop_set): """ Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible...
[ "def", "__generate_really", "(", "self", ",", "prop_set", ")", ":", "assert", "isinstance", "(", "prop_set", ",", "property_set", ".", "PropertySet", ")", "best_alternative", "=", "self", ".", "__select_alternatives", "(", "prop_set", ",", "debug", "=", "0", "...
Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible that no targets are generated.
[ "Generates", "the", "main", "target", "with", "the", "given", "property", "set", "and", "returns", "a", "list", "which", "first", "element", "is", "property_set", "object", "containing", "usage_requirements", "of", "generated", "target", "and", "with", "generated"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L776-L797
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.sources
def sources (self): """ Returns the list of AbstractTargets which are used as sources. The extra properties specified for sources are not represented. The only used of this rule at the moment is the '--dump-tests' feature of the test system. """ if self.source...
python
def sources (self): """ Returns the list of AbstractTargets which are used as sources. The extra properties specified for sources are not represented. The only used of this rule at the moment is the '--dump-tests' feature of the test system. """ if self.source...
[ "def", "sources", "(", "self", ")", ":", "if", "self", ".", "source_targets_", "==", "None", ":", "self", ".", "source_targets_", "=", "[", "]", "for", "s", "in", "self", ".", "sources_", ":", "self", ".", "source_targets_", ".", "append", "(", "resolv...
Returns the list of AbstractTargets which are used as sources. The extra properties specified for sources are not represented. The only used of this rule at the moment is the '--dump-tests' feature of the test system.
[ "Returns", "the", "list", "of", "AbstractTargets", "which", "are", "used", "as", "sources", ".", "The", "extra", "properties", "specified", "for", "sources", "are", "not", "represented", ".", "The", "only", "used", "of", "this", "rule", "at", "the", "moment"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L939-L950
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.common_properties
def common_properties (self, build_request, requirements): """ Given build request and requirements, return properties common to dependency build request and target build properties. """ # For optimization, we add free unconditional requirements directly, # withou...
python
def common_properties (self, build_request, requirements): """ Given build request and requirements, return properties common to dependency build request and target build properties. """ # For optimization, we add free unconditional requirements directly, # withou...
[ "def", "common_properties", "(", "self", ",", "build_request", ",", "requirements", ")", ":", "# For optimization, we add free unconditional requirements directly,", "# without using complex algorithsm.", "# This gives the complex algorithm better chance of caching results.", "# The exact ...
Given build request and requirements, return properties common to dependency build request and target build properties.
[ "Given", "build", "request", "and", "requirements", "return", "properties", "common", "to", "dependency", "build", "request", "and", "target", "build", "properties", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L958-L982
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.match
def match (self, property_set_, debug): """ Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'. """ # The condition is composed of all base non-conditional properties. # It's not clear if we should expand 'self.requirements...
python
def match (self, property_set_, debug): """ Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'. """ # The condition is composed of all base non-conditional properties. # It's not clear if we should expand 'self.requirements...
[ "def", "match", "(", "self", ",", "property_set_", ",", "debug", ")", ":", "# The condition is composed of all base non-conditional properties.", "# It's not clear if we should expand 'self.requirements_' or not.", "# For one thing, it would be nice to be able to put", "# <toolset>msvc-...
Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'.
[ "Returns", "the", "alternative", "condition", "for", "this", "alternative", "if", "the", "condition", "is", "satisfied", "by", "property_set", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1103-L1131
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.generate_dependency_properties
def generate_dependency_properties(self, properties, ps): """ Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements). """ ...
python
def generate_dependency_properties(self, properties, ps): """ Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements). """ ...
[ "def", "generate_dependency_properties", "(", "self", ",", "properties", ",", "ps", ")", ":", "assert", "is_iterable_typed", "(", "properties", ",", "property", ".", "Property", ")", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")"...
Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements).
[ "Takes", "a", "target", "reference", "which", "might", "be", "either", "target", "id", "or", "a", "dependency", "property", "and", "generates", "that", "target", "using", "property_set", "as", "build", "request", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1147-L1167
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.generate
def generate (self, ps): """ Determines final build properties, generates sources, and calls 'construct'. This method should not be overridden. """ assert isinstance(ps, property_set.PropertySet) self.manager_.errors().push_user_context( "Generating target " +...
python
def generate (self, ps): """ Determines final build properties, generates sources, and calls 'construct'. This method should not be overridden. """ assert isinstance(ps, property_set.PropertySet) self.manager_.errors().push_user_context( "Generating target " +...
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "errors", "(", ")", ".", "push_user_context", "(", "\"Generating target \"", "+", "self", "....
Determines final build properties, generates sources, and calls 'construct'. This method should not be overridden.
[ "Determines", "final", "build", "properties", "generates", "sources", "and", "calls", "construct", ".", "This", "method", "should", "not", "be", "overridden", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1173-L1294
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.compute_usage_requirements
def compute_usage_requirements (self, subvariant): """ Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets. """ assert isinstance(subvariant, virtual_target.Subvariant) rproperties =...
python
def compute_usage_requirements (self, subvariant): """ Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets. """ assert isinstance(subvariant, virtual_target.Subvariant) rproperties =...
[ "def", "compute_usage_requirements", "(", "self", ",", "subvariant", ")", ":", "assert", "isinstance", "(", "subvariant", ",", "virtual_target", ".", "Subvariant", ")", "rproperties", "=", "subvariant", ".", "build_properties", "(", ")", "xusage_requirements", "=", ...
Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets.
[ "Given", "the", "set", "of", "generated", "targets", "and", "refined", "build", "properties", "determines", "and", "sets", "appripriate", "usage", "requirements", "on", "those", "targets", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1296-L1342
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.create_subvariant
def create_subvariant (self, root_targets, all_targets, build_request, sources, rproperties, usage_requirements): """Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - '...
python
def create_subvariant (self, root_targets, all_targets, build_request, sources, rproperties, usage_requirements): """Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - '...
[ "def", "create_subvariant", "(", "self", ",", "root_targets", ",", "all_targets", ",", "build_request", ",", "sources", ",", "rproperties", ",", "usage_requirements", ")", ":", "assert", "is_iterable_typed", "(", "root_targets", ",", "virtual_target", ".", "VirtualT...
Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - 'all-targets' all virtual targets created while building this main target - 'build-request' is property-set instance with requested build properties
[ "Creates", "a", "new", "subvariant", "-", "dg", "instances", "for", "targets", "-", "root", "-", "targets", "the", "virtual", "targets", "will", "be", "returned", "to", "dependents", "-", "all", "-", "targets", "all", "virtual", "targets", "created", "while"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1344-L1370
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
variant
def variant (name, parents_or_properties, explicit_properties = []): """ Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this vari...
python
def variant (name, parents_or_properties, explicit_properties = []): """ Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this vari...
[ "def", "variant", "(", "name", ",", "parents_or_properties", ",", "explicit_properties", "=", "[", "]", ")", ":", "parents", "=", "[", "]", "if", "not", "explicit_properties", ":", "explicit_properties", "=", "parents_or_properties", "else", ":", "parents", "=",...
Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this variant is used as parent. Second, determines the full property set for ...
[ "Declares", "a", "new", "variant", ".", "First", "determines", "explicit", "properties", "for", "this", "variant", "by", "refining", "parents", "explicit", "properties", "with", "the", "passed", "explicit", "properties", ".", "The", "result", "is", "remembered", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L33-L82
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
register_globals
def register_globals (): """ Registers all features and variants declared by this module. """ # This feature is used to determine which OS we're on. # In future, this may become <target-os> and <host-os> # TODO: check this. Compatibility with bjam names? Subfeature for version? os = sys.platfor...
python
def register_globals (): """ Registers all features and variants declared by this module. """ # This feature is used to determine which OS we're on. # In future, this may become <target-os> and <host-os> # TODO: check this. Compatibility with bjam names? Subfeature for version? os = sys.platfor...
[ "def", "register_globals", "(", ")", ":", "# This feature is used to determine which OS we're on.", "# In future, this may become <target-os> and <host-os>", "# TODO: check this. Compatibility with bjam names? Subfeature for version?", "os", "=", "sys", ".", "platform", "feature", ".", ...
Registers all features and variants declared by this module.
[ "Registers", "all", "features", "and", "variants", "declared", "by", "this", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L110-L330
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
lib
def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]): """The implementation of the 'lib' rule. Beyond standard syntax that rule allows simplified: 'lib a b c ;'.""" assert is_iterable_typed(names, basestring) assert is_iterable_typed(sources, basestring) assert is_ite...
python
def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]): """The implementation of the 'lib' rule. Beyond standard syntax that rule allows simplified: 'lib a b c ;'.""" assert is_iterable_typed(names, basestring) assert is_iterable_typed(sources, basestring) assert is_ite...
[ "def", "lib", "(", "names", ",", "sources", "=", "[", "]", ",", "requirements", "=", "[", "]", ",", "default_build", "=", "[", "]", ",", "usage_requirements", "=", "[", "]", ")", ":", "assert", "is_iterable_typed", "(", "names", ",", "basestring", ")",...
The implementation of the 'lib' rule. Beyond standard syntax that rule allows simplified: 'lib a b c ;'.
[ "The", "implementation", "of", "the", "lib", "rule", ".", "Beyond", "standard", "syntax", "that", "rule", "allows", "simplified", ":", "lib", "a", "b", "c", ";", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L475-L507
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
CompileAction.adjust_properties
def adjust_properties (self, prop_set): """ For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path. """ assert isinstance(prop_set, property_set.PropertySet) s = self.targets ...
python
def adjust_properties (self, prop_set): """ For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path. """ assert isinstance(prop_set, property_set.PropertySet) s = self.targets ...
[ "def", "adjust_properties", "(", "self", ",", "prop_set", ")", ":", "assert", "isinstance", "(", "prop_set", ",", "property_set", ".", "PropertySet", ")", "s", "=", "self", ".", "targets", "(", ")", "[", "0", "]", ".", "creating_subvariant", "(", ")", "r...
For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path.
[ "For", "all", "virtual", "targets", "for", "the", "same", "dependency", "graph", "as", "self", "i", ".", "e", ".", "which", "belong", "to", "the", "same", "main", "target", "add", "their", "directories", "to", "include", "path", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L581-L589
train
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/popularity_recommender.py
create
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, random_seed=0, verbose=True): """ Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is ...
python
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, random_seed=0, verbose=True): """ Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is ...
[ "def", "create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "random_seed", "=", "0", ",", "verbose", "=", "Tr...
Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is determined by the number of observations involving each item. When a target is provided, popularity is computed using the item's mean target value. When the target column contains rating...
[ "Create", "a", "model", "that", "makes", "recommendations", "using", "item", "popularity", ".", "When", "no", "target", "column", "is", "provided", "the", "popularity", "is", "determined", "by", "the", "number", "of", "observations", "involving", "each", "item",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/popularity_recommender.py#L15-L102
train
apple/turicreate
src/external/xgboost/python-package/xgboost/sklearn.py
XGBModel.get_params
def get_params(self, deep=False): """Get parameter.s""" params = super(XGBModel, self).get_params(deep=deep) if params['missing'] is np.nan: params['missing'] = None # sklearn doesn't handle nan. see #4725 if not params.get('eval_metric', True): del params['eval_...
python
def get_params(self, deep=False): """Get parameter.s""" params = super(XGBModel, self).get_params(deep=deep) if params['missing'] is np.nan: params['missing'] = None # sklearn doesn't handle nan. see #4725 if not params.get('eval_metric', True): del params['eval_...
[ "def", "get_params", "(", "self", ",", "deep", "=", "False", ")", ":", "params", "=", "super", "(", "XGBModel", ",", "self", ")", ".", "get_params", "(", "deep", "=", "deep", ")", "if", "params", "[", "'missing'", "]", "is", "np", ".", "nan", ":", ...
Get parameter.s
[ "Get", "parameter", ".", "s" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L126-L133
train
apple/turicreate
src/external/xgboost/python-package/xgboost/sklearn.py
XGBModel.get_xgb_params
def get_xgb_params(self): """Get xgboost type parameters.""" xgb_params = self.get_params() xgb_params['silent'] = 1 if self.silent else 0 if self.nthread <= 0: xgb_params.pop('nthread', None) return xgb_params
python
def get_xgb_params(self): """Get xgboost type parameters.""" xgb_params = self.get_params() xgb_params['silent'] = 1 if self.silent else 0 if self.nthread <= 0: xgb_params.pop('nthread', None) return xgb_params
[ "def", "get_xgb_params", "(", "self", ")", ":", "xgb_params", "=", "self", ".", "get_params", "(", ")", "xgb_params", "[", "'silent'", "]", "=", "1", "if", "self", ".", "silent", "else", "0", "if", "self", ".", "nthread", "<=", "0", ":", "xgb_params", ...
Get xgboost type parameters.
[ "Get", "xgboost", "type", "parameters", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L135-L143
train
apple/turicreate
src/external/xgboost/python-package/xgboost/sklearn.py
XGBModel.fit
def fit(self, X, y, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable=missing-docstring,invalid-name,attribute-defined-outside-init """ Fit the gradient boosting model Parameters ---------- X : array_like ...
python
def fit(self, X, y, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable=missing-docstring,invalid-name,attribute-defined-outside-init """ Fit the gradient boosting model Parameters ---------- X : array_like ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", ",", "eval_set", "=", "None", ",", "eval_metric", "=", "None", ",", "early_stopping_rounds", "=", "None", ",", "verbose", "=", "True", ")", ":", "# pylint: disable=missing-docstring,invalid-name,attribute-defined-outs...
Fit the gradient boosting model Parameters ---------- X : array_like Feature matrix y : array_like Labels eval_set : list, optional A list of (X, y) tuple pairs to use as a validation set for early-stopping eval_metric : st...
[ "Fit", "the", "gradient", "boosting", "model" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L145-L213
train
apple/turicreate
src/external/xgboost/python-package/xgboost/sklearn.py
XGBClassifier.fit
def fit(self, X, y, sample_weight=None, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable = attribute-defined-outside-init,arguments-differ """ Fit gradient boosting classifier Parameters ---------- X : array_like ...
python
def fit(self, X, y, sample_weight=None, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable = attribute-defined-outside-init,arguments-differ """ Fit gradient boosting classifier Parameters ---------- X : array_like ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", ",", "sample_weight", "=", "None", ",", "eval_set", "=", "None", ",", "eval_metric", "=", "None", ",", "early_stopping_rounds", "=", "None", ",", "verbose", "=", "True", ")", ":", "# pylint: disable = attribut...
Fit gradient boosting classifier Parameters ---------- X : array_like Feature matrix y : array_like Labels sample_weight : array_like Weight for each instance eval_set : list, optional A list of (X, y) pairs to use as a val...
[ "Fit", "gradient", "boosting", "classifier" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L280-L369
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
add_grist
def add_grist (features): """ Transform a string by bracketing it with "<>". If already bracketed, does nothing. features: one string or a sequence of strings return: the gristed string, if features is a string, or a sequence of gristed strings, if features is a sequence """ assert is_iterab...
python
def add_grist (features): """ Transform a string by bracketing it with "<>". If already bracketed, does nothing. features: one string or a sequence of strings return: the gristed string, if features is a string, or a sequence of gristed strings, if features is a sequence """ assert is_iterab...
[ "def", "add_grist", "(", "features", ")", ":", "assert", "is_iterable_typed", "(", "features", ",", "basestring", ")", "or", "isinstance", "(", "features", ",", "basestring", ")", "def", "grist_one", "(", "feature", ")", ":", "if", "feature", "[", "0", "]"...
Transform a string by bracketing it with "<>". If already bracketed, does nothing. features: one string or a sequence of strings return: the gristed string, if features is a string, or a sequence of gristed strings, if features is a sequence
[ "Transform", "a", "string", "by", "bracketing", "it", "with", "<", ">", ".", "If", "already", "bracketed", "does", "nothing", ".", "features", ":", "one", "string", "or", "a", "sequence", "of", "strings", "return", ":", "the", "gristed", "string", "if", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L39-L54
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
replace_grist
def replace_grist (features, new_grist): """ Replaces the grist of a string by a new one. Returns the string with the new grist. """ assert is_iterable_typed(features, basestring) or isinstance(features, basestring) assert isinstance(new_grist, basestring) # this function is used a lot in th...
python
def replace_grist (features, new_grist): """ Replaces the grist of a string by a new one. Returns the string with the new grist. """ assert is_iterable_typed(features, basestring) or isinstance(features, basestring) assert isinstance(new_grist, basestring) # this function is used a lot in th...
[ "def", "replace_grist", "(", "features", ",", "new_grist", ")", ":", "assert", "is_iterable_typed", "(", "features", ",", "basestring", ")", "or", "isinstance", "(", "features", ",", "basestring", ")", "assert", "isinstance", "(", "new_grist", ",", "basestring",...
Replaces the grist of a string by a new one. Returns the string with the new grist.
[ "Replaces", "the", "grist", "of", "a", "string", "by", "a", "new", "one", ".", "Returns", "the", "string", "with", "the", "new", "grist", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L56-L83
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
get_value
def get_value (property): """ Gets the value of a property, that is, the part following the grist, if any. """ assert is_iterable_typed(property, basestring) or isinstance(property, basestring) return replace_grist (property, '')
python
def get_value (property): """ Gets the value of a property, that is, the part following the grist, if any. """ assert is_iterable_typed(property, basestring) or isinstance(property, basestring) return replace_grist (property, '')
[ "def", "get_value", "(", "property", ")", ":", "assert", "is_iterable_typed", "(", "property", ",", "basestring", ")", "or", "isinstance", "(", "property", ",", "basestring", ")", "return", "replace_grist", "(", "property", ",", "''", ")" ]
Gets the value of a property, that is, the part following the grist, if any.
[ "Gets", "the", "value", "of", "a", "property", "that", "is", "the", "part", "following", "the", "grist", "if", "any", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L85-L89
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
get_grist
def get_grist (value): """ Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def get_grist_one (name): split = __re_grist_and_value.match (n...
python
def get_grist (value): """ Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def get_grist_one (name): split = __re_grist_and_value.match (n...
[ "def", "get_grist", "(", "value", ")", ":", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "or", "isinstance", "(", "value", ",", "basestring", ")", "def", "get_grist_one", "(", "name", ")", ":", "split", "=", "__re_grist_and_value", "....
Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence.
[ "Returns", "the", "grist", "of", "a", "string", ".", "If", "value", "is", "a", "sequence", "does", "it", "for", "every", "value", "and", "returns", "the", "result", "as", "a", "sequence", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L91-L106
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
ungrist
def ungrist (value): """ Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def ungrist_one (value): stripped = __re_grist_content.match (v...
python
def ungrist (value): """ Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def ungrist_one (value): stripped = __re_grist_content.match (v...
[ "def", "ungrist", "(", "value", ")", ":", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "or", "isinstance", "(", "value", ",", "basestring", ")", "def", "ungrist_one", "(", "value", ")", ":", "stripped", "=", "__re_grist_content", ".",...
Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence.
[ "Returns", "the", "value", "without", "grist", ".", "If", "value", "is", "a", "sequence", "does", "it", "for", "every", "value", "and", "returns", "the", "result", "as", "a", "sequence", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L108-L123
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
replace_suffix
def replace_suffix (name, new_suffix): """ Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added. """ assert isinstance(name, basestring) assert isinstance(new_suffix, basestring) split = os.path.splitext (name) return split [0] + new_suffix
python
def replace_suffix (name, new_suffix): """ Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added. """ assert isinstance(name, basestring) assert isinstance(new_suffix, basestring) split = os.path.splitext (name) return split [0] + new_suffix
[ "def", "replace_suffix", "(", "name", ",", "new_suffix", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "isinstance", "(", "new_suffix", ",", "basestring", ")", "split", "=", "os", ".", "path", ".", "splitext", "(", "name"...
Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added.
[ "Replaces", "the", "suffix", "of", "name", "by", "new_suffix", ".", "If", "no", "suffix", "exists", "the", "new", "one", "is", "added", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L125-L132
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
split_action_id
def split_action_id (id): """ Splits an id in the toolset and specific rule parts. E.g. 'gcc.compile.c++' returns ('gcc', 'compile.c++') """ assert isinstance(id, basestring) split = id.split ('.', 1) toolset = split [0] name = '' if len (split) > 1: name = split [1] retu...
python
def split_action_id (id): """ Splits an id in the toolset and specific rule parts. E.g. 'gcc.compile.c++' returns ('gcc', 'compile.c++') """ assert isinstance(id, basestring) split = id.split ('.', 1) toolset = split [0] name = '' if len (split) > 1: name = split [1] retu...
[ "def", "split_action_id", "(", "id", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "split", "=", "id", ".", "split", "(", "'.'", ",", "1", ")", "toolset", "=", "split", "[", "0", "]", "name", "=", "''", "if", "len", "(", "s...
Splits an id in the toolset and specific rule parts. E.g. 'gcc.compile.c++' returns ('gcc', 'compile.c++')
[ "Splits", "an", "id", "in", "the", "toolset", "and", "specific", "rule", "parts", ".", "E", ".", "g", ".", "gcc", ".", "compile", ".", "c", "++", "returns", "(", "gcc", "compile", ".", "c", "++", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L141-L151
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
on_windows
def on_windows (): """ Returns true if running on windows, whether in cygwin or not. """ if bjam.variable("NT"): return True elif bjam.variable("UNIX"): uname = bjam.variable("JAMUNAME") if uname and uname[0].startswith("CYGWIN"): return True return False
python
def on_windows (): """ Returns true if running on windows, whether in cygwin or not. """ if bjam.variable("NT"): return True elif bjam.variable("UNIX"): uname = bjam.variable("JAMUNAME") if uname and uname[0].startswith("CYGWIN"): return True return False
[ "def", "on_windows", "(", ")", ":", "if", "bjam", ".", "variable", "(", "\"NT\"", ")", ":", "return", "True", "elif", "bjam", ".", "variable", "(", "\"UNIX\"", ")", ":", "uname", "=", "bjam", ".", "variable", "(", "\"JAMUNAME\"", ")", "if", "uname", ...
Returns true if running on windows, whether in cygwin or not.
[ "Returns", "true", "if", "running", "on", "windows", "whether", "in", "cygwin", "or", "not", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L164-L176
train
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_dataset
def _validate_dataset(dataset): """ Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset. """ if not (isinstance(dataset, _SFrame)): raise TypeError("Input 'dataset' must be an SFrame.") if dataset.num_rows() == 0 or dataset.num_columns(...
python
def _validate_dataset(dataset): """ Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset. """ if not (isinstance(dataset, _SFrame)): raise TypeError("Input 'dataset' must be an SFrame.") if dataset.num_rows() == 0 or dataset.num_columns(...
[ "def", "_validate_dataset", "(", "dataset", ")", ":", "if", "not", "(", "isinstance", "(", "dataset", ",", "_SFrame", ")", ")", ":", "raise", "TypeError", "(", "\"Input 'dataset' must be an SFrame.\"", ")", "if", "dataset", ".", "num_rows", "(", ")", "==", "...
Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset.
[ "Validate", "the", "main", "Kmeans", "dataset", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L25-L38
train
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_initial_centers
def _validate_initial_centers(initial_centers): """ Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form. """ if not (isinstance(initial_centers, _SFrame)): raise TypeError("Input 'initial_centers' must...
python
def _validate_initial_centers(initial_centers): """ Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form. """ if not (isinstance(initial_centers, _SFrame)): raise TypeError("Input 'initial_centers' must...
[ "def", "_validate_initial_centers", "(", "initial_centers", ")", ":", "if", "not", "(", "isinstance", "(", "initial_centers", ",", "_SFrame", ")", ")", ":", "raise", "TypeError", "(", "\"Input 'initial_centers' must be an SFrame.\"", ")", "if", "initial_centers", ".",...
Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form.
[ "Validate", "the", "initial", "centers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L41-L55
train
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_num_clusters
def _validate_num_clusters(num_clusters, initial_centers, num_rows): """ Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- ...
python
def _validate_num_clusters(num_clusters, initial_centers, num_rows): """ Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- ...
[ "def", "_validate_num_clusters", "(", "num_clusters", ",", "initial_centers", ",", "num_rows", ")", ":", "## Basic validation", "if", "num_clusters", "is", "not", "None", "and", "not", "isinstance", "(", "num_clusters", ",", "int", ")", ":", "raise", "_ToolkitErro...
Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- num_clusters : int Specified number of clusters. initial_centers ...
[ "Validate", "the", "combination", "of", "the", "num_clusters", "and", "initial_centers", "parameters", "in", "the", "Kmeans", "model", "create", "function", ".", "If", "the", "combination", "is", "valid", "determine", "and", "return", "the", "correct", "number", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L58-L115
train
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_features
def _validate_features(features, column_type_map, valid_types, label): """ Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column...
python
def _validate_features(features, column_type_map, valid_types, label): """ Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column...
[ "def", "_validate_features", "(", "features", ",", "column_type_map", ",", "valid_types", ",", "label", ")", ":", "if", "not", "isinstance", "(", "features", ",", "list", ")", ":", "raise", "TypeError", "(", "\"Input 'features' must be a list, if specified.\"", ")",...
Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column_type_map : dict[str, type] Dictionary mapping each column name to the type...
[ "Identify", "the", "subset", "of", "desired", "features", "that", "are", "valid", "for", "the", "Kmeans", "model", ".", "A", "warning", "is", "emitted", "for", "each", "feature", "that", "is", "excluded", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L118-L186
train
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
create
def create(dataset, num_clusters=None, features=None, label=None, initial_centers=None, max_iterations=10, batch_size=None, verbose=True): """ Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in...
python
def create(dataset, num_clusters=None, features=None, label=None, initial_centers=None, max_iterations=10, batch_size=None, verbose=True): """ Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in...
[ "def", "create", "(", "dataset", ",", "num_clusters", "=", "None", ",", "features", "=", "None", ",", "label", "=", "None", ",", "initial_centers", "=", "None", ",", "max_iterations", "=", "10", ",", "batch_size", "=", "None", ",", "verbose", "=", "True"...
Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in the input 'dataset'. Given a number of clusters, k-means iteratively chooses the best cluster centers and assigns nearby points to the best cluster. If no poin...
[ "Create", "a", "k", "-", "means", "clustering", "model", ".", "The", "KmeansModel", "object", "contains", "the", "computed", "cluster", "centers", "and", "the", "cluster", "assignment", "for", "each", "instance", "in", "the", "input", "dataset", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L410-L602
train
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
KmeansModel.predict
def predict(self, dataset, output_type='cluster_id', verbose=True): """ Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : S...
python
def predict(self, dataset, output_type='cluster_id', verbose=True): """ Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : S...
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'cluster_id'", ",", "verbose", "=", "True", ")", ":", "## Validate the input dataset.", "_tkutl", ".", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"dataset\"", ")", "_tkutl", ".", ...
Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : SFrame Dataset of new observations. Must include the features used for ...
[ "Return", "predicted", "cluster", "label", "for", "instances", "in", "the", "new", "dataset", ".", "K", "-", "means", "predictions", "are", "made", "by", "assigning", "each", "new", "instance", "to", "the", "closest", "cluster", "center", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L208-L287
train
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
KmeansModel._get
def _get(self, field): """ Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================...
python
def _get(self, field): """ Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================...
[ "def", "_get", "(", "self", ",", "field", ")", ":", "opts", "=", "{", "'model'", ":", "self", ".", "__proxy__", ",", "'model_name'", ":", "self", ".", "__name__", ",", "'field'", ":", "field", "}", "response", "=", "_tc", ".", "extensions", ".", "_km...
Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================+ | batch_size | Number ...
[ "Return", "the", "value", "of", "a", "given", "field", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L289-L345
train