Skip to content

DOC: Add link to plot_sparse_coding.py in DictionaryLearning and Mini… #31472

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 2 commits into
base: main
Choose a base branch
from

Conversation

Marcilesm
Copy link

…BatchDictionaryLearning docstrings

Reference Issues/PRs

Addresses part of issue #30621

What does this implement/fix? Explain your changes.

This PR adds a reference to the example plot_sparse_coding.py in the Examples sections of the DictionaryLearning and MiniBatchDictionaryLearning class docstrings.

This improves documentation discoverability by linking relevant usage examples to their associated estimators.

Any other comments?

N/A

Copy link

github-actions bot commented Jun 2, 2025

❌ Linting issues

This PR is introducing linting issues. Here's a summary of the issues. Note that you can avoid having linting issues by enabling pre-commit hooks. Instructions to enable them can be found here.

You can see the details of the linting issues under the lint job here


ruff check

ruff detected issues. Please run ruff check --fix --output-format=full locally, fix the remaining issues, and push the changes. Here you can see the detected issues. Note that the installed ruff version is ruff=0.11.7.


sklearn/decomposition/_dict_learning.py:1967:1: W293 Blank line contains whitespace
     |
1965 |     See the example:
1966 |     :ref:`sphx_glr_auto_examples_decomposition_plot_sparse_coding.py`
1967 |     
     | ^^^^ W293
1968 |     .. note::
     |
     = help: Remove whitespace from blank line

Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

Generated for commit: 6a858ff. Link to the linter CI: here

Copy link
Contributor

@StefanieSenger StefanieSenger left a comment

Choose a reason for hiding this comment

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

Hi @Marcilesm, thanks for opening a PR!

I think it needs a bit more work though, so that users can get the most of this.

  1. Please provide some more context with the links that make it obvious why you put them into the docstrings of DictionaryLearning and MiniBatchDictionaryLearning. I see SparseCoder used in the example, that codes based on a manually defined dictionary. What is the connection between these and the manually defined ricker_function and ricker_matrix? Adding this information will actually make users see this example's usefulness for them.
  2. We strive for not adding references into the "Examples" section of a docstring, since it is reserved for pure code snippets only. Maybe you can find a new location to these?

@Marcilesm Marcilesm force-pushed the doc-link-sparse-coding branch from ba41816 to 6a858ff Compare June 5, 2025 21:59
@Marcilesm
Copy link
Author

Marcilesm commented Jun 5, 2025

Hi @StefanieSenger,
I added it as a note and put a small description in to help clarify.
Thank you!

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.

3 participants