package prbnmcn-clustering

  1. Overview
  2. Docs

Parameters

module E : Element

Signature

val k_means : k:int -> init:init -> elements:E.t array -> termination:termination -> Stdlib.Random.State.t -> E.t array array

k_means performs the clustering using to the provided initialization method.

val cost : classes:E.t array array -> float

cost returns the sum over all classes of the sum of squared distances from the mean of the class to all elements of the class. This quantity will decrease monotonically as k increases, and the usual method to determine k is to select the one where this quantity's decrease has its first inflection.