In a SVM with linear kernel, could you explain to me what exactly the C parameter is/represents?

An example why it's important to select a good value for C would also be appreciated.

Thank you.


The $c$ parameter tells the algorithm how to balance the two competing objectives which are to maximize the margin between the two classes and to not allow any samples to be misclassified. If $c=0$ then the algorithm does not allow any samples to be misclassified. If your data is not linearly separable then the algorithm will not be able to find a separating hyperplane. If $c>0$ then the algorithm can trade-off some misclassified samples in-order to find a margin that better separates the remaining points.

You should try a variety of values for $c$ and see which one works best.

| cite | improve this answer | |
  • $\begingroup$ Thank you Aaron! One follow-up question: To determine which C is best, should I evaluate the models (each with a different C) based on accuracy percentage (i.e. correctly classifying points from the validation data set) or should I use something else? $\endgroup$ – Glenn Jul 7 '14 at 8:56
  • $\begingroup$ Yes you should do exactly that. $\endgroup$ – Aaron Jul 7 '14 at 14:22
  • $\begingroup$ Thanks! So in the case of C>0, would high C values result in smaller margins (even though a SVM tries to maximize that) and less misclassifying because misclassifications result in a higher 'penalty?' ? $\endgroup$ – Glenn Jul 7 '14 at 16:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.