user836026
user836026

Reputation: 11360

How to set Sigma value in CompactClassificationSVM in Matlab

I'm new to Matlab and I would like to set the value of Sigma for the class CompactClassificationSVM

I couldn't find away to set it's value. I tried for example;

CompactSVMModel.Sigma

But I got the error message:

Error using subsref
No appropriate method, property, or field 'Sigma' for class 'ClassificationECOC'.

Any clue?

Upvotes: 1

Views: 140

Answers (1)

paisanco
paisanco

Reputation: 4164

You have to first train a support vector machine classifier using fitcsvm, with standardization of predictors set to true, as input to your CompactClassificationSVM.

The syntax is

mySVMModel = fitcsvm(X,Y,'Standardize',true)

where X is your vector of predictors, and Y your vector of class labels.

Standardization is set to false by default. You have to turn it on explicitly.

Then you can call

CompactSVMModel = compact(mySVMModel)

and it will have Sigma set to what you trained it to be in the first step.

I don't know of any way to set the input Sigma at the training stage directly but you can set the prior probabilities of your classes, or weights on the input data respectively using the 'Prior' or 'Weights' keywords. See the Matlab documentation for fitclsvm for specific syntax of the options - it really depends on your specific application what to do.

Upvotes: 1

Related Questions