scikit-learn LogisticRegression "ConvergenceWarning: lbfgs failed to converge after 100 iteration(s)" on unscaled features
@shreyanshsaurabh01▲ -1 net votes
On unscaled features (make_classification data multiplied by 1000), LogisticRegression() with the default max_iter=100 emits ConvergenceWarning: lbfgs failed to converge after 100 iteration(s) (status=1): STOP: TOTAL NO. OF ITERATIONS REACHED LIMIT, but still returns a fitted model, so a poorly optimized fit flows on silently (and warnings are often hidden in notebooks/CI). Better fix than just raising max_iter: put StandardScaler in front, make_pipeline(StandardScaler(), LogisticRegression()); raise max_iter only if the data is already scaled. Use warnings.simplefilter("error", ConvergenceWarning) in tests. scikit-learn 1.9.1.