What to notice & try
What to notice
- The PCA tabs build on each other: The Dataset (why six scores are redundant) → Step-by-Step (what a component is, on two subjects) → PCA 2D Projection (all six, with their loadings) → Scree Plot (how many to keep) → Reconstruction & Loss (what the rest costs).
- Parallel Coordinates › Student Data shows the same 60 students as the PCA tabs; RadViz and Parallel Coordinates › Car Data show the same 110 cars — so you can compare the encodings on identical data.
- Standardizing (z-score) and min–max normalizing are introduced in Lecture 2 › Distribution. This lecture's six scores all share one 0–100 scale, so its PCA runs on the raw scores. To see what an unscaled column does, turn on Shared raw scale in Parallel Coordinates › Car Data, or set MATH_SCALE = 10 in the code of PCA 2D Projection.
- The group and price-tier colors follow Lecture 4: each trio stays distinguishable under every type of color-vision deficiency, and the PCA scatters add a marker shape per group — the redundant encoding of Lecture 3 › Shape › Appropriate Shapes.
Try this
- Open PCA › Step-by-Step and move the Step slider from 1 to 5, reading 'This step, explained' at each step.
- Open Scree Plot and see how much variance the 3rd, 4th, ... component would add before deciding '2 is enough.'
- Open RadViz and Parallel Coordinates › Car Data — the same 110 cars in two encodings: in RadViz the order decides whether the price tiers separate, in parallel coordinates which pairs of features you can compare.
What to notice & try
What to notice
- The subjects move in two blocks: Math, Physics and Chemistry rise and fall together (correlation 0.85–0.90 between any two of them), and so do Literature, History and Art (0.80–0.83).
- Six columns that move in two blocks carry far less than six columns' worth of information — that redundancy is exactly what PCA uses.
- The right panel is to scale: with 2 components each student is 2 numbers instead of 6, and 90.5% of the variance is still there.
Try this
- Move Components to keep from 1 to 6 and watch the kept variance: 63.4%, 90.5%, then only small steps up to 100%.
- In the code, set SUBJECTS = ['math', 'physics', 'chemistry'], Run, and set Components to keep to 1: three columns that move together — 1 component already keeps 92.2% of them.
What to notice & try
What to notice
- Math and Literature correlate −0.37, and PC1 holds 69% of their spread: keep only each student's position along PC1 and you keep 69% of how much the students differ in these two subjects. With no correlation at all it would hold only 56% — just Math's larger spread; the stronger the correlation, the more the cloud stretches along one direction.
- The thin red lines in step ④ are what PC1 makes as short as possible (the sum of their squares). The same direction makes the spread along it as large as possible — two views of one line.
Try this
- Move the Step slider from 1 to 5 and read 'This step, explained' at each step.
- Turn off Color by group: PC1 doesn't move — PCA never uses the groups.
- In the code, set Y_SUBJECT = 'physics' and Run: Math and Physics rise together (r = 0.89), so PC1 jumps to 94% and runs along the diagonal.
What to notice & try
What to notice
- PC1 (63.4%) is a contrast — Math, Physics and Chemistry push a student right, Literature, History and Art push left — and the groups line up along it: Humanities around −24, Balanced +3, STEM +21.
- They separate only because the difference between the groups is the biggest source of spread in this data. PCA looks for spread, not for groups — had the groups differed along a small-variance direction, PC1 would mix them.
- PC2 (27.2%) has all six loadings positive, so it is the overall level — it correlates 0.94 with a student's average score. It spreads students within each group but barely separates the groups.
- Show loadings: PC1's loadings are Math 0.53, Physics 0.49, Chemistry 0.45, Literature −0.33, History −0.28, Art −0.29; PC2's are all positive, 0.28–0.55. Arrows pointing the same way share one label.
Try this
- Set Components to keep to 1: Humanities still stands apart, but Balanced and STEM share PC1 values from about 9 to 20.
- Set it to 3: PC3 adds only 2.9%, and none of the new panels separates the groups any better.
- Turn off Color by group: this is all PCA had. Would you still have found three groups?
- In the code, set MATH_SCALE = 10 and Run with Show loadings on: the students are the same, but PC1 (98.0%) is now Math alone — its arrow runs along PC1, the axis label says only 'more Math'. The arts block is still there as PC2 (see its arrows), but next to the inflated Math it shrinks to 1.4% of the variance, and its axis label calls it 'little spread' — though the axis is as wide as before. PCA follows the biggest numbers, which is why columns on different scales get standardized first.
What to notice & try
What to notice
- The bars fall from 63.4% and 27.2% to 2.9% at PC3, then stay flat — that bend is the 'elbow', so here the two components before it are worth keeping. PC3–PC6 together hold only 9.5%, each under 3%.
- Two big components are no accident: the subjects come in two blocks that move together (see The Dataset), and each block is close to a single number. (PCA mixes the two blocks into a contrast and a sum — see PCA 2D Projection.)
- The orange line is the running total: 63.4% with 1 component, 90.5% with 2, 93.5% with 3. A common rule of thumb is to reach 80–90%.
Try this
- Move the slider from 2 to 3: a whole extra number per student buys only 2.9% more variance.
- In the code, set TARGET = 95 and Run: the title now asks for 4 components instead of 2; with 60 it asks for 1. With a threshold rule, the threshold you pick decides k as much as the data does — the elbow doesn't move.
What to notice & try
What to notice
- With 2 components the middle panel is a smoothed copy of the left: every student keeps their group's profile, and the individual quirks that are evened out show up in the Lost panel.
- Error view: with 2 components each score is off by 2.4 points on average (2.0–2.7 per subject), though a single score can be off by up to 9.3 — student #56's Chemistry, not among the 21 in the heatmaps.
- With 1 component the arts lose most — Literature 6.5, Art 5.4, History 5.1 points on average, against 3.7–4.3 for the sciences.
Try this
- Turn on Error view and step from 1 to 6: the average error halves from 1 to 2 components (4.8 → 2.4 points), then shrinks slowly to 0 at 6.
- Set Components to keep to 6: Original and Reconstructed become identical and Lost turns uniform gray (0 everywhere) — 6 components are just the same data in rotated axes.
- In the code, set MY_STUDENT to the arts student with Math 95 from the comment and Run: with 2 components their Math cell in Lost runs off the ±17 scale (Error view: at most 24.5 points), because no shared pattern says 'arts plus Math'. Then try 3: one unusual student is enough to bend PC3 toward them — the Math spike is back and the cell turns pale.
What to notice & try
What to notice
- Tight cluster near an arc → the features on that arc are high for that group compared with its other features: in ② High-price cars sit by Cylinders–Horsepower–Engine Size, Low-price ones by Passengers and City MPG.
- A point near the center only means its pulls roughly cancel — every feature high, every feature low, or features that rise together facing each other, as in ③ (cylinders ↔ engine size, City MPG ↔ passengers, weight ↔ horsepower).
- In ① a black arrow is a spring stiffer than an equal share (1/6 of the total), a gray one weaker: the example car is pulled mostly by Cylinders, Horsepower, Engine Size and Weight.
Try this
- In the code, set every value in EXAMPLE_CAR to 0.9 and Run, then every value to 0.1: the red dot lands in the exact center both times — a top car and a bottom car look the same.
- Open RadViz › RadViz: its ① is the order of ② here, its ④ the order of ③ — then compare the two orders in between.
What to notice & try
What to notice
- ① puts Cylinders, Horsepower and Engine Size on one arc, City MPG and Passengers on the other: each tier is pulled toward its own arc. ② is ① turned half a turn and scores the same 1.89 — what counts is which anchors are neighbors or opposite, not where the circle starts.
- ③ puts Horsepower between City MPG and Passengers: its pull drags High cars toward Medium (0.49 → 0.18 apart). It also moves Low cars toward the Horsepower anchor — the one they now sit closest to — though they have the least horsepower: position shows the balance of pulls, not the values.
- In ④ every opposite pair is two features that rise together, so all tiers land in the middle (score 0.26).
- Four features rise with price, and only three opposite pairs exist — so every order puts two of them face to face. ① does it with Engine Size ↔ Weight (r = 0.71) and still separates the tiers well.
Try this
- Turn off Color by price tier: would you still find three clumps in ①? In ④?
- In the code, swap 'horsepower' and 'engine_size' in ①'s order and Run: the score rises from 1.89 to 1.96 — the best any of the 120 possible orders reaches here. ① was good, not the best.
What to notice & try
What to notice
- Between two neighboring axes, parallel lines mean a positive correlation (②) and lines crossing in an X a negative one (③).
- In ① the STEM lines run high on the sciences and low on the arts, the Humanities lines the other way round — so between Chemistry and Literature the two bundles swap places.
- Only NEIGHBORING axes show their relationship: in ① Math sits next to Physics, so you can read that pair — but Math and Art have four axes between them, so ① can't show directly how they relate.
- Each axis runs from its own lowest to its own highest score (the numbers at its ends) — min–max normalizing, as in Lecture 2 › Distribution. So a line's height compares a student with the others on that subject, not one subject with another.
Try this
- In the code, set MY_STUDENT = 44 and Run: this student scored 71 in Chemistry and 73 in Literature, yet the black line runs downhill between the two axes — each axis runs from its own lowest to its own highest score (Chemistry 42–80, Literature 47–89).
- Open Student Data and switch Axis order to Interleaved: the one crossing between Chemistry and Literature becomes five, and the strong Math–Physics link is no longer visible.
- Open Student Data and, in its code, set FLIPPED = ['literature', 'history', 'art']: the big X between Chemistry and Literature turns into parallel lines. An X means 'negative' only while both axes point up.
What to notice & try
What to notice
- Default: the lines run roughly parallel within Math–Physics–Chemistry and within Literature–History–Art, and cross in one big X between Chemistry and Literature.
- Interleaved puts a science next to an art everywhere: five crossings — and Math–Physics (r = 0.89) can no longer be read line by line, because the two axes aren't neighbors anymore. Only the group averages still hint at it.
- The X is made by the groups, not by each student: overall Chemistry and Literature correlate −0.32, but inside STEM +0.71 and inside Humanities +0.82. A correlation across groups can differ from the one within each group.
Try this
- In Interleaved, turn off Color by group: can you still tell that Math and Physics rise together?
- Pick Arts → sciences (blocks swapped): Art and Math become neighbors — the pair How It Works couldn't show — and they cross (r = −0.35). Chemistry and Literature, the X of Default, are no longer neighbors.
- In the code, set MY_ORDER to the default order reversed (the list in the comment) and Run: the picture is mirrored left to right, but every subject keeps its neighbors — so it shows exactly the same relationships as Default.
What to notice & try
What to notice
- Default: Engine Size sits next to City MPG and the lines cross in one big X (r = −0.87) — powerful cars burn more fuel.
- Power features adjacent moves City MPG to the end, next to Passengers only. That X is gone — the cars didn't change, City MPG just has no power feature as a neighbor anymore. In exchange Engine Size now meets Weight, and the lines mostly rise together (r = 0.71) — though Medium cars are nearly as heavy as High ones.
- Interleaved alternates power and non-power axes: four of the five gaps cross. The fifth, Engine Size → Weight, runs mostly parallel because weight rises with power too.
- Shared raw scale puts all six axes on one scale, 1.5 to 4157. Weight (1797–4157) fills the upper half and the other five, all under 472, flatten into one line at the bottom. Unscaled PCA does the same: on these raw columns Weight alone takes 98.8% of the variance — standardize first (Lecture 2 › Distribution).
Try this
- Compare Default with Power features adjacent: which relationship did the reorder hide, and which did it reveal?
- In Power features adjacent, turn off Color by price tier: can you still tell that powerful cars have low City MPG?
- Turn on Shared raw scale: which features can you still read at all?
- In the code, set MY_ORDER to the order in the comment (City MPG right after Weight) and Run: a new X appears between Weight and City MPG (r = −0.83) — heavy cars burn more fuel.
No parameters for this demo.
The right-hand block is to scale: k components = k columns instead of 6.
Steps not reached yet stay grayed out.
Color is for you only — PCA never uses the groups.
Each pair of kept components gets a panel (the first 4 at most); the title adds up what is kept and lost.
The groups were assigned when the data was generated — PCA never sees them.
In the PC1 × PC2 panel, one arrow per subject: how strongly it pushes a student along each axis.
Smaller dots show where the groups overlap.
Gray bars are the variance you throw away; the title adds them up.
Only the kept bars take this color.
The running total answers 'how much do I keep with k components?'
6 components reconstruct the data exactly — anything less throws something away.
Heatmaps: 21 students cell by cell. Error view: the average miss per subject over all 60.
No parameters for this demo.
+ marks each tier's centroid — the score measures how far apart they are. Centroids almost on top of each other stay unnamed.
Smaller dots show the overlap in ③ and ④.
No parameters for this demo.
Each order makes a different set of subjects neighbors.
The thick lines are each group's average student.
Lower it when the lines pile up, so dense bundles show through.
Power = Cylinders, Horsepower, Engine Size — Weight rises with them too (r ≈ 0.7).
All axes on one raw scale instead of each on its own min–max: the feature with the biggest numbers swallows the rest.
The thick lines are each tier's average car.
Lower it when the lines pile up, so dense bundles show through.