svm.SVC

C-Support Vector Classification. The implementation is based on libsvm. The fit time complexity is more than quadratic with the number of samples which makes it hard to scale to dataset with more than a couple of 10000 samples.

The multiclass support is handled according to a one-vs-one scheme.

For details on the precise mathematical formulation of the provided kernel functions and how gamma, coef0 and degree affect each other, see the corresponding section in the narrative documentation: Kernel functions.

Constructors

Methods

Constructors


constructor

new SVC(options: `object`)

Defined in svm/classes.ts:223

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.kernelKernelType 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.weightSet weight for each possible class

Returns: SVC

Methods


λ fit

Fit the model according to the given training data.

Defined in svm/classes.ts:101

Parameters:

ParamTypeDefaultDescription
Xnumber[][]
ynumber[]

Returns:

🤘 Promise<void>

λ fromJSON

Restores the model from a JSON checkpoint

Defined in svm/classes.ts:150

Parameters:

ParamTypeDefaultDescription
options.optionsanynull
options.svmanynull
options.typeanynull

Returns:

void

λ predict

Predict using the linear model

Defined in svm/classes.ts:117

Parameters:

ParamTypeDefaultDescription
Xnumber[][]

Returns:

number[]

λ predictOne

Predict the label of one sample.

Defined in svm/classes.ts:127

Parameters:

ParamTypeDefaultDescription
Xnumber[]

Returns:

number[]

λ toJSON

Saves the current SVM as a JSON object

Defined in svm/classes.ts:136

Returns:

ParamTypeDescription
svmanyundefined