Data Space
Click to add data points

Controls

Ready

Principal Component Analysis

PCA finds the directions of maximum variance in data and projects it onto a lower-dimensional subspace. The principal components are orthogonal eigenvectors of the covariance matrix.

How to Use

  • Click canvas to add data points
  • Press Compute to find principal components
  • Select 1 component to see 2D→1D projection
  • Toggle projections to see projection lines
  • Try different datasets to see how PC directions change

PCA Steps

  1. Center the data (subtract mean)
  2. Compute covariance matrix C = (1/n)XTX
  3. Find eigenvectors and eigenvalues of C
  4. Sort by eigenvalue (descending)
  5. Project data onto top k eigenvectors

Covariance Matrix

C = (1/n) Σᵢ (xᵢ − μ)(xᵢ − μ)T

Measures how features vary together.

Eigendecomposition

Cv = λv

Eigenvectors v are the principal directions, eigenvalues λ are the variances.

Explained Variance Ratio

ratio_k = λ_k / Σᵢ λᵢ

Fraction of total variance captured by component k.

Reconstruction

x̂ = W_k W_kT(x − μ) + μ

Approximate original data using k components.

PCA Metrics

Points 0
PC1 Variance -
PC2 Variance -
Explained (PC1) -
Explained (PC1+2) -
Mean -
Status Add points to begin