AIQ AIQ
Finding Patterns · Lesson 3.1.2

Teaching "Finding Patterns" to Hacker mode (ages 11–14)

Part of the Finding Patterns lesson guide. Teaching a different grade? 🌈 Explorer (5–7) · 🔧 Builder (8–10) · ⚡ Architect (15–18)

Hook & Warm-Up

Plot 12–15 dots on the board or a shared screen — random x/y positions, no labels, ideally forming two or three loose visual clumps if you space them by hand. Ask: "If I told you to split these into 3 groups, could you do it without me telling you the rule?"

"What if AI has no labels to learn from? It finds hidden groups and patterns on its own. 🔍 Let's explore unsupervised learning — how AI discovers structure without help."

Let a student come up and circle three groups on the dot plot. Ask them to explain their reasoning out loud — almost certainly "these ones are close together." Point out: "You just did, by eye, the same basic thing an algorithm called K-means does automatically, and does with thousands of points across dozens of measurements at once, not just x and y on a whiteboard."

Open the app and read the hook screen's icons — 🔮 Discover, 🗂️ Sort, 🔍 Patterns, 🧩 Groups — then move into the scenes.

Frame the contrast with the previous lesson directly: "In 'Learning from Examples,' every single training example had a correct label — cat or dog, spam or not. Today, imagine handing the AI a thousand rows of data with zero labels and telling it, 'go find something.' What could it possibly do with that?" Let a couple of guesses land before opening the app — most classes will land close to "group similar things" on their own, which is a good sign the core idea is intuitive even before it's named.

Main Activity

Work through the three scenes, but treat Scene 3 as the technical core of the lesson — spend the most time there, since two of the four quiz questions come straight from it.

Scene 1: Grouping Things 🗂️ (Applications of Clustering)

