@@ -140,7 +140,7 @@ def check_estimator_sparse_data(name, Estimator):
140
140
if hasattr (estimator , 'predict_proba' ):
141
141
estimator .predict_proba (X )
142
142
except TypeError as e :
143
- if not 'sparse' in repr (e ):
143
+ if 'sparse' not in repr (e ):
144
144
print ("Estimator %s doesn't seem to fail gracefully on "
145
145
"sparse data: error message state explicitly that "
146
146
"sparse input is not supported if this is not the case."
@@ -280,7 +280,7 @@ def check_estimators_nan_inf(name, Estimator):
280
280
else :
281
281
estimator .fit (X_train , y )
282
282
except ValueError as e :
283
- if not 'inf' in repr (e ) and not 'NaN' in repr (e ):
283
+ if 'inf' not in repr (e ) and 'NaN' not in repr (e ):
284
284
print (error_string_fit , Estimator , e )
285
285
traceback .print_exc (file = sys .stdout )
286
286
raise e
@@ -303,7 +303,7 @@ def check_estimators_nan_inf(name, Estimator):
303
303
try :
304
304
estimator .predict (X_train )
305
305
except ValueError as e :
306
- if not 'inf' in repr (e ) and not 'NaN' in repr (e ):
306
+ if 'inf' not in repr (e ) and 'NaN' not in repr (e ):
307
307
print (error_string_predict , Estimator , e )
308
308
traceback .print_exc (file = sys .stdout )
309
309
raise e
@@ -318,7 +318,7 @@ def check_estimators_nan_inf(name, Estimator):
318
318
try :
319
319
estimator .transform (X_train )
320
320
except ValueError as e :
321
- if not 'inf' in repr (e ) and not 'NaN' in repr (e ):
321
+ if 'inf' not in repr (e ) and 'NaN' not in repr (e ):
322
322
print (error_string_transform , Estimator , e )
323
323
traceback .print_exc (file = sys .stdout )
324
324
raise e
@@ -444,7 +444,7 @@ def check_classifiers_one_label(name, Classifier):
444
444
try :
445
445
classifier .fit (X_train , y )
446
446
except ValueError as e :
447
- if not 'class' in repr (e ):
447
+ if 'class' not in repr (e ):
448
448
print (error_string_fit , Classifier , e )
449
449
traceback .print_exc (file = sys .stdout )
450
450
raise e
@@ -479,6 +479,7 @@ def check_classifiers_train(name, Classifier):
479
479
if name in ['BernoulliNB' , 'MultinomialNB' ]:
480
480
X -= X .min ()
481
481
set_fast_parameters (classifier )
482
+ set_random_state (classifier )
482
483
# raises error on malformed input for fit
483
484
assert_raises (ValueError , classifier .fit , X , y [:- 1 ])
484
485
@@ -497,7 +498,7 @@ def check_classifiers_train(name, Classifier):
497
498
assert_raises (ValueError , classifier .predict , X .T )
498
499
if hasattr (classifier , "decision_function" ):
499
500
try :
500
- # decision_function agrees with predict
501
+ # decision_function agrees with predict
501
502
decision = classifier .decision_function (X )
502
503
if n_classes is 2 :
503
504
assert_equal (decision .shape , (n_samples ,))
0 commit comments