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: Ensure the label types matched the expected types.
  :param spec: the spec
  :param labels: the list of labels
  :return: None, throws a TypeError if not expected
docstr_tok: ["Ensure","the","label","types","matched","the","expected","types",".",":","param","spec",":","the","spec",":","param","labels",":","the","list","of","labels",":","return",":","None",",","throws","a","TypeError","if","not","expected"]
code: def _validate_label_types(self, labels):
      """
      Ensure the label types matched the expected types.
      :param spec: the spec
      :param labels: the list of labels
      :return: None, throws a TypeError if not expected
      """
      if self.spec.kNearestNeighborsClassifier.HasField(
          "int64ClassLabels"
      ):
          check_is_valid = (
              KNearestNeighborsClassifierBuilder._is_valid_number_type
          )
      else:
          check_is_valid = (
              KNearestNeighborsClassifierBuilder._is_valid_text_type
          )
      for label in labels:
          if not check_is_valid(label):
              raise TypeError(
                  "Invalid type for label: {}".format(type(label))
              )
  
imports: from ...proto import FeatureTypes_pb2
  from ..None import datatypes
  import coremltools
  import numpy
  import six
label_desc: Use image node_id 22 for calling the KNearestNeighborsClassifierBuilder obj's underlying member method code with example usage: obj._validate_label_types(labels) without return types