Read the four facts as real-world grounding, not just trivia: clustering 1,000 unlabeled customer profiles into behavioral groups (Amazon's "budget buyers" / "tech enthusiasts" / "gift shoppers"), clustering pixels by color to find a photo's dominant palette, and clustering millions of stars to surface new patterns in astronomical surveys. Ask: "What do all four of these have in common?" Push toward the answer that in every case, there was no pre-existing category to sort into — the categories themselves are the output of the algorithm, not the input.

Push one step further: "In every one of these examples, who decided what the group NAMES mean — 'budget buyers,' the dominant colors, a new star pattern?" The answer is always a human, looking at what actually ended up inside each cluster after the algorithm ran. The AI's contribution is finding that a boundary between groups exists in the data; interpreting and naming what's on each side of that boundary is still a human judgment call, at every level of this lesson.

Scene 2: Finding Hidden Patterns 🔍

Cover music genre clustering (grouping songs by audio similarity without genre labels) and gene pattern discovery (grouping similar genes to find disease links) briefly, then spend real time on fraud detection, since it's the clearest example of clustering used for anomaly detection rather than just grouping: "The AI builds up a model of what a normal transaction pattern looks like for an account. A new transaction that falls far outside that pattern — a distance measure again — gets flagged, not because the AI 'knows' it's fraud, but because it's an outlier relative to everything the model has seen for that account." Ask: "What's a downside of a system that flags anything unusual, rather than anything definitely fraudulent?" (False positives — a legitimate purchase that's just unusual, like buying a plane ticket for the first time, can get flagged too.) Extend the discussion briefly: this same false-positive trade-off shows up in any anomaly-detection system, not just banking — a factory sensor flagging unusual machine vibrations, or a network security tool flagging unusual login activity, all face the identical problem of separating "genuinely different" from "actually dangerous."

Scene 3: How Clustering Works 🧩 (K-means Mechanics)

Walk through K-means as an actual algorithm, using the dot plot from the hook:

  1. Pick K — decide how many clusters to look for (a human choice, not something the algorithm figures out for you).
  2. Place initial centroids — drop K starting "center" points, often just randomly chosen data points to begin with.
  3. Assign — every data point joins whichever centroid is nearest to it (measured as distance, exactly like the app's "measure distance" fact).
  4. Update — recompute each centroid as the average (mean) position of all points currently assigned to it — this is the "means" in K-means.
  5. Repeat steps 3–4 until the assignments stop changing — the algorithm has converged.

If you have time, run this by hand on the board with the dot plot: pick K=3 starting points, have students shout out which centroid each remaining dot is closest to, then recompute the average position of each group and repeat once. It usually takes 2–3 rounds to visibly stabilize.

Address a question sharp students often ask: "How does the algorithm know when to stop?" It stops once an update round produces no change in which points belong to which cluster — the centroids have settled into a stable position and further rounds would just repeat the same assignment. This is what "converged" means, and it's worth naming explicitly since the word shows up again in later, more advanced machine learning contexts students may encounter.

Then cover the "no right answer" idea directly: unlike the labeled classification from the previous lesson, there's no ground truth to check K-means against — a different starting guess for the centroids, or a different choice of K, can produce a different (and sometimes equally valid) grouping. This is exactly why the elbow method exists (tested in the quiz): plot how tightly the clusters fit together for K=2, K=3, K=4, and so on, and look for the point where adding another cluster stops improving the fit much — that "elbow" in the graph is a reasonable K to pick.

Close by reading the app's own summary together: "K-means groups data by finding cluster centers. PCA reduces complex data to its most important features. Autoencoders learn to compress and rebuild data. All of these find hidden structure without labels." Since PCA and autoencoders appear in the summary and quiz but not in the learn scenes above, take two minutes to introduce them directly: PCA takes data with many measurements per item and re-describes it using far fewer numbers, keeping the directions that capture the most variation and dropping the rest. An autoencoder is a neural network trained to squeeze its input through a narrow middle layer and then rebuild the original from that squeeze — if it can rebuild the input well, the narrow middle layer must have learned a genuinely useful compressed summary of it.

Give students one concrete mental image for each: PCA is like taking a photo of a 3D object from its single most informative angle instead of keeping every possible angle — you lose some information, but you keep most of what actually distinguishes the object. An autoencoder is like asking someone to describe a detailed picture in one short sentence, then having someone else try to redraw the picture from just that sentence — if the redrawing comes out close to the original, the sentence captured the picture's important features well.

Discussion

Quiz Walkthrough

K-means clustering iteratively...
Assigns points to nearest centroids, then updates centroids. That assign-then-update loop, repeated until it stabilizes, is the entire algorithm — it doesn't sort alphabetically or delete outliers, and "counts data points" undersells what's actually happening. If a student picks "counts data points," it's worth pointing out that counting is something K-means might do as a side effect (points per cluster), but it's not the mechanism doing the actual grouping.
PCA (Principal Component Analysis) reduces...
Dimensionality while preserving maximum variance. It re-describes data using fewer numbers per item, chosen specifically to keep as much of the data's real variation as possible — it's not primarily about training time, disk size, or the number of data points.
Autoencoders learn by...
Compressing input to a bottleneck then reconstructing it. The network is only graded on how well it rebuilds its own input — succeeding forces the narrow bottleneck layer to hold a genuinely useful compressed summary. It has nothing to do with passwords, sorting, or generating labels.
The 'elbow method' helps determine...
The optimal number of clusters K. You plot cluster fit against different values of K and look for the point (the "elbow") where adding more clusters stops helping much — it has nothing to do with processing speed, flexibility, or data quality.

Wrap-Up & Extension

Close with: "Every technique today — clustering, PCA, autoencoders — solves the same basic problem from a different angle: finding real structure in data when nobody hands you the answer key. That's most of the data companies actually have. Labeled data is expensive and rare; unlabeled data is everywhere." Tie it back to the earned badge: "Pattern Finder" is the right name for this lesson because every technique covered today, at its core, is a different strategy for finding structure without being told what to look for — which is exactly the mental habit worth practicing, independent of any specific algorithm's math.

Leave one honest caveat with the class: none of today's techniques actually understand what a cluster or a compressed feature represents. K-means doesn't know it grouped "budget buyers"; PCA doesn't know its top component roughly tracks "spending power." A human still looks at the output and supplies the meaning. That gap between "found structure" and "understood meaning" is exactly why a person, not the algorithm, remains responsible for how these results actually get used.

Extension activity (20 minutes): Have students run K-means by hand on paper. Give each pair a grid with 12 plotted points (you can generate this quickly by hand or print a simple scatter plot) and have them: (1) pick K=2 and place two starting centroids anywhere, (2) assign each point to its nearest centroid by eye, (3) recompute each centroid as the rough average position of its group, (4) repeat once more, and (5) compare their final clusters with another pair who started with different centroids. Ask whether both pairs landed on the same clusters — this is a hands-on way to surface that K-means results can depend on the random starting point, a real limitation of the algorithm worth knowing before using it on anything that matters.

← Lesson overview ← Learning from Examples (Hacker) Learning from Mistakes (Hacker) →