i all
I am learning PCA method by reading up Turk&Petland papers etc
while trying out PCA on a set of greyscale images using python, and
numpy I tried to create eigenvectors and facespace.

i have
 facesarray--- an NXP numpy.ndarray that contains data of images
       N=numof images,P=pixels in an image
avgarray --1XP array containing avg value for each pixel
 adjustedfaces=facesarray-avgarray
adjustedmatrix=matrix(adjustedfaces)
adjustedmatrix_trans=adjustedmatrix.transpose()
covariancematrix =adjustedmatrix*adjustedmatrix_trans
evalues,evect=eigh(covariancematrix)

after sorting such that most significant eigenvectors are selected.
evectmatrix is now my eigenvectors matrix

here is a sample using 4X3 greyscale images

evalues
[ -1.85852801e-13   6.31143639e+02   3.31182765e+03   5.29077871e+03]
evect
[[ 0.5        -0.06727772  0.6496399  -0.56871936]
 [ 0.5        -0.77317718 -0.37697426  0.10043632]
 [ 0.5         0.27108233  0.31014514  0.76179023]
 [ 0.5         0.56937257 -0.58281078 -0.29350719]]

evectmatrix  (sorted according to largest evalue first)
[[-0.56871936  0.6496399  -0.06727772  0.5       ]
 [ 0.10043632 -0.37697426 -0.77317718  0.5       ]
 [ 0.76179023  0.31014514  0.27108233  0.5       ]
 [-0.29350719 -0.58281078  0.56937257  0.5       ]]

then i can create facespace by
facespace=evectmat*adjustedfaces

till now i 've been following the steps as mentioned in the PCA
tutorial(by Lindsay smith & others)
what i want to know is that in the above evectmatrix is each row
([-0.56871936  0.6496399  -0.06727772  0.5   ] etc)  an eigenvector?
or  does a column in the above matrix represent an eigenvector?
to put it differently,
should i represent an eigenvector by
evectmatrix[i] or by
(get_column_i_of(evectmatrix)).transpose()

if someone can make this clear please do
D
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to