# cosmos
> Your personal library of every algorithm and data structure code that you will ever encounter

# Principal component analysis
Solution to Principal Component Analysis Inspired by [Sebastian Raschka](http://sebastianraschka.com/Articles/2014_pca_step_by_step.html)

The PCA approach may be summarized according to these steps:
1. Take the whole dataset consisting of dd-dimensional samples ignoring the class labels
2. Compute the dd-dimensional mean vector (i.e., the means for every dimension of the whole dataset)
3. Compute the scatter matrix (alternatively, the covariance matrix) of the whole data set
4. Compute eigenvectors and corresponding eigenvalues
5. Sort the eigenvectors by decreasing eigenvalues and choose eigenvectors with the largest eigenvalues.
6. Use eigenvector matrix to transform the samples onto the new subspace.
---

<p align="center">
	A massive collaborative effort by <a href="https://github.com/OpenGenus/cosmos">OpenGenus Foundation</a>
</p>

---
