Skip to content

DOC Add link to plot_lasso_and_elasticnet.py example in linear model #30587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
15 changes: 10 additions & 5 deletions sklearn/linear_model/_bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,6 @@ class ARDRegression(RegressorMixin, LinearModel):
--------
BayesianRidge : Bayesian ridge regression.

Notes
-----
For an example, see :ref:`examples/linear_model/plot_ard.py
<sphx_glr_auto_examples_linear_model_plot_ard.py>`.

References
----------
D. J. C. MacKay, Bayesian nonlinear modeling for the prediction
Expand All @@ -564,6 +559,16 @@ class ARDRegression(RegressorMixin, LinearModel):
ARDRegression()
>>> clf.predict([[1, 1]])
array([1.])

For examples, refer to:

- :ref:`sphx_glr_auto_examples_linear_model_plot_ard.py`:
Demonstrates ARD Regression.

- :ref:`sphx_glr_auto_examples_linear_model_plot_lasso_and_elasticnet.py`:
Showcases ARD Regression alongside Lasso and Elastic-Net for sparse signal
recovery, addressing noise and feature correlation.

"""

_parameter_constraints: dict = {
Expand Down
8 changes: 8 additions & 0 deletions sklearn/linear_model/_coordinate_descent.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,10 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel):
1.451...
>>> print(regr.predict([[0, 0]]))
[1.451...]

For an example showcasing Elastic-Net alongside Lasso and ARD Regression for sparse
signal recovery in the presence of noise and feature correlation, see:
:ref:`sphx_glr_auto_examples_linear_model_plot_lasso_and_elasticnet.py`.
"""

# "check_input" is used for optimisation and isn't something to be passed
Expand Down Expand Up @@ -1306,6 +1310,10 @@ class Lasso(ElasticNet):
[0.85 0. ]
>>> print(clf.intercept_)
0.15...

For an example comparing Lasso with other L1-based regression models
(Elastic-Net and ARD Regression) on sparse and noisy data, see:
:ref:`sphx_glr_auto_examples_linear_model_plot_lasso_and_elasticnet.py`.
"""

_parameter_constraints: dict = {
Expand Down
Loading