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.
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.
| ================================================== | |
| 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.
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.
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
|
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?