In [10]:
run eigen.py

Create An EigenFace Object

In [11]:
eigen_face = EigenFace()

Take pca on the images

In [12]:
pca = eigen_face.get_pca()

Display the images(from Yale Face Database)

In [13]:
eigen_face.plot_image_dictionary()
plt.show()

Display EigenFaces

In [14]:
eigen_face.plot_eigen_vectors()
plt.show()

Display First EigenFace

In [15]:
eigen_face.plot_eigen_vector(0)
plt.show()

Display Average Face

In [16]:
eigen_face.plot_mean_vector()
plt.show()

Plot the eigenvalues upto 10

In [17]:
eigen_face.plot_eigen_value_distribution(range(0,10))
plt.show()

Get the minimum number of eigenvectors which explain 95% variance

In [18]:
eigen_face.get_number_of_components_to_preserve_variance()
Out[18]:
4