# Tuning C hyper parameter in Soft Margin SVM in Matlab

How to tune the C 'BoxConstraint' hyperparameter in soft margin SVM to get the best optimal value?

The easiest way to tune a single hyperparameter is to use what is called the elbow method. Do the following:

• Define a range of C you want to try, i.e C = [1.0, 1.5, 2.0, ...]
• Loop over all values of C in your range
• Train a new model with the current value of C
• Evaluate each model on the validation set and store the results