DataPredict

API Reference - Models - LinearRegression

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 matrix.

Constructors

new()

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

LinearRegression.new(maximumNumberOfIterations: integer, learningRate: number, lossFunction: 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.

LinearRegression:setParameters(maximumNumberOfIterations: integer, learningRate: number, lossFunction: string)

Parameters:

setOptimizer()

Set optimizer for the model by inputting the optimizer object.

LinearRegression:setOptimizer(Optimizer: OptimizerObject)

Parameters:

setRegularization()

Set a regularization for the model by inputting the optimizer object.

LinearRegression:setRegularization(Regularization: RegularizationObject)

Parameters:

train()

Train the model.

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

Parameters:

Returns:

predict()

Predict the values for given data.

LinearRegression:predict(featureMatrix: Matrix): number

Parameters:

Returns:

Inherited From