38
38
from sklearn .svm .base import BaseLibSVM
39
39
40
40
# import "special" estimators
41
- from sklearn .decomposition import SparseCoder
42
41
from sklearn .pls import _PLS , PLSCanonical , PLSRegression , CCA , PLSSVD
43
- from sklearn .ensemble import RandomTreesEmbedding
44
42
from sklearn .feature_selection import SelectKBest
45
- from sklearn .dummy import DummyClassifier , DummyRegressor
46
43
from sklearn .naive_bayes import MultinomialNB , BernoulliNB
47
- from sklearn .covariance import EllipticEnvelope , EllipticEnvelop
48
- from sklearn .feature_extraction import DictVectorizer , FeatureHasher
49
- from sklearn .feature_extraction .text import TfidfTransformer
50
44
from sklearn .kernel_approximation import AdditiveChi2Sampler
51
- from sklearn .preprocessing import (LabelBinarizer , LabelEncoder , Binarizer ,
52
- Normalizer , OneHotEncoder )
45
+ from sklearn .preprocessing import Binarizer , Normalizer
53
46
from sklearn .cluster import (WardAgglomeration , AffinityPropagation ,
54
47
SpectralClustering )
55
- from sklearn .isotonic import IsotonicRegression
56
48
from sklearn .random_projection import (GaussianRandomProjection ,
57
49
SparseRandomProjection )
58
50
59
51
from sklearn .cross_validation import train_test_split
60
52
61
- dont_test = [SparseCoder , EllipticEnvelope , EllipticEnvelop , DictVectorizer ,
62
- LabelBinarizer , LabelEncoder , TfidfTransformer ,
63
- IsotonicRegression , OneHotEncoder , RandomTreesEmbedding ,
64
- FeatureHasher , DummyClassifier , DummyRegressor ]
53
+ dont_test = ['SparseCoder' , 'EllipticEnvelope' , 'EllipticEnvelop' ,
54
+ 'DictVectorizer' , 'LabelBinarizer' , 'LabelEncoder' ,
55
+ 'TfidfTransformer' , 'IsotonicRegression' , 'OneHotEncoder' ,
56
+ 'RandomTreesEmbedding' , 'FeatureHasher' , 'DummyClassifier' ,
57
+ 'DummyRegressor' ]
65
58
66
59
67
60
def test_all_estimators ():
@@ -72,7 +65,7 @@ def test_all_estimators():
72
65
73
66
for name , E in estimators :
74
67
# some can just not be sensibly default constructed
75
- if E in dont_test :
68
+ if name in dont_test :
76
69
continue
77
70
# test default-constructibility
78
71
# get rid of deprecation warnings
@@ -136,7 +129,7 @@ def test_estimators_sparse_data():
136
129
estimators = [(name , E ) for name , E in estimators
137
130
if issubclass (E , (ClassifierMixin , RegressorMixin ))]
138
131
for name , Clf in estimators :
139
- if Clf in dont_test :
132
+ if name in dont_test :
140
133
continue
141
134
# catch deprecation warnings
142
135
with warnings .catch_warnings (record = True ):
@@ -172,7 +165,7 @@ def test_transformers():
172
165
for name , Trans in transformers :
173
166
trans = None
174
167
175
- if Trans in dont_test :
168
+ if name in dont_test :
176
169
continue
177
170
# these don't actually fit the data:
178
171
if Trans in [AdditiveChi2Sampler , Binarizer , Normalizer ]:
@@ -250,7 +243,7 @@ def test_transformers_sparse_data():
250
243
y = (4 * rng .rand (40 )).astype (np .int )
251
244
estimators = all_estimators (type_filter = 'transformer' )
252
245
for name , Trans in estimators :
253
- if Trans in dont_test :
246
+ if name in dont_test :
254
247
continue
255
248
# catch deprecation warnings
256
249
with warnings .catch_warnings (record = True ):
@@ -304,7 +297,7 @@ def test_estimators_nan_inf():
304
297
" transform." )
305
298
for X_train in [X_train_nan , X_train_inf ]:
306
299
for name , Est in estimators :
307
- if Est in dont_test :
300
+ if name in dont_test :
308
301
continue
309
302
if Est in (_PLS , PLSCanonical , PLSRegression , CCA , PLSSVD ):
310
303
continue
@@ -390,7 +383,7 @@ def test_classifiers_one_label():
390
383
error_string_predict = ("Classifier can't predict when only one class is "
391
384
"present." )
392
385
for name , Clf in classifiers :
393
- if Clf in dont_test :
386
+ if name in dont_test :
394
387
continue
395
388
# catch deprecation warnings
396
389
with warnings .catch_warnings (record = True ):
@@ -471,7 +464,7 @@ def test_classifiers_train():
471
464
n_classes = len (classes )
472
465
n_samples , n_features = X .shape
473
466
for name , Clf in classifiers :
474
- if Clf in dont_test :
467
+ if name in dont_test :
475
468
continue
476
469
if Clf in [MultinomialNB , BernoulliNB ]:
477
470
# TODO also test these!
@@ -539,7 +532,7 @@ def test_classifiers_classes():
539
532
# TODO: make work with next line :)
540
533
#y = y.astype(np.str)
541
534
for name , Clf in classifiers :
542
- if Clf in dont_test :
535
+ if name in dont_test :
543
536
continue
544
537
if Clf in [MultinomialNB , BernoulliNB ]:
545
538
# TODO also test these!
@@ -570,7 +563,7 @@ def test_regressors_int():
570
563
X = StandardScaler ().fit_transform (X )
571
564
y = np .random .randint (2 , size = X .shape [0 ])
572
565
for name , Reg in regressors :
573
- if Reg in dont_test or Reg in (CCA ,):
566
+ if name in dont_test or Reg in (CCA ,):
574
567
continue
575
568
# catch deprecation warnings
576
569
with warnings .catch_warnings (record = True ):
@@ -605,7 +598,7 @@ def test_regressors_train():
605
598
y = StandardScaler ().fit_transform (y )
606
599
succeeded = True
607
600
for name , Reg in regressors :
608
- if Reg in dont_test :
601
+ if name in dont_test :
609
602
continue
610
603
# catch deprecation warnings
611
604
with warnings .catch_warnings (record = True ):
0 commit comments