Explained variance
The retained-variance fraction is the retained squared singular-value sum divided by the complete squared sum.
On this page 9 sections
- Overview
- After choosing PCA directions, you need to decide how many to keep
- For scales (5,4,3), keeping two retains (25+16)/50=41/50
- A retained fraction describes variation in the centered data
- A variance target gives a reproducible compression rule
- Key takeaway
- Further questions
- Sources & further reading
- Concept connections
01After choosing PCA directions, you need to decide how many to keep#
After choosing PCA directions, you need to decide how many to keep. Explained variance reports the share of the centered dataset’s variation represented by selected components. It is a property of this dataset and transformation, not the fraction of future predictions that will be correct.
Singular values measure lengths. Variance measures squared spread, so each component contributes its squared singular value. For sample covariance there is also a common divisor ; it cancels in a fraction because retained and total variance use the same observations.
Retained variance compares squared singular scales. Square the complete list, add the retained squares, and divide by the sum of all squares. The total must be positive.
For singular values , total squared scale is . Keeping the first component retains of the variance, not .
With complete singular values , square first to obtain . Total variation is proportional to ; keeping the first component retains , or 64%. The discarded share is . Using would compare lengths instead of variation.
Centered-data singular values (complete). Keep . Retained variance fraction (use /)?
Show answer and explanation
Retained squares ; total .
02For scales (5,4,3), keeping two retains (25+16)/50=41/50#
For scales , keeping two retains . The discarded fraction is . These add to 1 because they partition the same squared total.
Centered-data singular values (complete). Keep . Claimed fraction . Repair.
Show answer and explanation
Squared sums: .
03A retained fraction describes variation in the centered data#
A retained fraction describes variation in the centered data. It does not guarantee predictive quality. Compare it to a target only after squaring: a target of at least includes equality.
For scales , total squared scale is . One component retains ; two retain . A target of at least 80% therefore needs two components in this example. Compare the cumulative fraction to the target after computing it.
Centered-data singular values (complete). Keep . Target: at least of variance. Target met?
Show answer and explanation
Retained fraction .
04A variance target gives a reproducible compression rule#
A variance target gives a reproducible compression rule. Before using it for prediction, validate the model with the chosen transformation fitted only on training data. A component carrying little feature variation may still carry useful label information.
Square the singular values. Divide the retained sum by the full positive sum; compare that fraction with the target.
- Compute a retained-variance fraction from supplied singular values.
Further questions
What if every singular value is zero?
Sources & further reading
- [1]Cornell CS4780, Principal component analysis ↗Cornell CS4780 · Book