Clustering and Segmentation
Project workbook ยท Path 72

Run a small deterministic k-means example, explain scaling and initialization, and document why clusters need interpretation.

The case

Six fictional service locations have two already standardized teaching coordinates. Start k-means with centers at A=(0,0) and D=(8,8). Use squared Euclidean distance, assign ties to cluster 1 and stop when assignments no longer change. Coordinates are abstract, not demographic attributes.

Pointxy
A00
B02
C20
D88
E810
F108
STAGE 1

Choose a meaningful representation

Distance reflects the chosen features and their scale. A large numerical range can dominate another feature even when it is not more relevant. Define what the coordinates represent and what was standardized. This synthetic case isolates the mechanics; real segmentation requires a defensible representation and attention to possible harms.

Your task

Write the feature and scaling contract and plot the six points.

Required output

Representation note

Record your result and evidence here or in a separate file.

Review gate

The note does not infer real customer traits from abstract coordinates.

If the gate is not met

Label interpretation separately from numerical input.

STAGE 2

Perform one assignment step

Assign each point to the nearest current center using the declared distance. Then recompute each center as the mean of its assigned points. Keep assignment and update as separate steps so the process is inspectable. Empty clusters require an explicit handling policy; this starting case does not produce one.

Your task

Calculate the first assignments and updated centers by hand.

Required output

Iteration table

Record your result and evidence here or in a separate file.

Review gate

A/B/C join cluster 1 and D/E/F cluster 2; centers become (2/3,2/3) and (26/3,26/3).

If the gate is not met

Square differences before summing and do not round centers prematurely.

STAGE 3

Implement a reproducible run

Fix initial centers and the tie rule for a deterministic exercise. Include a maximum iteration count to prevent accidental endless loops. Record the final assignments, centers and within-cluster sum of squares. A successful run on six points demonstrates the implementation, not the suitability of k-means for every dataset.

Your task

Run the supplied pure-Python reference and inspect its stopping rule.

Required output

Clustering run record

Record your result and evidence here or in a separate file.

Review gate

The final within-cluster sum of squares is 32/3, about 10.667.

If the gate is not met

Recompute distances to the final centers rather than the initial ones.

STAGE 4

Challenge the solution

A clustering result depends on k, initialization, scaling and geometry. Compact numerical groups do not necessarily answer the business question. Compare a one-cluster baseline and consider an outlier. State the limitations instead of using a visually neat split as proof that two natural categories exist.

Your task

Compare k=1 with k=2 and describe what an outlier could change.

Required output

Model-choice note

Record your result and evidence here or in a separate file.

Review gate

The note treats two clusters as a chosen model, not ground truth.

If the gate is not met

Add a task-based reason for using the grouping.

STAGE 5

Create an interpretable handoff

A handoff should preserve the feature definitions, algorithm choices and uncertainty about interpretation. Avoid assigning people consequential labels from a toy cluster result. Name groups neutrally until supported evidence justifies a more meaningful description. Keep the raw points and the run settings available for reproduction.

Your task

Write a short segmentation report using neutral cluster names.

Required output

Reproducible report

Record your result and evidence here or in a separate file.

Review gate

Every group statement can be traced to supplied coordinates.

If the gate is not met

Remove labels that imply unmeasured behavior or value.

Final project

Deliver the scatterplot, manual iteration, Python run, k comparison and interpretation note. Add a seventh point and document how the changed input affects the result.

Critical condition

Initialization, scale and distance are recorded and no cluster interpretation exceeds the synthetic evidence.

CriterionPointsEvidence
Evidence and correctness30Calculations, source use and results match the supplied case; limitations are honest.
Required artifacts30All five stage outputs and the capstone handoff are present and inspectable.
Reasoning and decisions20Choices, assumptions, alternatives and the case-specific critical condition are explained.
Reproducibility10A reviewer can follow the stated steps and distinguish expected from observed results.
Clear communication10Labels, units, structure and evidence references make the work easy to review.

Score at least 80/100, supply every required artifact, and satisfy the path-specific critical condition. Rework missing evidence before marking complete.

Worked reference

The first cluster center is (2/3,2/3); its squared-distance total is 16/3. The second is a translation of the same shape and also contributes 16/3, so total SSE is 32/3. A one-cluster center at (14/3,14/3) gives SSE 608/3.

Boundaries

This is a tiny deterministic demonstration, not validated customer segmentation or a production ML service.