AI & ML Atlas
Machine LearningalgorithmAnimated walkthrough
Principal Component Analysis (PCA)
Finds the directions along which the data varies most and projects onto them.
The idea
Centre the data, then find the direction with the largest variance (the first principal component), then the next direction at right angles to it, and so on. Keeping only the first few components compresses the data while preserving most of its variation. They are the eigenvectors of the covariance matrix.
Σv = λv, explained variance = λᵢ / Σλ
Watch it run
The pipeline lights up one step at a time. Use the controls to pause or step through it.
- 1Subtract the mean from every feature.
- 2Compute the covariance matrix.
- 3Find its eigenvectors and eigenvalues.
- 4Sort by eigenvalue and keep the top k.
- 5Project the data onto those k directions.
Σv = λv, explained variance = λᵢ / Σλ
1/5
Step by step
- 1Subtract the mean from every feature.
- 2Compute the covariance matrix.
- 3Find its eigenvectors and eigenvalues.
- 4Sort by eigenvalue and keep the top k.
- 5Project the data onto those k directions.
Where it is used
Visualisation, noise reduction, speeding up other models.
Watch out for
It only finds linear structure, is affected by feature scale and its components can be hard to interpret.