8000 DOC: Use notebook-style plot_dict_face_patches.py by teunpe · Pull Request #22929 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

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

Conversation

teunpe
Copy link
Contributor
@teunpe teunpe commented Mar 23, 2022

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?

@jeremiedbb
Copy link
Member

I restarted the CI because the artifacts were not generated

@jeremiedbb jeremiedbb added the Quick Review For PRs that are quick to review label Mar 24, 2022
@lesteve lesteve mentioned this pull request Mar 28, 2022
47 tasks
Copy link
Member
@jeremiedbb jeremiedbb left a 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.

Comment on lines 2 to 4
==================================================
Online learning of a dictionary of parts of faces
==================================================
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
==================================================
Online learning of a dictionary of parts of faces
==================================================
=================================================
Online learning of a dictionary of parts of faces
=================================================

Comment on lines 37 to 42
# %%
# Learn the dictionary of images

# ------------------------------
print("Learning the dictionary... ")
rng = np.random.RandomState(0)
kmeans = MiniBatchKMeans(n_clusters=81, random_state=rng, verbose=True)
Copy link
Member

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

Comment on lines 48 to 50
# %%
# The online learning part: cycle over the whole dataset 6 times
# --------------------------------------------------------------
Copy link
Member

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

Copy link
Member
@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

LGTM

@lesteve lesteve changed the title DOC: Update plot_dict_face_patches.py DOC: Use notebook-style plot_dict_face_patches.py Apr 8, 2022
@lesteve lesteve merged commit 6a4a6af into scikit-learn:main Apr 8, 2022
@lesteve
Copy link
Member
lesteve commented Apr 8, 2022

Merging, thanks a lot!

jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Apr 29, 2022
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Quick Review For PRs that are quick to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0