Filter löschen
Filter löschen

I am using a linear svm an i would like to tune the boxconstraint parameter.

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Cindy Solomon
Cindy Solomon am 6 Mai 2015
Bearbeitet: Cindy Solomon am 6 Mai 2015
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!

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by