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 y values in a sparse format.
docstr_tok: ["Tests","conversion","of","a","model","that","'s","fitted","with","y","values","in","a","sparse","format","."]
code: def test_conversion_with_sparse_y(self):
      """Tests conversion of a model that's fitted with y values in a sparse format."""
      from sklearn.model_selection import train_test_split
  
      X_train, X_test, y_train, y_test = train_test_split(
          self.iris_X, self.iris_y, test_size=0.2, train_size=0.8
      )
  
      from sklearn import preprocessing
  
      lb = preprocessing.LabelBinarizer(sparse_output=True)
      binarized_y = lb.fit_transform(y_train)
  
      sklearn_model = KNeighborsClassifier(algorithm="brute")
      sklearn_model.fit(X_train, binarized_y)
  
      self.assertRaises(ValueError, sklearn.convert, sklearn_model)
  
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 12 for calling the KNeighborsClassifierScikitTest obj's underlying member method code with example usage: obj.test_conversion_with_sparse_y() without return types