You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] MLPRegressor incorrectly exposes partial_fit when solver="lbfgs" #35115
I am an algorithm engineer, and I have recently been using scikit-learn to build some machine learning models
Describe the bug and give evidence about its user-facing impact
In scikit-learn 1.9.1, MLPRegressor(solver="lbfgs") incorrectly exposes and allows calls to partial_fit(), although L-BFGS does not support incremental training.
Additional evidence: With the same solver configuration, MLPClassifier does not expose partial_fit(), whereas MLPRegressor does. This creates inconsistent behavior between the two estimators.
The cause is in MLPRegressor.partial_fit: it's gated with @available_if(lambda est: est._check_solver), missing the call parentheses, so the check never runs (a bound method is always truthy). MLPClassifier uses est._check_solver().
I have not opened a PR yet since the issue is still marked "Needs Triage". @cosimo17, you mentioned you're ready to fix this, so I'm happy to leave the PR to you, or to open mine once it's triaged, whichever you and the maintainers prefer. I reproduced the bug and verified the fix and tests locally.
Activity
CheerathAniketh commentedon Oct 10, 2026
The cause is in
MLPRegressor.partial_fit: it's gated with@available_if(lambda est: est._check_solver), missing the call parentheses, so the check never runs (a bound method is always truthy).MLPClassifierusesest._check_solver().With the call added,
hasattr(MLPRegressor(solver="lbfgs"), "partial_fit")isFalse, matching the classifier. I have a one-line fix plus a regression test (both estimators, all solvers) on my fork, withtest_mlp.pypassing locally: https://github.com/CheerathAniketh/scikit-learn/tree/fix-mlpregressor-partial-fit-lbfgsI have not opened a PR yet since the issue is still marked "Needs Triage". @cosimo17, you mentioned you're ready to fix this, so I'm happy to leave the PR to you, or to open mine once it's triaged, whichever you and the maintainers prefer.
I reproduced the bug and verified the fix and tests locally.
cakedev0 commentedon Oct 12, 2026
It looks like a valid & easy-to-fix issue. @cosimo17 feel free to fix it.
To others: please don't open PRs when the issue author has expressed in fixing the bug.