Lesson 10 of 10 8 min · 126 words
Explained variance and visualization
Choosing the number of components and plotting data in 2D.
The explained variance ratio of component is . The cumulative sum over the first components says how much of the total variance they keep.
Choosing :
- Keep enough components for, say, 90–95% cumulative variance.
- Look for an elbow in the scree plot (eigenvalue vs. component number).
- Choose by cross-validating the downstream model.
- For visualisation, simply use or .
Plotting the first two components often reveals clusters, outliers and trends; colouring the points by label shows whether classes separate.
Formula to remember
Reconstruction error
Equivalent view: best low-rank reconstruction.
Quick check · +5 XP