pycvi.compute_scores.f_inertia

pycvi.compute_scores.f_inertia(cluster: numpy.ndarray, dist_kwargs: dict = {}, avg_kwargs: dict = {}) float

Inertia of a group of elements.

The inertia is defined as the sum of (squared) distances between the datapoints in the cluster and its centroid.

Parameters:
  • cluster (np.ndarray, shape (N, d) or (N, w, d) if)

  • ts_dist=True. – A cluster of size N.

  • dist_kwargs (dict, optional) – Keyword arguments for the distance function. See pycvi.dist.f_pdist() and pycvi.dist.f_cdist() for more information.

  • avg_kwargs (dict, optional) – Keyword arguments for the average function. See pycvi.cluster.compute_center() and func:pycvi.cluster.compute_centers for more information.

Returns:

The inertia of the cluster.

Return type:

float