8000 DOC add links to plot_ridge_coeffs example by lsakovykh · Pull Request #31454 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

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

Conversation

lsakovykh
Copy link

This Pull Request addresses the meta-issue #30621 by adding direct links to the Ridge coefficients as a function of the L2 Regularization example (plot_ridge_coeffs.py) in two relevant locations within the scikit-learn documentation.

What has been done:

  • A reference link to plot_ridge_coeffs.py has been added to the docstring of the alpha parameter in sklearn/linear_model/_ridge.py. This provides users with a quick visual example of how regularization strength affects coefficients directly from the API documentation.
  • A corresponding reference link has been integrated into the narrative text of the "Ridge Regression" section within the User Guide (doc/modules/linear_model.rst). This enhances discoverability for users reading about linear models.

Challenges encountered during local documentation build:
During the local development and testing, I encountered persistent issues with building the documentation. Specifically, the build process failed due to compilation errors related to sphinxcontrib-sass and its libsass dependency, as well as ruamel.yaml.clib. These issues were consistently observed on Windows, regardless of the Python version used (3.13, 3.11, 3.10) within isolated Conda environments. The problem appears to stem from incompatibilities between the C extensions of these libraries and the Python 3.13 environment (or potentially MSVC compiler specifics on newer Python versions on Windows).

Due to these unresolvable local build failures, I am submitting this PR for CI review, trusting that the automated checks will ensure the documentation renders correctly. The changes themselves are minor documentation links using standard Sphinx/Sphinx-Gallery syntax and should not introduce any logical errors.


Reference Issues/PRs
Towards #30621

Copy link
github-actions bot commented May 29, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 9e399ee. Link to the linter CI: here

Copy link
Member
@virchan virchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR, @lsakovykh!

I have a few comments.

Comment on lines 111 to 112
To observe how the model coefficients are affected by different values of :math:`\alpha`,
see :ref:`Ridge coefficients as a function of the L2 Regularization <sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py>`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"See <example_line> for more details."

Comment on lines 1040 to 1042
See :ref:`Ridge coefficients as a function of the L2 Regularization
<sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py>` for an example
demonstrating the evolution of coefficients with regularization strength.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
See :ref:`Ridge coefficients as a function of the L2 Regularization
<sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py>` for an example
demonstrating the evolution of coefficients with regularization strength.
See :ref:`Ridge coefficients as a function of the L2 Regularization
<sphx_glr_auto_examples_linear_model_plot_ridge_coeffs.py>` for an example
demonstrating the evolution of coefficients with regularization strength.

"[...] for an example on how the model coefficients vary with the regularization strength."

@lsakovykh
Copy link
Author

Thanks a lot for your time and review!
I agree with your suggestions and have applied the changes.
I initially committed them via the GitHub interface and unfortunately missed some formatting issues (e.g. trailing whitespaces).
I’ve fixed them now, but the tests are still running — let me know if anything else needs adjustment once they’re finished!

@lsakovykh
Copy link
Author

One of the checks (scikit-learn.scikit-learn in commit fbc9336) has been hanging in the queued status for 2 days. It looks like it's frozen. I'll try to restart it by closing and opening the PR.

@lsakovykh lsakovykh closed this Jun 2, 2025
@lsakovykh lsakovykh reopened this Jun 2, 2025
Copy link
Member
@virchan virchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating the PR, @lsakovykh! I still have a few more comments.

It'd be a good idea to include the example link in the docstrings of RidgeCV, RidgeClassifier, RidgeClassifierCV, and ridge_regression.

@lsakovykh
Copy link
Author

Thanks a lot for the review and the additional suggestions!

I actually considered adding the example link to some of this classes initially, but for a first contribution, I decided to keep the scope a bit more focused on Ridge as the base.

Since you think it's beneficial to include them there too, I'll definitely go ahead and add the link to RidgeCV, RidgeClassifier, RidgeClassifierCV, and ridge_regression. I'll push the updated changes shortly.

Thanks again for the feedback!

@lsakovykh lsakovykh force-pushed the my_feature branch 3 times, most recently from 44f6942 to 06a47f6 Compare June 3, 2025 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0