Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC add links to plot_ridge_coeffs example #31454

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 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/modules/linear_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ of squares:
The complexity parameter :math:`\alpha \geq 0` controls the amount
of shrinkage: the larger the value of :math:`\alpha`, the greater the amount
of shrinkage and thus the coefficients become more robust to collinearity.
See :ref:`Ridge coefficients as a function of the L2 Regularization <sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py>`
for more details.

.. figure:: ../auto_examples/linear_model/images/sphx_glr_plot_ridge_path_001.png
:target: ../auto_examples/linear_model/plot_ridge_path.html
Expand Down
20 changes: 20 additions & 0 deletions sklearn/linear_model/_ridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ def ridge_regression(
reasons, using `alpha = 0` with the `Ridge` object is not advised.
Instead, you should use the :class:`LinearRegression` object.

For an example on how the model coefficients
vary with the regularization strength, see
:ref:`sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py`.

If an array is passed, penalties are assumed to be specific to the
targets. Hence they must correspond in number.

Expand Down Expand Up @@ -1038,6 +1042,10 @@ class Ridge(MultiOutputMixin, RegressorMixin, _BaseRidge):
If an array is passed, penalties are assumed to be specific to the
targets. Hence they must correspond in number.

See :ref:`sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py`
for an example on how the model coefficients
vary with the regularization strength.

fit_intercept : bool, default=True
Whether to fit the intercept for this model. If set
to false, no intercept will be used in calculations
Expand Down Expand Up @@ -1365,6 +1373,10 @@ class RidgeClassifier(_RidgeClassifierMixin, _BaseRidge):
:class:`~sklearn.linear_model.LogisticRegression` or
:class:`~sklearn.svm.LinearSVC`.

For an example on how the model coefficients vary
with the regularization strength, see
:ref:`sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py`.

fit_intercept : bool, default=True
Whether to calculate the intercept for this model. If set to false, no
intercept will be used in calculations (e.g. data is expected to be
Expand Down Expand Up @@ -2533,6 +2545,10 @@ class RidgeCV(MultiOutputMixin, RegressorMixin, _BaseRidgeCV):
:class:`~sklearn.svm.LinearSVC`.
If using Leave-One-Out cross-validation, alphas must be strictly positive.

For an example on how the model coefficients vary
with the regularization strength, see
:ref:`sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py`.

fit_intercept : bool, default=True
Whether to calculate the intercept for this model. If set
to false, no intercept will be used in calculations
Expand Down Expand Up @@ -2717,6 +2733,10 @@ class RidgeClassifierCV(_RidgeClassifierMixin, _BaseRidgeCV):
:class:`~sklearn.svm.LinearSVC`.
If using Leave-One-Out cross-validation, alphas must be strictly positive.

For an example on how the model coefficients vary
with the regularization strength, see
:ref:`sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py`.

fit_intercept : bool, default=True
Whether to calculate the intercept for this model. If set
to false, no intercept will be used in calculations
Expand Down