File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import numpy as np
9
9
import pytest
10
- from scipy .sparse import csr_matrix
11
10
12
11
from sklearn import metrics , neighbors
13
12
from sklearn .datasets import load_iris
18
17
check_outlier_corruption ,
19
18
parametrize_with_checks ,
20
19
)
20
+ from sklearn .utils .fixes import CSR_CONTAINERS
21
21
22
22
# load the iris dataset
23
23
# and randomly permute it
@@ -238,11 +238,12 @@ def test_predicted_outlier_number(expected_outliers):
238
238
check_outlier_corruption (num_outliers , expected_outliers , y_dec )
239
239
240
240
241
- def test_sparse ():
241
+ @pytest .mark .parametrize ("csr_container" , CSR_CONTAINERS )
242
+ def test_sparse (csr_container ):
242
243
# LocalOutlierFactor must support CSR inputs
243
244
# TODO: compare results on dense and sparse data as proposed in:
244
245
# https://github.com/scikit-learn/scikit-learn/pull/23585#discussion_r968388186
245
- X = csr_matrix (iris .data )
246
+ X = csr_container (iris .data )
246
247
247
248
lof = neighbors .LocalOutlierFactor (novelty = True )
248
249
lof .fit (X )
You can’t perform that action at this time.
0 commit comments