Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG+1] use ignore_warnings to catch FutureWarning raised by SGDClassifier #9374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions sklearn/utils/tests/test_estimator_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils.testing import (assert_raises_regex, assert_true,
assert_equal)
assert_equal, ignore_warnings)
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils.estimator_checks import set_random_state
from sklearn.utils.estimator_checks import set_checking_parameters
Expand Down Expand Up @@ -203,15 +203,19 @@ def test_check_estimator_clones():
for Estimator in [GaussianMixture, LinearRegression,
RandomForestClassifier, NMF, SGDClassifier,
MiniBatchKMeans]:
est = Estimator()
with ignore_warnings(category=FutureWarning):
# when 'est = SGDClassifier()'
est = Estimator()
set_checking_parameters(est)
set_random_state(est)
# without fitting
old_hash = joblib.hash(est)
check_estimator(est)
assert_equal(old_hash, joblib.hash(est))

est = Estimator()
with ignore_warnings(category=FutureWarning):
# when 'est = SGDClassifier()'
est = Estimator()
set_checking_parameters(est)
set_random_state(est)
# with fitting
Expand Down