SupportVectorMachine is a supervised machine learning model that predicts values of -1 and 1 only.
Contains a matrix.
Create new model object. If any of the arguments are nil, default argument values for that argument will be used.
SupportVectorMachine.new(maximumNumberOfIterations: integer, cValue: number, kernelFunction: string, kernelParameters: table): ModelObject
maximumNumberOfIterations: How many times should the model needed to be trained.
learningRate: The speed at which the model learns. Recommended that the value is set between (0 to 1).
cValue: How strict should the model can classify the data correctly. Higher the cValue, the closer the data points to the decision boundary.
kernelFunction: The kernel function to be used to train the model. Available options are:
Linear
Polynomial
RadialBasisFunction
Sigmoid
Cosine
kernelParameters: A table containg the required parameters
Set model’s parameters. When any of the arguments are nil, previous argument values for that argument will be used.
SupportVectorMachine:setParameters(maximumNumberOfIterations: integer, cValue: number, kernelFunction: string, kernelParameters: table)
maximumNumberOfIterations: How many times should the model needed to be trained.
learningRate: The speed at which the model learns. Recommended that the value is set between (0 to 1).
cValue: How strict should the model can classify the data correctly. Higher the cValue, the closer the data points to the decision boundary.
kernelFunction: The kernel function to be used to train the model. Available options are:
Linear
Polynomial
RadialBasisFunction
Sigmoid
Cosine
kernelParameters: A table containg the required parameters
Set how hard the margin should be.
SupportVectorMachine:setCValue(cValue: number)
Train the model.
SupportVectorMachine:train(featureMatrix: Matrix, labelVector: Matrix): number[]
featureMatrix: Matrix containing all data.
labelVector: A (n x 1) matrix containing values related to featureMatrix.
Predict the values for given data.
SupportVectorMachine:predict(featureMatrix: Matrix, returnOriginalOutput): Matrix -OR- Matrix
-OR-