Component scores
Principal-component scores are dot products of centered observations with the chosen unit principal directions.
On this page 9 sections
01A PCA direction specifies an axis#
A PCA direction specifies an axis. A score says where one observation lies along that axis. Transforming many observations with the same directions gives new features that can be plotted or passed to another model. Scores can be positive, negative, or zero.
The axes pass through the training mean. First subtract that mean from a raw observation. Then dot the centered vector with each chosen unit direction. A dot product includes every original feature, even when only one new score is requested.
A principal-component score is a coordinate, not a direction vector. For a centered observation, take one dot product with each chosen unit principal direction, in order.
For and directions , the first score is . The second is .
For centered , the first direction gives . The second direction gives . The observation lies entirely along the first axis, even though both original feature values are nonzero.
Centered row . Ordered PCs: ; . Scores?
Show answer and explanation
Dots: .
02Include every feature in every dot product#
Include every feature in every dot product. A zero score can mean the observation is perpendicular to that component; it does not mean the observation is the zero vector. Scores differ from the original feature values.
Centered row . Ordered PCs: ; . Claim: uses only feature 1. Repair.
Show answer and explanation
Dots: .
03For raw row (5,6) and training means (2,2), first center to (3,4)#
For raw row and training means , first center to . With directions , the scores are . Projecting the raw row would measure from the wrong origin.
Raw row ; training means . Ordered PCs: ; . Scores?
Show answer and explanation
Dots: .
04A closer look#
A new sensor reading must use the training means and training directions in the same order as earlier readings. Otherwise its scores would use a different coordinate system. Keeping just the first score reduces this example from two features to one; keeping both preserves its centered coordinates.
Center with training means if needed. Dot the centered observation with each chosen principal direction, in order.
- Project centered observations into a chosen principal-component basis.
Further questions
Are scores the same as a reconstructed observation?
Sources & further reading
- [1]Cornell CS4780, Principal component analysis ↗Cornell CS4780 · Book
- [2]scikit-learn, Common pitfalls: inconsistent preprocessing and data leakage ↗scikit-learn · Book