10000 Make convergence warnings appear when verbose = 0 in Logistic Regress… · AlexandreSev/scikit-learn@af76e36 · GitHub
[go: up one dir, main page]

Skip to content

Commit af76e36

Browse files
committed
Make convergence warnings appear when verbose = 0 in Logistic Regression.
For lbfgs and liblinears solvers, the convergence warnings appeared only when verbose was greater than 0, whereas they appeared with verbose = 0 with other solvers. See scikit-learn#10866
1 parent 9752398 commit af76e36

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sklearn/linear_model/logistic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ def logistic_regression_path(X, y, pos_class=None, Cs=10, fit_intercept=True,
707707
func, w0, fprime=None,
708708
args=(X, target, 1. / C, sample_weight),
709709
iprint=(verbose > 0) - 1, pgtol=tol, maxiter=max_iter)
710-
if info["warnflag"] == 1 and verbose > 0:
710+
if info["warnflag"] == 1:
711711
warnings.warn("lbfgs failed to converge. Increase the number "
712712
"of iterations.", ConvergenceWarning)
713713
# In scipy <= 1.0.0, nit may exceed maxiter.

sklearn/svm/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ def _fit_liblinear(X, y, C, fit_intercept, intercept_scaling, class_weight,
907907
# on 32-bit platforms, we can't get to the UINT_MAX limit that
908908
# srand supports
909909
n_iter_ = max(n_iter_)
910-
if n_iter_ >= max_iter and verbose > 0:
910+
if n_iter_ >= max_iter:
911911
warnings.warn("Liblinear failed to converge, increase "
912912
"the number of iterations.", ConvergenceWarning)
913913

0 commit comments

Comments
 (0)
0