DataPredict

API Reference - Models - KMeans

KMeans is an unsupervised machine learning model that predicts which cluster that the input belongs to using distance.

Stored Model Parameters

Contains a matrix.

Constructors

new()

Create new model object. If any of the arguments are nil, default argument values for that argument will be used.

KMeans.new(maximumNumberOfIterations: integer, numberOfClusters: integer, distanceFunction: string, setInitialClustersOnDataPoints: boolean, setTheCentroidsDistanceFarthest: boolean): ModelObject

Parameters:

Returns:

Functions

setParameters()

Set model’s parameters. When any of the arguments are nil, previous argument values for that argument will be used.

KMeans:setParameters(maximumNumberOfIterations: integer, numberOfClusters: integer, distanceFunction: string, setInitialClustersOnDataPoints: boolean, setTheCentroidsDistanceFarthest: boolean)

Parameters:

train()

Train the model.

KMeans:train(featureMatrix: Matrix)

Parameters:

Returns:

predict()

Predict which clusters does it belong to for a given data.

KMeans:predict(featureMatrix: Matrix): integer, number

Parameters:

Returns: