Skip to content
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

[MRG] Improve the convergence warning message for LogisticRegression #15665

Merged
merged 2 commits into from Nov 19, 2019

Conversation

ogrisel
Copy link
Member

@ogrisel ogrisel commented Nov 19, 2019

This is a complement to the recently merged #15571 to also point to the documentation on the choice of the solver specifically for the logistic regression estimator.

To make it more readable, I used a multi-line formatting and I updated the test to make assertions for the different pieces of information we are expecting in the message:

>>> LogisticRegression(C=1e3, tol=0., max_iter=1).fit(X, y)                                                                                                                 
/home/ogrisel/code/scikit-learn/sklearn/linear_model/_logistic.py:939: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in:
    https://scikit-learn.org/stable/modules/preprocessing.html.
Please also refer to the documentation for alternative solver options:
    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
  extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG)

@ogrisel ogrisel added this to the 0.22 milestone Nov 19, 2019
@glemaitre glemaitre self-requested a review November 19, 2019 15:31
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

LGTM

@jnothman jnothman merged commit 43d8dee into scikit-learn:master Nov 19, 2019
@jnothman
Copy link
Member

This situation sucks, but okay

@ogrisel ogrisel deleted the logistic-convergence-warning branch November 20, 2019 09:09
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Nov 25, 2019
panpiort8 pushed a commit to panpiort8/scikit-learn that referenced this pull request Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants