File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
sklearn/neural_network/tests Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 18
18
assert_almost_equal ,
19
19
assert_array_equal ,
20
20
)
21
- from scipy .sparse import csr_matrix
22
21
23
22
from sklearn .datasets import (
24
23
load_digits ,
31
30
from sklearn .neural_network import MLPClassifier , MLPRegressor
32
31
from sklearn .preprocessing import LabelBinarizer , MinMaxScaler , scale
33
32
from sklearn .utils ._testing import ignore_warnings
33
+ from sklearn .utils .fixes import CSR_CONTAINERS
34
34
35
35
ACTIVATION_TYPES = ["identity" , "logistic" , "tanh" , "relu" ]
36
36
@@ -626,11 +626,12 @@ def test_shuffle():
626
626
assert not np .array_equal (mlp1 .coefs_ [0 ], mlp2 .coefs_ [0 ])
627
627
628
628
629
- def test_sparse_matrices ():
629
+ @pytest .mark .parametrize ("csr_container" , CSR_CONTAINERS )
630
+ def test_sparse_matrices (csr_container ):
630
631
# Test that sparse and dense input matrices output the same results.
631
632
X = X_digits_binary [:50 ]
632
633
y = y_digits_binary [:50 ]
633
- X_sparse = csr_matrix (X )
634
+ X_sparse = csr_container (X )
634
635
mlp = MLPClassifier (solver = "lbfgs" , hidden_layer_sizes = 15 , random_state = 1 )
635
636
mlp .fit (X , y )
636
637
pred1 = mlp .predict (X )
You can’t perform that action at this time.
0 commit comments