OptimizeHyperparameters option to tune soft margin SVM classifier
3 views (last 30 days)
Show older comments
Hello,
I am building an SVM model with soft margin for calssifying images dataset of 900 instants, into two calsses, but I need to tune the hyperparameter 'Boxconstraint', and I am using 'OptimizeHyperparameters' for such purpose, as below code, however, it takes long time to run the optimizer, around 90 seconds, while if i use the 'rbf' model, it takes less time. I wonder what cause this issue. are there any suggestions to avoid or improve this.
Also, If i want to build a hard margin SVM using 'fitcsvm' function, should I set the parameter 'BoxConstraint' to very high value?
c = cvpartition(data_lables,'k',10);
opts = struct('Optimizer','bayesopt','ShowPlots',false,'CVPartition',c,...
'AcquisitionFunctionName','expected-improvement-plus');
svmmod = fitcsvm(data_features,data_lables,'KernelFunction','linear','CacheSize','maximal',...
'OptimizeHyperparameters','auto','HyperparameterOptimizationOptions',opts);
2 Comments
Don Mathis
on 12 Apr 2019
As for the runtime, linear SVM can often be much slower than RBF SVM, depending on the combination of BoxConstraint and KernelScale. The optimization will sometimes explore those combinations. I don't think it's possible to avoid that when doing hyperparameter search.
Felipe Assunção
on 3 Apr 2020
I also see the same problem for using ftcecoc or fitcensemble (which takes much longer).
When I do the optimization, should I consider my entire dataset that I will use in the classification or would it be just a part? I have currently used my entire set.
Beside this, about this optimization model, should I specify cross-validation in this optimization or just in my classifier?
Answers (0)
See Also
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!