Skip to content
Reference > Prepare Methods

kmeansCluster(nClusters,seed,values)

Definition

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

Description

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 the number of clusters
seed Long the seed for initializing the model parameters, can be null
values Object... the array of all the numerical columns to evaluate