Exercise:PCA and Whitening

From Ufldl

Jump to: navigation, search
(Step 4b: Check covariance)
Line 1: Line 1:
== PCA, PCA whitening and ZCA implementation ==
== PCA, PCA whitening and ZCA implementation ==
 +
 +
=== Step 0: Load data ===
 +
 +
[[File:raw_images.png|240px|alt=Raw images|Raw images]]
=== Step 1: Implement PCA ===
=== Step 1: Implement PCA ===
Line 12: Line 16:
Visualise the covariance matrix. You should see a line across the diagonal against a blue background.
Visualise the covariance matrix. You should see a line across the diagonal against a blue background.
 +
 +
[[File:pca_covar.png|240px]]
=== Step 2: Find number of components to retain ===
=== Step 2: Find number of components to retain ===
Line 24: Line 30:
Visualise the data, and compare it to the raw data. You should observe that the raw and processed data are of comparable quality. For comparison, you may wish to generate a PCA reduced image which retains only 50% of the variance.
Visualise the data, and compare it to the raw data. You should observe that the raw and processed data are of comparable quality. For comparison, you may wish to generate a PCA reduced image which retains only 50% of the variance.
 +
 +
[[File:pca_images.png|240px|alt=PCA dimension-reduced images (99% variance)|PCA dimension-reduced images (99% variance)]] [[File:raw_images.png|240px|alt=Raw images|Raw images]] [[File:pca_images_50.png|240px|alt=PCA dimension-reduced images (50% variance)|PCA dimension-reduced images (50% variance)]]
=== Step 4: PCA with whitening and regularisation ===
=== Step 4: PCA with whitening and regularisation ===
Line 36: Line 44:
Visualise the covariance matrix. You should see a red line across the diagonal against a blue background.
Visualise the covariance matrix. You should see a red line across the diagonal against a blue background.
 +
 +
[[File:pca_whitened_covar.png|240px]]
=== Step 5: ZCA whitening ===
=== Step 5: ZCA whitening ===
Line 42: Line 52:
Visualise the data, and compare it to the raw data. You should observe that the whitened images have enhanced edges.
Visualise the data, and compare it to the raw data. You should observe that the whitened images have enhanced edges.
 +
 +
[[File:zca_whitened_images.png|240px|alt=ZCA whitened images|ZCA whitened images]] [[File:raw_images.png|240px|alt=Raw images|Raw images]]

Revision as of 04:14, 3 April 2011

Personal tools