Skip to content
Reference > Prepare Methods



Comparable kmeansCluster(Integer nClusters, Long seed, Object ... values)


Clusters data using the k-means clustering algorithm. Takes one or more expressions, followed by int nClusters specifying the number of clusters and long seed specifying the random seed for initializing the model parameters. The seed argument may be set to null if no specific seed is desired. Returns a column of integers labeling each record according to its learned cluster. Input expressions must evaluate to numbers.

Parameter Definition

Name Type Description
nClusters Integer
seed Long
values Object...