I am using a linear svm an i would like to tune the boxconstraint parameter.
2 次查看(过去 30 天)
显示 更早的评论
I am using a linear svm and i would like to tune the boxconstraint parameter. I have tried different values but there are no results. my svm looks like:
svmtrain(trainingFeatures, trainingLabels,'Kernel_Function','linear',... 'boxconstraint',C,'tolkkt',(1e-3),'kktviolationlevel', 0);
trainingFeatures=[TrainingDataPositive;TrainingDataNegative];
size(TrainingDataNegative)=21354x1297 size(TrainingDataPositive)=8380x1297
How can i tune boxconstraint parameter( C parameter)in order to see different ErroRates (from function classperf) and pick the minimum.
Thanks
0 个评论
采纳的回答
Cindy Solomon
2015-5-6
编辑:Cindy Solomon
2015-5-6
Hi Konstantinos,
The adjustments you would make would highly depend on your specific data, but to clarify how the BoxConstraint impacts your SVM, this parameter lets you specify the soft margin in the SVM classifier you train. This in turn lets you control the trade-off between margin width and misclassification by specifying a single (scalar) value that specifies the soft margin for all vectors. To specify a hard margin, you can set this value to a very large number. Theoretically it could be set to infinity (inf in MATLAB), but this may cause numerical stability issues in the optimization algorithm and increases the training time (although it will also decrease the number of support vectors). In addition, I would recommend using "fitcsvm" instead of "svmtrain", as svmtrain will be removed in a future release of MATLAB.
Hope this helps!
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!