Compute the k-means inertia: the total squared Euclidean distance between each point and the centroid of the cluster it is assigned to.
Implement solve(X,C,labels).
Returns. Return a non-negative float. labels[i] is the index of the centroid assigned to X[i].
Example 1
Input:
solve([[0.0, 0.0], [2.0, 0.0], [10.0, 10.0]], [[1.0, 0.0], [10.0, 10.0]], [0, 0, 1])
Output:
2.0
Example 2
Input:
solve([[1.0, 1.0]], [[1.0, 1.0]], [0])
Output:
0.0
No results yet
Run your code to check it against the examples, or submit to run every test.