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

Skip to content

[MRG] DOC Fix warnings in examples #12654

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 56 commits into from
Jan 17, 2019

Conversation

adrinjalali
Copy link
Member

Fixe or suppresses many warnings in examples, including matplotlib complaining about the non-gui backend.

Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! A few comments are below, overall LGTM.

In general, I don't think it's such a big issue to have e.g. a ConvergenceWarning in an example if a few are remaining. That's a real use case, and it's better to show that to user rather than hide it (just for the sake of having no warnings in sphinx log).

@@ -90,7 +90,7 @@ def fit_and_score(estimator, max_iter, X_train, X_test, y_train, y_test):
# Define the estimators to compare
estimator_dict = {
'No stopping criterion':
linear_model.SGDClassifier(tol=None, n_iter_no_change=3),
linear_model.SGDClassifier(tol=-np.inf, n_iter_no_change=3),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not None (or just remove it altogether since it's the default)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had it -inf cause that's the default now, but changed to 1e-3 which is the new default. Not passing it causes a warning.


print(__doc__)
# Author: Arthur Mensch

t0 = time.clock()
warnings.filterwarnings("ignore", category=ConvergenceWarning,
module="sklearn")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that it's better to show the convergence warning to user rather than hide it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea here is to be explicit in the code that we know the model is not converging, but we know what we're doing. I'd say if such a usecase happens in production, the user should explicitly have this in the code.

@jnothman
Copy link
Member

jnothman commented Jan 2, 2019

LGTM, though tests are failing.

@adrinjalali
Copy link
Member Author

yep, the tests fail due to #12906, they used to pass though.

@adrinjalali
Copy link
Member Author

Tests finally pass, [hopefully final] reviews welcome :)

@jnothman jnothman merged commit 69c8967 into scikit-learn:master Jan 17, 2019
@jnothman
Copy link
Member

Thanks @adrinjalali

@adrinjalali adrinjalali deleted the examples/warnings branch January 17, 2019 10:42
@jnothman
Copy link
Member

Hmm... this has broken Circle with the following TeX error:


! Package pdftex.def Error: File `modules/../auto_examples/svm/images/sphx_glr_
plot_iris_001.png' not found.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.16846 ...vm/images/sphx_glr_plot_iris_001}.png}}
                                                  \end{figure}^^M
!  ==> Fatal error occurred, no output PDF file produced!

Any idea what the cause is, or does it need investigation?

@jnothman
Copy link
Member

Ah, I see. File name changed.

@adrinjalali
Copy link
Member Author

yep examples/svm/plot_iris.py → examples/svm/plot_svm_iris.py

@jnothman
Copy link
Member

Fixing in 486f8fc

thomasjpfan pushed a commit to thomasjpfan/scikit-learn that referenced this pull request Feb 7, 2019
Fixe or suppresses many warnings in examples, including matplotlib complaining about the non-gui backend.
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
Fixe or suppresses many warnings in examples, including matplotlib complaining about the non-gui backend.
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Fixe or suppresses many warnings in examples, including matplotlib complaining about the non-gui backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants