Exercise:PCA and Whitening

From Ufldl

Jump to: navigation, search
Line 8: Line 8:
==== Step 0a: Load 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 12x12 patches from them. The raw patches sampled from the images will look something like this:
[[File:raw_images.png|240px|alt=Raw images|Raw images]]
[[File:raw_images.png|240px|alt=Raw images|Raw images]]
Line 36: Line 36:
=== Step 3: PCA with dimension reduction ===
=== Step 3: PCA with dimension reduction ===
-
Now that you have found <math>k</math>, you can reduce the dimension of the data by discarding the remaining dimensions. In this way, you can represent the data in <math>k</math> dimensions instead of the original 196, which will save you computational time when running learning algorithms on the reduced representation.
+
Now that you have found <math>k</math>, you can reduce the dimension of the data by discarding the remaining dimensions. In this way, you can represent the data in <math>k</math> dimensions instead of the original 144, which will save you computational time when running learning algorithms on the reduced representation.
To see the effect of dimension reduction, invert the PCA transformation to produce the matrix <math>\hat{x}</math>, the dimension-reduced data with respect to the original basis. Visualise <math>\hat{x}</math> and compare it to the raw data, <math>x</math>. You will observe that there is little loss due to throwing away the principal components that correspond to dimensions with low variation. For comparison, you may also wish to generate and visualise <math>\hat{x}</math> for when only 50% of the variance is retained.
To see the effect of dimension reduction, invert the PCA transformation to produce the matrix <math>\hat{x}</math>, the dimension-reduced data with respect to the original basis. Visualise <math>\hat{x}</math> and compare it to the raw data, <math>x</math>. You will observe that there is little loss due to throwing away the principal components that correspond to dimensions with low variation. For comparison, you may also wish to generate and visualise <math>\hat{x}</math> for when only 50% of the variance is retained.

Revision as of 05:36, 29 April 2011

Personal tools