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
RFC New parameters for penalties in LogisticRegression #28711
Currently, LogisticRegression uses C as inverse penalization strength, penalty to select the type of penalty and l1_ratio to control the ration between l1 and l2 penalties.
I propose the following:
Add alpha (as in Ridge, ElasticNet, PoissonRegressor ...) instead of C.
Fail if both are given at the same time.
changed the title [-]New parameters for penalties in LogisticRegression[/-][+]RFC New parameters for penalties in LogisticRegression[/+]on Mar 27, 2024
If we are to do such a big renaming, wouldn't it make sense to use a more explicit name such as l2_regularization or l2_reg?
Also note: the alpha in lasso / GLMs and the one in ridge do not have the same meaning. One is scaled by the sum of sample weights (or n_samples) while the other is not. If we are to use a more explicit name such as l2_reg(ularization) we could use that opportunity to also make that more uniform across all linear models.
We had a discussion in the past about whether this is intentional or not because it could lead to make efficient parametrization for parameter tuning but I think we could decouple the choice of the default parameter value (which can stay estimator specific) from the choice of the parametrization which we could choose to make uniform across all linear models to simplify the message in the narrative doc, the reference doc and the various examples.
We could also decide to move progressively and first rename C by l2_reg and defer the decision to do a renaming/uniformization for alpha to a later time (if ever).
But C controls both l1 and l2 regularization (as alpha does for ElasticNet), their relative strength being controlled by l1_ratio. I'd find it confusing to rename it l2_reg and then enable l1 regularization by setting l2_reg=<some value> and l1_ratio=1.
Activity
[-]New parameters for penalties in LogisticRegression[/-][+]RFC New parameters for penalties in LogisticRegression[/+]jeremiedbb commentedon Mar 27, 2024
ping @scikit-learn/core-devs for more visibility.
ogrisel commentedon Mar 28, 2024
If we are to do such a big renaming, wouldn't it make sense to use a more explicit name such as
l2_regularizationorl2_reg?Also note: the alpha in lasso / GLMs and the one in ridge do not have the same meaning. One is scaled by the sum of sample weights (or n_samples) while the other is not. If we are to use a more explicit name such as
l2_reg(ularization)we could use that opportunity to also make that more uniform across all linear models.We had a discussion in the past about whether this is intentional or not because it could lead to make efficient parametrization for parameter tuning but I think we could decouple the choice of the default parameter value (which can stay estimator specific) from the choice of the parametrization which we could choose to make uniform across all linear models to simplify the message in the narrative doc, the reference doc and the various examples.
We could also decide to move progressively and first rename C by
l2_regand defer the decision to do a renaming/uniformization foralphato a later time (if ever).jeremiedbb commentedon Mar 28, 2024
But
Ccontrols both l1 and l2 regularization (as alpha does for ElasticNet), their relative strength being controlled byl1_ratio. I'd find it confusing to rename itl2_regand then enable l1 regularization by settingl2_reg=<some value>andl1_ratio=1.ogrisel commentedon Mar 28, 2024
Indeed
l2_reg(ularization)would be a bad name:reg(ularization)_strengthor justregularizationmight be a better name.lorentzenchr commentedon Apr 1, 2024
I would prefer a consistent name among all linear models and
alphaseems to be used most often as penalty strength.As of version 1.4:
LogisticRegressionCpenalty,l1_ratiodeprecatedPassiveAggressiveClassifierclassifierdifferent meaningCRidgeClassifieralphaSGDClassifieralphapenalty,l1_ratioRidgealphaSGDRegressoralphapenalty,l1_ratioElasticNetalphal1_ratioLassoalphaLassoLarsalphaOrthogonalMatchingPursuitn_nonzero_coefsHuberRegressoralphaQuantileRegressoralphaPoissonRegressoralphaTweedieRegressoralphaGammaRegressoralphadeprecatedPassiveAggressiveRegressorregressordifferent meaningCSee also #15657 and #30308.