Skip to content

Commit

Permalink
scikit-learn#5322: check_supervised_y_no_nan raises error when error …
Browse files Browse the repository at this point in the history
…message is incorrect
  • Loading branch information
hlin117 committed Oct 20, 2015
1 parent 7f82026 commit ef4faf6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sklearn/utils/estimator_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def check_supervised_y_no_nan(name, Estimator):
Estimator().fit(X, y1)
except ValueError as e:
if e.message != errmsg:
warnings.warn("Estimator {0} raised warning as expected, but "
"does not match expected error message")
raise ValueError("Estimator {0} raised warning as expected, but "
"does not match expected error message")
else:
raise ValueError("Estimator {0} should have raised error on fitting "
"array with NaN value.".format(Estimator.__name__))
Expand Down Expand Up @@ -718,6 +718,7 @@ def check_estimators_empty_data_messages(name, Estimator):


def check_estimators_nan_inf(name, Estimator):
# Checks that Estimator X's do not contain NaN or inf.
rnd = np.random.RandomState(0)
X_train_finite = rnd.uniform(size=(10, 3))
X_train_nan = rnd.uniform(size=(10, 3))
Expand Down

0 comments on commit ef4faf6

Please sign in to comment.