MATLAB Answers

How to fix coding method (e.g.,'onevsall') in performing hyperparameter optimzation in multi-class svm (i.e., fitcecoc.m)

3 views (last 30 days)
Yuzhen Lu
Yuzhen Lu on 24 Oct 2018
Edited: Don Mathis on 26 Oct 2018
The function fitcecoc.m allow to optimize hyperparamters for multi-class svm by seting up the parameter-vlaue pairs for 'OptimizeHyperparameters' and or 'HyperparameterOptimizationOptions', e.g.:
mdl = fitcecoc(x,y,'OptimizeHyperparameters','auto')
The code above will actually optimize three hyperparameters: coding (using either of ['onevsone' 'onevsall'], box constraint and kernel scale. I wonder if there is any way to fix the coding method (ie., not optimize the coding hyperparameter but use 'onevsall' not 'onevsone' that is set by default) and only optimize the two other hyperparameters.
It is found that even if a specific parameter-value pair of 'coding' and 'onevsall' is provided as arguments of fitcecoc.m, the hyperaparmeter optimation will override the coding method provided and use 'onevsone' for coding.

  0 Comments

Sign in to comment.

Answers (1)

Don Mathis
Don Mathis on 26 Oct 2018
Edited: Don Mathis on 26 Oct 2018
You are right that the optimization overrides statically specified variables values. That's mentioned in this "Note" on the Doc page for fitcecoc . So you will need to pass the variables to be optimized individually, like this:
mdl = fitcecoc(x,y,'Coding','onevsall','OptimizeHyperparameters',{'KernelScale','BoxConstraint'})

  0 Comments

Sign in to comment.

Sign in to answer this question.