fit_a_nef.metrics.kmeans

fit_a_nef.metrics.kmeans(feats: ndarray, k: int, niter: int = 100, gpu: bool = False) Tuple[ndarray, ndarray]

Compute K-means clustering on the given features.

Parameters:
  • feats (np.ndarray) – Features to cluster. Shape (N, D).

  • k (int) – Number of clusters.

  • niter (int) – Number of iterations.

  • gpu (bool) – Whether to use GPU.

Returns:

Cluster centers and cluster assignments.

Return type:

(np.ndarray, np.ndarray)