Implement the PCA algorithm