A feature extraction method: Principal Component Analysis (PCA) I read some articles about PCA and I think the nice way to summarize it is:


  It is a way of identifying patterns in data, and expressing the data in such a way as to highlight their similarities and differences.


So in my code, we subtract the initial data from the mean and find principal components, then  we multiply the data by a variable called e as for our dimension reduction purposes. 

What I don't understand here is that When we want to highlight the similarities and differences, it happens both about noise data, the data which is too big or too small, will be soften. What about the edges in our image? Will the same thing happen to those data? I mean, when we have a change of color from white to black and we don't want to lose such information, will PCA soften the data as well as noise? If yes, this is not what we want, is it? Is there a solution to solve this problem ?
Ok, it sounds like you are trying to do eigenfaces, right?

In that case, you have to think of your face images as points in a very high-dimensional space. For example, if your images are 32x32, then the space has 32 * 32 = 1024 dimensions.  Operating in so many dimensions is very difficult, because distances between points become almost meaningless.  With so many dimensions any point is very far away from any other point, even if the two points represent the same face.

That's why you want to reduce the dimensionality, and PCA is one way to do it. If you go from 1024 dimensions to, say, 10, then the distances will become more meaningful, which fits in with your idea of "highlight their similarities and differences".  However, PCA by itself will not tell you of any patterns in your data, beyond the directions of greatest variance.  PCA will project your data into a lower-dimensional space with decorrelated axes, but you have to do more work to actually discover the patterns in the data, such as train a classifier, or run a clustering algorithm.

Now, to understand what happens to the edges and transitions from light to dark, you have to display your eigenvectors as images and look at them. You will see that you don't really preserve the precise edge information, but you do keep course-level information about light and dark areas.