ott.tools.k_means.KMeansOutput

Contents

ott.tools.k_means.KMeansOutput#

class ott.tools.k_means.KMeansOutput(centroids, assignment, converged, iteration, error, inner_errors)[source]#

Output of the k_means() algorithm.

Parameters:
  • centroids (Array) – Array of shape [k, ndim] containing the centroids.

  • assignment (Array) – Array of shape [n,] containing the labels.

  • converged (bool) – Whether the algorithm has converged.

  • iteration (int) – The number of iterations run.

  • error (float) – (Weighted) sum of squared distances from each point to its closest center.

  • inner_errors (Array | None) – Array of shape [max_iterations,] containing the error at every iteration.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Attributes

assignment

Alias for field number 1

centroids

Alias for field number 0

converged

Alias for field number 2

error

Alias for field number 4

inner_errors

Alias for field number 5

iteration

Alias for field number 3