-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
DOC: Use notebook-style plot_dict_face_patches.py #22929
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
DOC: Use notebook-style plot_dict_face_patches.py #22929
Conversation
Fixes plot_dict_face_patches.py for [scikit-learn#22406](scikit-learn#22406)
I restarted the CI because the artifacts were not generated |
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.
Thanks for the PR @teunpe. Could you move the imports in the sections where they're needed first ?
I also made a few suggestions to have more meaningful cells.
================================================== | ||
Online learning of a dictionary of parts of faces | ||
================================================== |
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.
================================================== | |
Online learning of a dictionary of parts of faces | |
================================================== | |
================================================= | |
Online learning of a dictionary of parts of faces | |
================================================= |
# %% | ||
# Learn the dictionary of images | ||
|
||
# ------------------------------ | ||
print("Learning the dictionary... ") | ||
rng = np.random.RandomState(0) | ||
kmeans = MiniBatchKMeans(n_clusters=81, random_state=rng, verbose=True) |
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.
This cell doesn't do any learning actually. It just defines what will be used.
I think it would make more sense to rename this cell "loading the data" and move the data loading into it
# %% | ||
# The online learning part: cycle over the whole dataset 6 times | ||
# -------------------------------------------------------------- |
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.
This cell then would be renamed "Learn the dictionary of images" and the line kmeans = MiniBatchKMeans(n_clusters=81, random_state=rng, verbose=True)
should be move here
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.
LGTM
Merging, thanks a lot! |
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
Reference Issues/PRs
Fixes plot_dict_face_patches.py for #22406
What does this implement/fix? Explain your changes.
It updates the example plot_dict_face_patches.py to notebook style.
Any other comments?