DataPredict

API Reference - Models - KNearestNeighbours (KNN)

LinearRegression is a supervised machine learning model that predicts continuous values (e.g. 1.2, -32, 90, -1.2 and etc. ). It uses iterative calculations to find the best model parameters.

Stored Model Parameters

Contains a table of matrices.

Constructors

new()

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

KNearestNeighbours.new(kValue: integer, distanceFunction: string): 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.

KNearestNeighbours:setParameters(kValue: integer, distanceFunction: string)

Parameters:

train()

Train the model.

KNearestNeighbours:train(featureMatrix: Matrix, labelVector: Matrix): number[]

Parameters:

Returns:

predict()

Predict the values for given data.

KNearestNeighbours:predict(featureMatrix: Matrix, returnOriginalOutput: boolean): Matrix, Matrix -OR- Matrix

Parameters

Returns:

-OR-

Inherited From