AI Grounds
Open AI Grounds on a desktop
These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.
AI Grounds
These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.
Guided discovery
Assign members. Then move their centroids.
Six authored points and two centroids, or group centers, share X/Y axes 0–100. Choose an object and edit its coordinates. Assign points chooses nearest centers by squared Euclidean distance, (X−center X)²+(Y−center Y)². Exact computed ties go to C1. Update centroids moves only the centers to their held members’ coordinate means.
Circles are data points; diamonds are centers. Indigo indicates held C1, orange C2 and gray unassigned. IDs, shapes and tables accompany color. Coincident marks can overlap. Labels use separate positions and leader lines; the exact tables retain every object. The selected object has a navy outline.
Edit P3's X value. Actual edits clear all assignments and restart at Ready. Means retain full precision; no coordinate grid is imposed. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.
Edit P3's Y value. Actual edits clear all assignments and restart at Ready. Means retain full precision; no coordinate grid is imposed. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.
Assign changes members without moving coordinates. Update changes centers without reassigning members. Assign again before the next Update. Empty centers keep their previous location.
Ready · Not assigned · 0 updates · C1=(10,20) · C2=(90,80)
Coordinate edits clear stale explanations and transfer answers. Object inspection, unchanged exact edits and an unchanged Assign preserve them. Changing scenario restores its coordinates and unassigned state. The display rounds to six decimals; operations use full precision. Clusters have no known class labels.
Press Assign points first.
Unassigned
Current center: (10, 20)
Held from the last Assign points; Update does not reassign.
Press Assign points first.
Unassigned
Current center: (90, 80)
Held from the last Assign points; Update does not reassign.
Sum of squared distances to each point's held assigned center.
Not assigned
Σ (X − center X)² + (Y − center Y)²
Squared coordinate units. Not class accuracy or a global-optimum certificate.
| ID | X | Y | d² to C1 | d² to C2 | Current tie? | Held group | SSE term |
|---|---|---|---|---|---|---|---|
| P1 | 20 | 20 | 100 | 8500 | No | Unassigned | Not assigned |
| P2 | 20 | 40 | 500 | 6500 | No | Unassigned | Not assigned |
| P3 | 40 | 30 | 1000 | 5000 | No | Unassigned | Not assigned |
| P4 | 70 | 60 | 5200 | 800 | No | Unassigned | Not assigned |
| P5 | 80 | 80 | 8500 | 100 | No | Unassigned | Not assigned |
| P6 | 90 | 70 | 8900 | 100 | No | Unassigned | Not assigned |
SSE is not defined until points have assignments.
| Center | Current X | Current Y | Count | Σ X | Σ Y | Mean X | Mean Y | Group SSE |
|---|---|---|---|---|---|---|---|---|
| C1 | 10 | 20 | Unassigned | Not assigned | Not assigned | Not assigned | Not assigned | Not assigned |
| C2 | 90 | 80 | Unassigned | Not assigned | Not assigned | Not assigned | Not assigned | Not assigned |
C1: no assigned group yet.
C2: no assigned group yet.
This is a hand-authored, six-point, two-center Lloyd demonstration. Coordinates are finite values within 0–100; fractional coordinate means are not rounded onto a grid or snapped to observed points. The display rounds to six decimals. Squared distances, means, ties and subsequent operations use JavaScript full-precision arithmetic. Exact equality of computed distances uses a fixed C1 tie rule.
For a fixed dataset, Assign picks a nearest center and Update minimizes each nonempty held group’s squared-distance sum by using its coordinate means. Either action cannot increase SSE apart from floating-point roundoff. Empty centers stay where they were; other algorithms/libraries can choose a different policy. Updating changes current distance ties without retroactively changing the last assignment. Another Assign may give an empty center members.
Initialization can change a local result; swapping center IDs merely renames equivalent groups. Stable assignments or centers do not guarantee a globally best clustering. No known classes, supervised accuracy, probability, learned embedding, choice of K, scaling study, automatic iterations or recommended seed strategy is supplied. Edits change the dataset/centers and restart assignment; monotonic SSE is not claimed across manual edits. Reset/prediction restores Separated seeds for the current experiment; free Reset restarts Experiment 1.
Stanford · K-Means assignment, mean update and local optima