Instructions:
• Adjust the number of clusters (K) using the slider to see how it affects clustering
• Toggle "Enable Adding Data Points" and click anywhere on the plot to add new data points
• Drag centroids (solid circles) to manually position them and see how it affects clustering
• Use "Step Forward" to run one iteration of the k-means algorithm
• Click "Final Results" to run the algorithm until convergence
• "Reset Training" resets only the algorithm state (keeps current data points)
• "Generate New Data" creates a fresh set of 20 random data points
• Toggle "Show All Distance Lines" to always display all cluster connections, or leave unchecked to only show lines when hovering over centroids
Algorithm:
1. Initialize: Place K centroids randomly in the data space
2. Assign: Assign each point to the nearest centroid
3. Update: Move centroids to the center of their assigned points
4. Repeat: Steps 2-3 until centroids stop moving (convergence)
Visualization:
• Hollow circles: Data points, colored by cluster assignment
• Solid circles: Centroids, showing cluster centers
• Different colors represent different clusters
• Objective: Minimize within-cluster sum of squared distances