OptimizeHyperparameters option to tune soft margin SVM classifier
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Don Mathis
2019-4-12
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
2020-4-3
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?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification Ensembles 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!