class_docstr: Unit test class for testing scikit-learn converter.
class_docstr_tok: ["Unit","test","class","for","testing","scikit-learn","converter","."]
docstr: Tests conversion of a model that's fitted with sparse data.
docstr_tok: ["Tests","conversion","of","a","model","that","'s","fitted","with","sparse","data","."]
code: def test_conversion_with_sparse_X(self):
      """Tests conversion of a model that's fitted with sparse data."""
      num_samples = 100
      num_dims = 64
      sparse_X = sparse.rand(
          num_samples, num_dims, format="csr"
      )  # KNeighborsClassifier only supports CSR format
      y = self.iris_y[
          0:num_samples
      ]  # the labels themselves don't matter - just use 100 of the Iris ones
  
      sklearn_model = KNeighborsClassifier(algorithm="brute")
      sklearn_model.fit(sparse_X, y)
  
      coreml_model = sklearn.convert(sklearn_model)
      coreml_spec = coreml_model.get_spec()
      self.assertIsNotNone(coreml_spec)
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/test/sklearn_tests/test_k_neighbors_classifier.py
imports: import unittest
  import numpy
  from scipy import sparse
  from coremltools._deps import _HAS_SKLEARN
label_desc: Use image node_id 11 for calling the KNeighborsClassifierScikitTest obj's underlying member method code with example usage: obj.test_conversion_with_sparse_X() without return types