Methods for creating and querying a nearest neighbors model. """ import graphlab.connect as _mt import graphlab as _graphlab from graphlab.toolkits._model import Model as _Model from graphlab.data_structures.sframe import SFrame as _SFrame import graphlab.toolkits._internal_utils as _tkutl from graphlab.toolkits._model import _get_default_options_wrapper as \ __get_default_options_wrapper import array import copy get_default_options = __get_default_options_wrapper('nearest_neighbors_ball_tree', 'nearest_neighbors', 'NearestNeighborsModel') def choose_auto_distance(feature_names, column_names, column_types): """ Construct composite distance parameters based on selected features and their types. """ ## Make a dictionary from the column_names and column_types col_type_dict = {k: v for k, v in zip(column_names, column_types)} ## Loop through feature names, appending a distance component if the # feature's type is *not* numeric. If the type *is* numeric, append it to # the numeric_cols list, then at the end make a numeric columns distance
__get_default_options_wrapper from graphlab.toolkits._main import ToolkitError as _ToolkitError from graphlab.toolkits._private_utils import _validate_lists from graphlab.toolkits.distances._util import _convert_distance_names_to_functions from graphlab.toolkits.distances._util import _validate_composite_distance from graphlab.toolkits.distances._util import _scrub_composite_distance_features from graphlab.toolkits.distances._util import _get_composite_distance_features import array import copy as _copy import six as _six get_default_options = __get_default_options_wrapper( 'nearest_neighbors_ball_tree', 'nearest_neighbors', 'NearestNeighborsModel') def _construct_auto_distance(feature_names, column_names, column_types, sample): """ Construct composite distance parameters based on selected features and their types. """ ## Make a dictionary from the column_names and column_types col_type_dict = {k: v for k, v in zip(column_names, column_types)} ## Loop through feature names, appending a distance component if the # feature's type is *not* numeric. If the type *is* numeric, append it to
""" import graphlab as _graphlab import graphlab.connect as _mt from graphlab.toolkits._model import Model as _Model from graphlab.data_structures.sframe import SFrame as _SFrame from graphlab.data_structures.sarray import SArray as _SArray from graphlab.deps import pandas as _pandas, HAS_PANDAS as _HAS_PANDAS import time as _time from graphlab.toolkits._main import ToolkitError as _ToolkitError from graphlab.toolkits._model import _get_default_options_wrapper as \ __get_default_options_wrapper get_default_options = __get_default_options_wrapper( 'vowpal_wabbit', 'vowpal_wabbit', 'VowpalWabbitModel') def create(dataset, target, loss_function='squared', quadratic=[], l1_penalty=0.0, l2_penalty=0.0, bigram=False, step_size=0.5, num_bits=18, verbose=False, max_iterations=1, command_line_args=''): """ create(dataset, target, loss_function='squared', quadratic=list(), l1_penalty=0.0, l2_penalty=0.0, bigram=False, step_size=0.5, num_bits=18, verbose=False, max_iterations=1, command_line_args='')