class_docstr: Construct a CoreML KNearestNeighborsClassifier specification.
  
  Please see the Core ML Nearest Neighbors protobuf message for more information
  on KNearestNeighborsClassifier parameters.
  
  Examples
  --------
  .. sourcecode:: python
  
      from coremltools.models.nearest_neighbors import KNearestNeighborsClassifierBuilder
      from coremltools.models.utils import save_spec
  
      # Create a KNearestNeighborsClassifier model that takes 4-dimensional input data and outputs a string label.
      >>> builder = KNearestNeighborsClassifierBuilder(input_name='input',
      ...                                              output_name='output',
      ...                                              number_of_dimensions=4,
      ...                                              default_class_label='default_label')
  
      # save the spec by the builder
      >>> save_spec(builder.spec, 'knnclassifier.mlmodel')
      
docstr: Add some samples to the KNearestNeighborsClassifier model.
  
  Parameters
  ----------
  data_points
          List of input data points.
  
  labels
          List of corresponding labels.
  
  Returns
  -------
  None
docstr_tok: ["Add","some","samples","to","the","KNearestNeighborsClassifier","model",".","Parameters","--","--","--","--","--","data_points","List","of","input","data","points",".","labels","List","of","corresponding","labels",".","Returns","--","--","--","-","None"]
code: def add_samples(self, data_points, labels):
      """
      Add some samples to the KNearestNeighborsClassifier model.
  
      Parameters
      ----------
      data_points
              List of input data points.
  
      labels
              List of corresponding labels.
  
      Returns
      -------
      None
      """
      if len(data_points) == 0:
          raise TypeError("data_points is empty")
  
      if len(labels) == 0:
          raise TypeError("labels is empty")
  
      if len(data_points[0]) != self.number_of_dimensions:
          raise TypeError(
              "dimensionality of data_points != expected number of dimensions"
          )
  
      if len(data_points) != len(labels):
          raise TypeError("len(data_points) !=  len(labels)")
  
      # Validate the types of the labels before adding any points.
      self._validate_label_types(labels)
  
      for data_point in data_points:
          sample = (
              self.spec.kNearestNeighborsClassifier.nearestNeighborsIndex.floatSamples.add()
          )
          for feature in data_point:
              sample.vector.append(feature)
  
      if self.spec.kNearestNeighborsClassifier.HasField(
          "int64ClassLabels"
      ):
          for label in labels:
              self.spec.kNearestNeighborsClassifier.int64ClassLabels.vector.append(
                  label
              )
      else:
          # string labels
          for label in labels:
              self.spec.kNearestNeighborsClassifier.stringClassLabels.vector.append(
                  label
              )
  
imports: import numpy
  import coremltools
  from ...proto import FeatureTypes_pb2
  from ..None import datatypes
label_desc: Use image node_id 21 for calling the KNearestNeighborsClassifierBuilder obj's underlying member method code with example usage: obj.add_samples(data_points, labels) without return types