Skip to content
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

ENH Implement inverse_transform in DictionaryLearning, SparseCoder and MiniBatchDictionaryLearning #30443

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

rflamary
Copy link

@rflamary rflamary commented Dec 9, 2024

Reference Issues/PRs

Fixes #30442

Ping to @agramfort

What does this implement/fix? Explain your changes.

This PR implements the methods in the class _BaseSparseCoding from https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/decomposition/_dict_learning.py

The tests have also been updated to check that the reconstruction is accurate.

Any other comments?

@rflamary rflamary changed the title Implement inverse_transform in DictionaryLearningand SparseCoder ENH Implement inverse_transform in DictionaryLearningand SparseCoder Dec 9, 2024
Copy link

github-actions bot commented Dec 9, 2024

✔️ Linting Passed

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

Generated for commit: e2c0491. Link to the linter CI: here

def _inverse_transform(self, code, dictionary):
"""Private method allowing to accommodate both DictionaryLearning and
SparseCoder."""
if self.split_sign:
Copy link
Member

Choose a reason for hiding this comment

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

@rflamary can you just see what test needs to be updated to have these lines covered? thanks

Copy link
Author

Choose a reason for hiding this comment

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

It is done (slight modification of the test checking that split_sign works). Now all tests pass

@rflamary rflamary changed the title ENH Implement inverse_transform in DictionaryLearningand SparseCoder ENH Implement inverse_transform in DictionaryLearning, SparseCoder and MiniBatchDictionaryLearning Dec 10, 2024
@rflamary rflamary requested a review from agramfort December 10, 2024 09:26
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.

Missing inverse_transform in DictionaryLearningand SparseCoder
2 participants