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)
Tests conversion of a model that's fitted with sparse data.
coremltools/test/sklearn_tests/test_k_neighbors_classifier.py