Exercise:PCA and Whitening

From Ufldl

Jump to: navigation, search
(PCA, PCA whitening and ZCA implementation)
Line 5: Line 5:
You will build on the MATLAB starter code which we have provided in <tt>[http://ufldl.stanford.edu/wiki/resources/pca_exercise.zip pca_exercise.zip]</tt>. You need only write code at the places indicated by "YOUR CODE HERE" in the files. The only file you need to modify is <tt>pca_gen.m</tt>.
You will build on the MATLAB starter code which we have provided in <tt>[http://ufldl.stanford.edu/wiki/resources/pca_exercise.zip pca_exercise.zip]</tt>. You need only write code at the places indicated by "YOUR CODE HERE" in the files. The only file you need to modify is <tt>pca_gen.m</tt>.
-
=== Step 0a: Load data ===
+
=== Step 0: Prepare data ===
 +
==== Step 0a: Load data ====
The starter code contains code to load some natural images and sample 10000 14x14 patches from them. The raw patches sampled from the images will look something like this:
The starter code contains code to load some natural images and sample 10000 14x14 patches from them. The raw patches sampled from the images will look something like this:
Line 13: Line 14:
These patches are stored as column vectors <math>x^{(i)} \in \mathbb{R}^{196}</math> in the <math>196 \times 10000</math> matrix <math>x</math>.
These patches are stored as column vectors <math>x^{(i)} \in \mathbb{R}^{196}</math> in the <math>196 \times 10000</math> matrix <math>x</math>.
-
=== Step 0b: Zero mean the data ===
+
==== Step 0b: Zero mean the data ====
You should then center the data at zero by subtracting the "mean image" from each image.
You should then center the data at zero by subtracting the "mean image" from each image.

Revision as of 01:49, 29 April 2011

Personal tools