-
-
Notifications
You must be signed in to change notification settings - Fork 26k
[MRG] added example to class sklearn.decomposition.DictionaryLearning #12209
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
Conversation
... [1.,0.,0.], | ||
... [2.,2.,2.], | ||
... [2.,5.,4.]]) | ||
>>> dico = DictionaryLearning(n_components=3, alpha=1, random_state=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use n_components=2 so the shape of the result is clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Let's merge once the tests are green.
>>> import numpy as np | ||
>>> from sklearn.decomposition import DictionaryLearning | ||
>>> X = np.array([[0., 0., 1.], | ||
... [1.,0.,0.], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please indent to match first line ("visual indentation")
>>> V = dico.fit(X).components_ | ||
>>> V | ||
array([[-0.2981424 , -0.74535599, -0.59628479], | ||
[ 0.57735027, 0.57735027, 0.57735027]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ellipsis (...
) and limiting the examples to max 4 digits of floating point precision helps when we compile and test things in different platforms, not all our examples follow this though, example. You could also simplify the last two lines and just have dico.fit(X).components_
, with probably a commend if you like.
Hello @ThaliaBarrera , Thank you for participating in the WiMLDS/scikit sprint. We would love to merge all the PRs that were submitted. It would be great if you could follow up on the work that you started! For the PR you submitted, would you please update and re-submit? Please include #wimlds in your PR conversation. Any questions:
cc: @reshamas |
Since there has been no response from @ThaliaBarrera after multiple attempts to contact her (via github and meetup email), I will complete this PR. cc: @sergulaydore |
Reference Issues/PRs
What does this implement/fix? Explain your changes.
Added example to sklearn.decomposition.DictionaryLearning
Any other comments?