Gladni blokovi
AI FOR VET • MODULE 5
Discovering Hidden Patterns: K-Means Clustering
Grouping unlabeled telemetry without human supervision.
🎯 Learning Outcomes / Ishodi učenja:
- Understand centroid initialization and Euclidean distance assignment.
- Step through the iterative assign-update convergence loop.
- Observe cluster inertia (Within-Cluster Sum of Squares) diminishing.
- Identify under-clustering (K too small) vs over-clustering (K too large).
In unsupervised learning, data points have no labels. K-Means finds K cluster centers (centroids) by alternating between: 1) assigning points to the nearest centroid, and 2) recomputing centroids as the average of assigned points.
Inertia = ∑ min ||x_i − μ_j||²
Convergence occurs when centroids no longer move between iterations.
🔬 Interactive Laboratory / Interaktivna laboratorija:
🔍 Guided Investigation / Istraživački zadatak:
- Step-by-step loop: Click Step repeatedly and watch centroids jump to cluster centers.
- Wrong K: Select K = 2 on a 3-cluster dataset. Notice how two clusters are forced together.
- Random restarts: Click Reset with different seeds to see if initialization affects final groups.