Arena · Data Science · Coding · advanced

K-means from scratch

Implement kmeans(X, k, max_iters=100, random_seed=42) from scratch using only numpy. Return (labels, centroids). Handle the edge case where a centroid gets no assigned points.

Sign in to see what a strong answer covers and to get AI feedback on your own.

Practice this question on PrepGraph