KMeans.score

KMeans.score(data)[source]

Computes the average inertia of all the provided datapoints. That is, it computes the mean squared distance to each datapoint's closest centroid.

Parameters

data (Union[ndarray[Any, dtype[float32]], Tensor]) -- The data for which to compute the average inertia.

Return type

float

Returns

The average inertia.

Note

See score_samples() to obtain the inertia for individual sequences.