Fork me on GitHub

src/arraymancer/ml/clustering/kmeans

  Source Edit

Procs

proc kmeans[T: SomeFloat](x: Tensor[T]; centroids: Tensor[T]): Tensor[int] {.
    noinit.}
K-Means Clustering Inputs:

Returns:

  Source Edit
proc kmeans[T: SomeFloat](x: Tensor[T]; n_clusters = 10; tol: float = 0.0001;
                          n_init = 10; max_iters = 300; seed = 1000;
                          random = false): tuple[labels: Tensor[int],
    centroids: Tensor[T], inertia: T] {.noinit.}
K-Means Clustering Inputs:
  • x: A matrix of shape Nb of observations, Nb of features
  • n_clusters: The number of cluster centroids to compute
  • tol: early stopping criterion if centroids move less than this amount on an iteration
  • max_iters: maximum total passes over x before stopping
  • seed: random seed for reproducability

Returns:

  Source Edit
Arraymancer Technical reference Tutorial Spellbook (How-To's) Under the hood