class_docstr: KNearestNeighborsClassifierBuilder class to 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')
  
  See Also
  --------
  MLModel, save_spec
docstr: Set the index type for the KNearestNeighborsClassifier model
  :param index_type: One of [ 'linear', 'kd_tree' ]
  :param leaf_size: For kd_tree indexes, the leaf size to use (default = 30)
  :return: None
docstr_tok: ["Set","the","index","type","for","the","KNearestNeighborsClassifier","model",":","param","index_type",":","One","of","[","'linear","'",",","'kd_tree","'","]",":","param","leaf_size",":","For","kd_tree","indexes",",","the","leaf","size","to","use","(","default","=","30",")",":","return",":","None"]
code: def set_index_type(self, index_type, leaf_size=30):
      """
      Set the index type for the KNearestNeighborsClassifier model
      :param index_type: One of [ 'linear', 'kd_tree' ]
      :param leaf_size: For kd_tree indexes, the leaf size to use (default = 30)
      :return: None
      """
      index_type = index_type.lower()
      if not index_type in self._VALID_INDEX_TYPES:
          raise TypeError("Invalid index type")
  
      if index_type == "kd_tree":
          if leaf_size <= 0:
              raise TypeError("leaf_size must be > 0")
          self.spec.kNearestNeighborsClassifier.nearestNeighborsIndex.singleKdTreeIndex.leafSize = (
              leaf_size
          )
      else:
          self.spec.kNearestNeighborsClassifier.nearestNeighborsIndex.linearIndex.MergeFromString(
              b""
          )
  
      # storing this in the object is just a convenience
      self._index_type = index_type
  
imports: from ...proto import FeatureTypes_pb2
  from ..None import datatypes
  import coremltools
  import numpy
  import six
label_desc: Use image node_id 13 for calling the KNearestNeighborsClassifierBuilder obj's underlying member method code with example usage: obj.set_index_type(index_type, leaf_size) without return types