Exercise: PCA in 2D
From Ufldl
(→Step 1a: Implement PCA) |
|||
Line 15: | Line 15: | ||
Plot the resulting basis on top of the given data points. You may find it useful to use MATLAB's <tt>hold on</tt> and <tt>hold off</tt> functions. | Plot the resulting basis on top of the given data points. You may find it useful to use MATLAB's <tt>hold on</tt> and <tt>hold off</tt> functions. | ||
- | [[File:pca_2d_basis.png | | + | [[File:pca_2d_basis.png | 400px]] |
==== Step 1b: Check xRot ==== | ==== Step 1b: Check xRot ==== | ||
Line 27: | Line 27: | ||
In the next step, set <math>k</math>, the number of components to retain, to be 1 (we have already done this for you). Compute the resulting <math>xHat</math> and plot the results, which should look like the following: | In the next step, set <math>k</math>, the number of components to retain, to be 1 (we have already done this for you). Compute the resulting <math>xHat</math> and plot the results, which should look like the following: | ||
- | [[File:pca_xhat_2d.png| | + | [[File:pca_xhat_2d.png|400px]] |
=== Step 3: PCA Whitening === | === Step 3: PCA Whitening === | ||
Implement PCA whitening using the formula from the notes. The resulting <tt>xPCAWhite</tt> should look like the following: | Implement PCA whitening using the formula from the notes. The resulting <tt>xPCAWhite</tt> should look like the following: | ||
- | [[File:pca_white_2d.png| | + | [[File:pca_white_2d.png|400px]] |
=== Step 4: ZCA Whitening === | === Step 4: ZCA Whitening === | ||
Implement ZCA whitening and plot the results. The results should look like the following: | Implement ZCA whitening and plot the results. The results should look like the following: | ||
- | [[File:zca_white_2d.png| | + | [[File:zca_white_2d.png|400px]] |