

.. _example_decomposition_plot_faces_decomposition.py:


============================
Faces dataset decompositions
============================

This example applies to :ref:`olivetti_faces` different unsupervised
matrix decomposition (dimension reduction) methods from the module
:py:mod:`sklearn.decomposition` (see the documentation chapter
:ref:`decompositions`) .




.. rst-class:: horizontal


    *

      .. image:: images/plot_faces_decomposition_1.png
            :scale: 47

    *

      .. image:: images/plot_faces_decomposition_2.png
            :scale: 47

    *

      .. image:: images/plot_faces_decomposition_3.png
            :scale: 47

    *

      .. image:: images/plot_faces_decomposition_4.png
            :scale: 47

    *

      .. image:: images/plot_faces_decomposition_5.png
            :scale: 47

    *

      .. image:: images/plot_faces_decomposition_6.png
            :scale: 47

    *

      .. image:: images/plot_faces_decomposition_7.png
            :scale: 47


**Script output**::

  downloading Olivetti faces from http://cs.nyu.edu/~roweis/data/olivettifaces.mat to /tmp/buildd/scikit-learn-0.11.0/build/scikit_learn_data
  Dataset consists of 400 faces
  Extracting the top 6 Eigenfaces - RandomizedPCA...
  done in 0.327s
  Extracting the top 6 Non-negative components - NMF...
  done in 0.807s
  Extracting the top 6 Independent components - FastICA...
  done in 1.197s
  Extracting the top 6 Sparse comp. - MiniBatchSparsePCA...
  done in 0.938s
  Extracting the top 6 MiniBatchDictionaryLearning...
  done in 0.788s
  Extracting the top 6 Cluster centers - MiniBatchKMeans...
  done in 0.175s



**Python source code:** :download:`plot_faces_decomposition.py <plot_faces_decomposition.py>`

.. literalinclude:: plot_faces_decomposition.py
    :lines: 12-
    