Skip to content

ENH: Add regularization to the main NMF class - #17414

Merged
TomDLT merged 12 commits into
scikit-learn:masterfrom
bharatr21:nmf
Aug 6, 2020
Merged

TomDLT merged 12 commits into
scikit-learn:masterfrom
bharatr21:nmf

Conversation

@bharatr21

@bharatr21 bharatr21 commented Jun 1, 2020 •

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #12520

What does this implement/fix? Explain your changes.

Introduces the regularization parameter to the main NMF() class instead of just the public non_negative_factorization public function

Any other comments?

Need guidance on how to add tests to the test_nmf_regularization()
Tagging @adrinjalali for PR review, based on the issue

@adrinjalali adrinjalali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR @Bharat123rox

Comment thread sklearn/decomposition/_nmf.py Outdated
Comment thread sklearn/decomposition/tests/test_nmf.py Outdated
Comment thread sklearn/decomposition/tests/test_nmf.py Outdated
bharatr21 and others added 2 commits July 14, 2020 17:30
Update `_nmf.py` with suggestion from review

Co-authored-by: Adrin Jalali <[email protected]>
@bharatr21

bharatr21 commented Jul 14, 2020 •

Copy link
Copy Markdown
Contributor Author

Doc failures seem to be intermittent, or a build failure from CircleCI which are unrelated to these changes 😞

@bharatr21
bharatr21 requested a review from adrinjalali July 14, 2020 18:49

@thomasjpfan thomasjpfan left a comment

Copy link
Copy Markdown
Member

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 @Bharat123rox !

Comment thread sklearn/decomposition/_nmf.py Outdated
@cmarmo

cmarmo commented Aug 3, 2020

Copy link
Copy Markdown
Contributor

@Bharat123rox something went wrong in CircleCI, unrelated with your PR: do you mind fixing conflicts in order to trigger the build? Thanks!

@cmarmo cmarmo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Bharat123rox!

Comment thread sklearn/decomposition/_nmf.py Outdated

@TomDLT TomDLT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice job !

You might want to add a changelog entry in doc/whats_new/0.24.rst.

Comment thread sklearn/decomposition/_nmf.py Outdated
Comment thread sklearn/decomposition/_nmf.py Outdated
Comment thread sklearn/decomposition/_nmf.py Outdated
Comment thread doc/whats_new/v0.24.rst Outdated
@bharatr21
bharatr21 requested review from TomDLT and thomasjpfan August 5, 2020 17:06

class NMF(TransformerMixin, BaseEstimator):
r"""Non-Negative Matrix Factorization (NMF)
"""Non-Negative Matrix Factorization (NMF)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was to make

regularization : {'both', 'components', 'transformation', None}, \
                      default='both'

work with the \. I do not think there is a way to ignore the newline in a raw string.

XREF: numpy/numpydoc#87

@TomDLT
TomDLT merged commit f734e11 into scikit-learn:master Aug 6, 2020
@TomDLT

TomDLT commented Aug 6, 2020

Copy link
Copy Markdown
Member

Thanks @Bharat123rox !

jayzed82 pushed a commit to jayzed82/scikit-learn that referenced this pull request Oct 22, 2020
* ENH: Add regularization to the main NMF class

* Update _nmf with suggestions from code review

Update `_nmf.py` with suggestion from review

Co-authored-by: Adrin Jalali <[email protected]>

* Refactor tests, fix linter errors

* Change default value to None

* Revert back to default value of "both"

* Update default value documentation acc to @thomasjpfan

Co-authored-by: Thomas J. Fan <[email protected]>

* CLN Places regularization at the end

* Add whatsnew entry

* DOC Fix

* DOC Fix

Co-authored-by: Adrin Jalali <[email protected]>
Co-authored-by: Thomas J. Fan <[email protected]>
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.

non_negative_factorization's 'regularize' parameter is lost in the OO interface

7 participants