Exercise:PCA and Whitening

From Ufldl

Jump to: navigation, search
(Step 1b: Check covariance)
Line 24: Line 24:
==== Step 1b: Check covariance ====
==== Step 1b: Check covariance ====
-
To verify that your implementation of PCA is correct, you should check the covariance matrix for the rotated data. PCA guarantees that the covariance matrix for the rotated data is a diagonal matrix (a matrix with non-zero entries only along the main diagonal). Implement code to compute the covariance matrix and verify this property. One way to do this is to compute the covariance matrix, and visualise it using the MATLAB command <tt>imagesc</tt>. The image should show a multicoloured diagonal line against a blue background.
+
To verify that your implementation of PCA is correct, you should check the covariance matrix for the rotated data. PCA guarantees that the covariance matrix for the rotated data is a diagonal matrix (a matrix with non-zero entries only along the main diagonal). Implement code to compute the covariance matrix and verify this property. One way to do this is to compute the covariance matrix, and visualise it using the MATLAB command <tt>imagesc</tt>. The image should show a diagonal line against a blue background. For this dataset, because of the range of the diagonal entries, the diagonal line may not be apparent.
[[File:pca_covar.png|360px]]
[[File:pca_covar.png|360px]]

Revision as of 21:58, 29 April 2011

Personal tools