Skip to content

Set parameter of ElasticNetRegression to set the ratio between L1 (lasso) and L2 (ridge) regularization #166

@lars-reimann

Description

@lars-reimann

Is your feature request related to a problem?

It's not possible to configure in the elastic net regression model whether it should apply more L1 or L2 regularization.

Desired solution

  • Add a new parameter lasso_ratio: float to the initializer of safeds.ml.regression.ElasticNetRegression
  • Raise a value error if lasso_ratio < 0 or lasso_ratio > 1
  • Warn if lasso_ratio == 0 -> Users should use RidgeRegression instead
  • Warn if lasso_ratio == 1 -> Users should use LassoRegression instead
  • Pass it along to l1_ratio of the wrapped scikit-learn model in the fit method

Possible alternatives (optional)

No response

Screenshots (optional)

No response

Additional Context (optional)

  • Use warnings.warn to warn.
  • Use with pytest.warns to test that the warning is created.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✔️ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions