class_docstr: Nearest neighbor classifier model. Nearest neighbor classifiers predict the
  class of any observation to be the most common class among the observation's
  closest neighbors.
  
  This model should not be constructed directly. Instead, use
  :func:`turicreate.nearest_neighbor_classifier.create` to create an instance of
  this model.
class_docstr_tok: ["Nearest","neighbor","classifier","model",".","Nearest","neighbor","classifiers","predict","the","class","of","any","observation","to","be","the","most","common","class","among","the","observation's","closest","neighbors",".","This","model","should","not","be","constructed","directly",".","Instead",",","use",":","func",":","`","turicreate.nearest_neighbor_classifier.create","`","to","create","an","instance","of","this","model","."]
docstr: Return predicted class labels for instances in *dataset*. This model
  makes predictions based on the closest neighbors stored in the nearest
  neighbors classifier model.
  
  Parameters
  ----------
  dataset : SFrame
      Dataset of new observations. Must include the features used for
      model training, but does not require a target column. Additional
      columns are ignored.
  
  max_neighbors : int, optional
      Maximum number of neighbors to consider for each point.
  
  radius : float, optional
      Maximum distance from each point to a neighbor in the reference
      dataset.
  
  output_type : {'class', 'probability'}, optional
      Type of prediction output:
  
      - `class`: Predicted class label. The class with the maximum number
        of votes among the nearest neighbors in the reference dataset.
  
      - `probability`: Maximum number of votes for any class out of all
        nearest neighbors in the reference dataset.
  
  Returns
  -------
  out : SArray
      An SArray with model predictions.
  
  See Also
  ----------
  create, classify, predict_topk
  
  Notes
  -----
  - If the 'radius' parameter is small, it is possible that a query point
    has no qualified neighbors in the training dataset. In this case, the
    result for that query is 'None' in the SArray output by this method.
    If the target column in the training dataset has missing values, these
    predictions will be ambiguous.
  
  - Ties between predicted classes are broken randomly.
  
  Examples
  --------
  >>> sf_train = turicreate.SFrame({'species': ['cat', 'dog', 'fossa', 'dog'],
  ...                             'height': [9, 25, 20, 23],
  ...                             'weight': [13, 28, 33, 22]})
  ...
  >>> sf_new = turicreate.SFrame({'height': [26, 19],
  ...                           'weight': [25, 35]})
  ...
  >>> m = turicreate.nearest_neighbor_classifier.create(sf, target='species')
  >>> ystar = m.predict(sf_new, max_neighbors=2, output_type='class')
  >>> print ystar
  ['dog', 'fossa']
