Page 1 of 8~112 min topic

Clustering

Frame the two-cluster segmenter experiment

Page 1 sets a falsifiable claim for the two-cluster customer segmenter before any implementation work begins.

~14 min this pageExperiment briefReviewed 2026-08-08

1Try it yourself

Playground

Cluster playground

Cluster the points, then assign meaning. Don’t mistake a grouping for ground truth.

2Learn the idea

Read

Name the deliverable and claim

Success is not “I followed the tutorial.” Success is producing evidence that: k=2 assignments are stable for the fixture and cluster centers are printable. The accepted input is narrow on purpose: 2D numeric customer features and chosen k. That narrowness is what lets you inspect every field and prevents a toy demo from being narrated as a production system.

Record the baseline you must beat: random two-group assignment inertia for comparison. If the finished artifact cannot beat that baseline on the fixture below, stop and revise the claim before writing more code.

Read

Inventory the fixture

points=[(2,18),(3,20),(4,22),(12,75),(13,78),(15,82)]
print(len(points), min(x for x,_ in points), max(y for _,y in points))

Expected evidence: unstable or misleading clusters. Treat the printout as a claim about this fixture, not as proof that the toolchain merely started.

Read

Spot misleading success early

For the two-cluster customer segmenter, a decorative win often looks like a clean run that never checks silhouette or inertia recorded; centers have finite values. Write the metric down now so later pages cannot redefine success after the fact. Also note the operational threat you will eventually gate on: joining cluster IDs back to raw emails in an unsecured export.

Read

Lab notebook: claim before code

For clustering-basics, write the claim on a sticky note in this exact shape: “Given 2D numeric customer features and chosen k, the two-cluster segmenter will …”. Fill the ellipsis with the observable part of: k=2 assignments are stable for the fixture and cluster centers are printable. Tape the baseline beside it: random two-group assignment inertia for comparison. If someone later replaces your metric with a vibe check, the sticky note is how you push back.

Also sketch the one-sentence user story: a person uses this output to group customers by spend/visits without pretending clusters are ground-truth labels. If that sentence needs a dashboard, a model zoo, or five services, the lab scope is too wide—shrink the fixture (small 2D customer matrix) until the story fits on one screen.

Read

Worked judgment

Decide now whether live network calls are allowed on page 1. For this lab they usually are not; inventory and contracts should run offline against small 2D customer matrix. Note the metric you will eventually require (silhouette or inertia recorded; centers have finite values) so page 4 cannot invent a softer target. The characteristic failure to keep in mind is k larger than n, or scaling skipped so one feature dominates.

Read

Why this stage matters for the two-cluster segmenter

At the experiment brief stage for clustering-basics, the job is narrower than finishing a product demo. You are creating one progressive evidence piece about small 2D customer matrix that later pages inherit without redefining success. Keep that fixture small enough to inspect by hand, keep outputs copy-pasteable as text, and refuse to narrate this baseline as if it were a production SLA: random two-group assignment inertia for comparison.

For this page specifically, success looks like a falsifiable claim and baseline written before coding while still centering the user decision to group customers by spend/visits without pretending clusters are ground-truth labels. If you cannot point to a file, command, or assertion that proves that for the two-cluster segmenter, stay on this page instead of advancing.

Glossary: clustering · Cheatsheet: ML Python starter

Next

Go deeper

Before you start

Why this matters

On paper, write the user decision this lab supports: group customers by spend/visits without pretending clusters are ground-truth labels. Then write one sentence naming what could look successful while actually being wrong for this claim—focus on k larger than n, or scaling skipped so one feature dominates. Keep both sentences beside the fixture inventory you run next.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. What exact claim can this fixture disprove?
2. Which baseline prevents a decorative success story?
3. What result would make you stop before implementation?
4. Did you name the metric (silhouette or inertia recorded) up front?

All responses are required.