Skip to content
ML Academy

Classical ML, validation, metrics, interpretation, debugging · insight-1173

Read a convergence warning from a penalized linear model as a scaling problem before raising max_iter

Evidence type
documented fact
Difficulty
medium
Roles
Data scientist, ML engineer
Industries
cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    A logistic regression warns that it did not converge after features in very different units (fares, counts, 0/1 flags) were added.

  2. Action

    Standardize numeric features inside the pipeline, refit with the default max_iter, and raise it only if the warning persists. Re-tune C on the scaled data, and choose lbfgs or liblinear rather than sag or saga if scaling cannot be guaranteed.

  3. Reason

    Solver convergence and penalty strength both depend on feature scale; the documentation marks sag and saga as not robust to unscaled data and notes that lbfgs suffers on poorly scaled data.

  4. Boundary

    LogisticRegression, ridge-style and SGD-based models with mixed-unit inputs.

Symptom or risk

Raising max_iter hides ill-conditioning; the penalty then hits features unevenly, so the tuned C depends on units and does not transfer to the next feature set.

Exceptions

Tree models and unpenalized exact solvers do not need it.

Trade-offs

Scaled coefficients are harder to present; convert them back to original units for reporting.

Pitfalls

Fitting the scaler on all rows, or standardizing rare one-hot columns, which inflates them.

Lessons and concepts

Claims and their sources

  • The scikit-learn solver table lists sag and saga as not robust to unscaled datasets, and says lbfgs performance suffers on poorly scaled datasets and on one-hot columns with rare categories.

    Linear Models (scikit-learn User Guide 1.1)