docstr_tok: ["Return","predicted","class","labels","for","instances","in","*","dataset","*",".","This","model","makes","predictions","based","on","the","closest","neighbors","stored","in","the","nearest","neighbors","classifier","model",".","Parameters","--","--","--","--","--","dataset",":","SFrame","Dataset","of","new","observations",".","Must","include","the","features","used","for","model","training",",","but","does","not","require","a","target","column",".","Additional","columns","are","ignored",".","max_neighbors",":","int",",","optional","Maximum","number","of","neighbors","to","consider","for","each","point",".","radius",":","float",",","optional","Maximum","distance","from","each","point","to","a","neighbor","in","the","reference","dataset",".","output_type",":","{","'class","'",",","'probability","'","}",",","optional","Type","of","prediction","output",":","-","`","class","`",":","Predicted","class","label",".","The","class","with","the","maximum","number","of","votes","among","the","nearest","neighbors","in","the","reference","dataset",".","-","`","probability","`",":","Maximum","number","of","votes","for","any","class","out","of","all","nearest","neighbors","in","the","reference","dataset",".","Returns","--","--","--","-","out",":","SArray","An","SArray","with","model","predictions",".","See","Also","--","--","--","--","--","create",",","classify",",","predict_topk","Notes","--","--","-","-","If","the","'radius","'","parameter","is","small",",","it","is","possible","that","a","query","point","has","no","qualified","neighbors","in","the","training","dataset",".","In","this","case",",","the","result","for","that","query","is","'None","'","in","the","SArray","output","by","this","method",".","If","the","target","column","in","the","training","dataset","has","missing","values",",","these","predictions","will","be","ambiguous",".","-","Ties","between","predicted","classes","are","broken","randomly",".","Examples","--","--","--","--",">",">",">","sf_train","=","turicreate.SFrame","(","{","'species","'",":","[","'cat","'",",","'dog","'",",","'fossa","'",",","'dog","'","]",",","...","'height","'",":","[","9",",","25",",","20",",","23","]",",","...","'weight","'",":","[","13",",","28",",","33",",","22","]","}",")","...",">",">",">","sf_new","=","turicreate.SFrame","(","{","'height","'",":","[","26",",","19","]",",","...","'weight","'",":","[","25",",","35","]","}",")","...",">",">",">","m","=","turicreate.nearest_neighbor_classifier.create","(","sf",",","target='species","'",")",">",">",">","ystar","=","m.predict","(","sf_new",",","max_neighbors=2",",","output_type='class","'",")",">",">",">","print","ystar","[","'dog","'",",","'fossa","'","]"]
code: def predict(
      self,
      dataset,
      max_neighbors=10,
      radius=None,
      output_type="class",
      verbose=True,
  ):
      """
      Return predicted class labels for instances in *dataset*. This model
      makes predictions based on the closest neighbors stored in the nearest
      neighbors classifier model.
  
      Parameters
      ----------
      dataset : SFrame
          Dataset of new observations. Must include the features used for
          model training, but does not require a target column. Additional
          columns are ignored.
  
      max_neighbors : int, optional
          Maximum number of neighbors to consider for each point.
  
      radius : float, optional
          Maximum distance from each point to a neighbor in the reference
          dataset.
  
      output_type : {'class', 'probability'}, optional
          Type of prediction output:
  
          - `class`: Predicted class label. The class with the maximum number
            of votes among the nearest neighbors in the reference dataset.
  
          - `probability`: Maximum number of votes for any class out of all
            nearest neighbors in the reference dataset.
  
      Returns
      -------
      out : SArray
          An SArray with model predictions.
  
      See Also
      ----------
      create, classify, predict_topk
  
      Notes
      -----
      - If the 'radius' parameter is small, it is possible that a query point
        has no qualified neighbors in the training dataset. In this case, the
        result for that query is 'None' in the SArray output by this method.
        If the target column in the training dataset has missing values, these
        predictions will be ambiguous.
  
      - Ties between predicted classes are broken randomly.
  
      Examples
      --------
      >>> sf_train = turicreate.SFrame({'species': ['cat', 'dog', 'fossa', 'dog'],
      ...                             'height': [9, 25, 20, 23],
      ...                             'weight': [13, 28, 33, 22]})
      ...
      >>> sf_new = turicreate.SFrame({'height': [26, 19],
      ...                           'weight': [25, 35]})
      ...
      >>> m = turicreate.nearest_neighbor_classifier.create(sf, target='species')
      >>> ystar = m.predict(sf_new, max_neighbors=2, output_type='class')
      >>> print ystar
      ['dog', 'fossa']
      """
  
      ystar = self.classify(
          dataset=dataset,
          max_neighbors=max_neighbors,
          radius=radius,
          verbose=verbose,
      )
  
      if output_type == "class":
          return ystar["class"]
  
      elif output_type == "probability":
          return ystar["probability"]
  
      else:
          raise ValueError(
              "Input 'output_type' not understood. 'output_type' "
              "must be either 'class' or 'probability'."
          )
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import time
  import copy
  import array
  import logging
  import turicreate
  from turicreate.toolkits._model import CustomModel
  from turicreate.toolkits._internal_utils import _toolkit_repr_print
  from turicreate.toolkits._internal_utils import _raise_error_if_sframe_empty
  from turicreate.toolkits._internal_utils import _raise_error_if_not_sframe
  from turicreate.toolkits._internal_utils import _raise_error_if_column_exists
  from turicreate.toolkits._internal_utils import _raise_error_evaluation_metric_is_valid
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits import evaluation
  from turicreate.toolkits._model import PythonProxy
label_desc: Use image node_id 10 for calling the NearestNeighborClassifier obj's underlying member method code with example usage: obj.predict(dataset, max_neighbors, radius, output_type, verbose) and returns: ystar, ystar