fix: LRL1/LRL2 — migrate off sklearn 1.10 deprecations (penalty, n_jobs)#1556
Open
immu4989 wants to merge 1 commit into
Open
fix: LRL1/LRL2 — migrate off sklearn 1.10 deprecations (penalty, n_jobs)#1556immu4989 wants to merge 1 commit into
immu4989 wants to merge 1 commit into
Conversation
thinkall
approved these changes
May 30, 2026
Collaborator
|
The ci errors are caused by openml dataset downloading. Re-running. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
LRL1ClassifierandLRL2Classifierconfigure sklearn'sLogisticRegressionwith two arguments that were deprecated in scikit-learn 1.8 and scheduled for removal in scikit-learn 1.10:penalty=(usel1_ratioorCinstead —l1_ratio=1for L1,l1_ratio=0for L2)n_jobs=(has no effect since 1.8 —SGDEstimator.config2paramsalready pops this for the regression case)Each
lrl1/lrl2fit on sklearn ≥ 1.8 currently emits aFutureWarningforpenalty, aUserWarningforpenalty=l1 with l1_ratio=0.0, and aFutureWarningforn_jobs. Once scikit-learn 1.10 ships, these becomeTypeErrors and the two estimators hard-break.This PR version-gates the configuration in
config2paramsusing the existingSKLEARN_VERSIONconstant inflaml/automl/model.py(already in use for the SGDlossmigration at lines 2383 and 2437):LRL1Classifier: on sklearn ≥ 1.8, setl1_ratio=1.0and dropn_jobs; on older sklearn, keeppenalty="l1".LRL2Classifier: on sklearn ≥ 1.8, just dropn_jobs(the defaultLogisticRegressionpenalty is already"l2"); on older sklearn, keeppenalty="l2".Verified locally on sklearn 1.8.0: both migrations produce identical
coef_to the legacy configuration, the existinglrl1/lrl2reproducibility tests continue to pass, and noFutureWarning/UserWarningaboutpenaltyorn_jobsis emitted during fit.Related issue number
Closes #1555
Checks