Skip to content

added example to decomposition.DictionaryLearning #12799

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

Merged
merged 13 commits into from
Dec 18, 2018
Merged

added example to decomposition.DictionaryLearning #12799

merged 13 commits into from
Dec 18, 2018

Conversation

reshamas
Copy link
Member

Referencing PR / Issue

This closes #12209

Note

added example to decomposition.DictionaryLearning

cc: @ThaliaBarrera
#wimlds

Copy link
Member

@qinhanmin2014 qinhanmin2014 left a comment

Choose a reason for hiding this comment

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

please merge master in

>>> import numpy as np
>>> from sklearn.decomposition import DictionaryLearning
>>> X = np.array([[0., 0., 1.],
... [1.,0.,0.],
Copy link
Member

Choose a reason for hiding this comment

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

please avoid flake8 errors in examples

Copy link
Member Author

Choose a reason for hiding this comment

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

The flake8 test didn't pick them up. I suppose it is because it is in a comment?

Copy link
Contributor

@eamanu eamanu left a comment

Choose a reason for hiding this comment

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

LGTM

... [2., 2., 2.],
... [2., 5., 4.]])
>>> dico = DictionaryLearning(n_components=2, alpha=1, random_state=1)
>>> dico.fit(X).components_
Copy link
Member

Choose a reason for hiding this comment

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

could you please add # doctest: +ELLIPSIS at the end of this line to make sure the directive is active here?

Copy link
Contributor

@eamanu eamanu Dec 17, 2018

Choose a reason for hiding this comment

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

Sorry, a little question. What is the purpose of # doctest: +ELLIPSIS.?

Copy link
Member

Choose a reason for hiding this comment

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

it says that ... can be replaced by any string. The following lines replace the numbers with ... so that in case of numerical instability, the test still passes. If the directive is not active, doctest would expect exactly that as the output, instead of accepting anything in place of .... Not sure if I explained it clearly. reference

Copy link
Contributor

Choose a reason for hiding this comment

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

ahh yes! thanks!

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Thanks @reshamas !

@jnothman
Copy link
Member

Please improve the pull request title. This, by default, becomes the commit message

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

... [2., 2., 2.],
... [2., 5., 4.]])
>>> dico = DictionaryLearning(n_components=2, alpha=1, random_state=1)
>>> dico.fit(X).components_ # doctest: +ELLIPSIS
Copy link
Member

Choose a reason for hiding this comment

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

Pep8 there should be two spaces before #

@reshamas reshamas changed the title Decomp ex added example to decomposition.DictionaryLearning Dec 18, 2018
@adrinjalali
Copy link
Member

@reshamas usually if there's no merge conflict and the CI on master hasn't changed, you don't need to merge master into your branch for it to get merge into master.

@qinhanmin2014
Copy link
Member

Hmm, the example is under def dict_learning_online?

@adrinjalali
Copy link
Member

Oops, we missed that. The example should be under the DictionaryLearning class.

Copy link
Member

@qinhanmin2014 qinhanmin2014 left a comment

Choose a reason for hiding this comment

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

thanks @reshamas

@qinhanmin2014 qinhanmin2014 merged commit fec534a into scikit-learn:master Dec 18, 2018
@reshamas
Copy link
Member Author

thank you! @qinhanmin2014 @adrinjalali

@reshamas reshamas deleted the decomp_ex branch December 18, 2018 23:42
@qinhanmin2014
Copy link
Member

Hmm, DictionaryLearning is not stable, pypy is failing.

@reshamas
Copy link
Member Author

do we know why?

@reshamas reshamas restored the decomp_ex branch December 19, 2018 01:57
@jnothman
Copy link
Member

This also can fail on Mac: https://travis-ci.org/scikit-learn/scikit-learn/jobs/469827638

Seems to be possible to have signs of components flipped...

@qinhanmin2014
Copy link
Member

Let's revert and open an issue.

qinhanmin2014 added a commit that referenced this pull request Dec 19, 2018
@reshamas reshamas deleted the decomp_ex branch December 26, 2018 02:42
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Jan 7, 2019
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Jan 7, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants