svm.NuSVR

Nu Support Vector Regression. Similar to NuSVC, for regression, uses a parameter nu to control the number of support vectors. However, unlike NuSVC, where nu replaces C, here nu replaces the parameter epsilon of epsilon-SVR.

The implementation is based on libsvm.

Note: This API is not available on the browsers

Usage

import { NuSVR } from 'machinelearn/svm';

const svm = new NuSVR();
svm.loadASM().then((loadedSVM) => {
  loadedSVM.fit([[0, 0], [1, 1]], [0, 1]);
  loadedSVM.predict([[1, 1]]);   // [0.9000000057898799]
});

Constructors

Methods

Constructors


constructor

new NuSVR(options: `object`)

Defined in svm/classes.ts:317

Parameters:

ParamTypeDefaultDescription
options.cacheSizenumberCache size in MB
options.coef0numbercoef0 parameter for Polynomial and Sigmoid kernels
options.costnumberCost parameter, for C SVC, Epsilon SVR and NU SVR
options.degreenumberDegree of polynomial, test for polynomial kernel
options.epsilonnumberFor epsilon SVR
options.gammaGamma parameter of the RBF, Polynomial and Sigmoid kernels. Default value is 1/num_features
options.kernelstringType of Kernel
options.nunumberFor NU SVC and NU SVR
options.probabilityEstimatesbooleanweather to train SVC/SVR model for probability estimates,
options.quietbooleanPrint info during training if false (aka verbose)
options.shrinkingbooleanUse shrinking euristics (faster)
options.tolerancenumberTolerance
options.typestringType of SVM
options.weightSet weight for each possible class

Returns: NuSVR

Methods


λ fit

Fit the model according to the given training data.

Defined in svm/classes.ts:127

Parameters:

ParamTypeDefaultDescription
Xnumber[][]
ynumber[]

Returns:

void

λ fromJSON

Restores the model from a JSON checkpoint

Defined in svm/classes.ts:171

Parameters:

ParamTypeDefaultDescription
options.optionsanynull
options.svmanynull

Returns:

void

λ loadASM

Loads a ASM version of SVM. The method returns the instance of itself as a promise result.

Defined in svm/classes.ts:114

Returns:

🤘 Promise<self>

λ loadWASM

Loads a WASM version of SVM. The method returns the instance of itself as a promise result.

Defined in svm/classes.ts:104

Returns:

🤘 Promise<self>

λ predict

Predict using the linear model

Defined in svm/classes.ts:140

Parameters:

ParamTypeDefaultDescription
Xnumber[][]

Returns:

number[]

λ predictOne

Predict the label of one sample.

Defined in svm/classes.ts:150

Parameters:

ParamTypeDefaultDescription
Xnumber[]

Returns:

number

λ toJSON

Saves the current SVM as a JSON object

Defined in svm/classes.ts:159

Returns:

ParamTypeDescription