.. _example_cluster_plot_dict_face_patches.py: Online learning of a dictionary of parts of faces ================================================== This example uses a large dataset of faces to learn a set of 20 x 20 images patches that constitute faces. From the programming standpoint, it is interesting because it shows how to use the online API of the scikit-learn to process a very large dataset by chunks. The way we proceed is that we load an image at a time and extract randomly 15 patches from this image. Once we have accumulated 750 of these patches (using 50 images), we run the `partial_fit` method of the online KMeans object, MiniBatchKMeans. The verbose setting on the MiniBatchKMeans enables us to see that some clusters are reassigned during the successive calls to partial-fit. This is because the number of patches that they represent has become too low, and it is better to choose a random new cluster. **Python source code:** :download:`plot_dict_face_patches.py ` .. literalinclude:: plot_dict_face_patches.py :lines: 21-