Now that you have high level overview of PCA as well as some of the details in the algorithm itself, its time to practice implementing PCA on your own using the NumPy package.
You will be able to:
- Implement PCA from scratch using NumPy
To start, import the data stored in the file 'foodusa.csv'.
#Your code here
Next, normalize your data by subtracting the feature mean from each of the columns
#Your code here
The next step for PCA is to calculate to covariance matrix for your normalized data. Do so here.
#Your code here
Next, calculate the eigenvectors for your covariance matrix.
#Your code here
Great! Now that you have the eigenvectors and their associated eigenvalues, sort the eigenvectors based on their eigenvalues!
#Your code here
Finally, reproject the dataset using your eigenvectors. Reproject the dataset down to 2 dimensions.
#Your code here
Well done! You've now coded PCA on your own using NumPy! With that, it's time to look at further application of PCA.