Vismo · Create · Explore · Topics · Guides · Pricing

K-Means Clustering On A Number Line

Four points at 0, 2, 8, and 10 are clustered with K = 2 using the k-means algorithm. The animation alternates between assigning points to the nearest center and recomputing centers as cluster averages, starting from centers at 0 and 2 and converging to centers at 1 and 9 with total squared distance 4. It highlights how each step lowers the objective but may settle on a local rather than global optimum, and briefly notes how initialization, scaling, outliers, and choice of K affect results. Useful for first-year AI students learning unsupervised clustering.

Narrated · 16:9 · Preview before teaching · automatic layout checks do not establish subject accuracy

The prompt that made it

# K-means alternates between assigning points and moving centers Four fixed points appear on a number line at 0, 2, 8, and 10. Set K = 2 and initialize the centers at 0 and 2. Assign each point to its nearest center: the first cluster contains 0, while the second contains 2, 8, and 10. Move the centers to 0 and 20/3. Reassign the points to form {0,2} and {8,10}, then move the centers to 1 and 9. The final within-cluster squared-distance sum is 4. Keep sample positions fixed while colors and centers change. Connect each step to minimizing the squared-distance objective, and explain why improvement does not guarantee a global optimum. Briefly show how initialization, scaling, outliers, and the choice of K can alter results. Use a black background, cyan and orange clusters, and clearly labeled center markers. Useful for visualizing alternating optimization. Audience: 一年级人工智能专业学生

Make your own version

Make the next one in this series