Lec 05-14-2026: Soft-Margin SVM & Cross-Validation
Soft-Margin SVM
Section titled “Soft-Margin SVM”Last lecture, we started the soft-margin SVM. We said: given a non-linearly separable dataset , to find the optimal hyperplane which maximizes the margin, we solve the following optimization problem:
Subject to , and ,
Comments
Section titled “Comments”Because is a measure of how much a point violates the margin, we wish to minimize the total violation, and that’s why we are minimizing .
- is a measure of how much datapoint measures the error.
- So is a measure of the total violation of the margin across all datapoints.
is saying “I’ll allow some points to break the margin but charge a fee of units per violation.”
- If is low, it is cheap to break the margin, so we get a larger margin.
- If is high, it is expensive to break the margin, so the margin / breathing room will decrease to make sure there are fewer violations.
So we want to maximize the margin and minimize violations at the same time — is what controls that balance.
Cross-Validation for Selecting
Section titled “Cross-Validation for Selecting CCC”We split the data as follows:
Training Phase
Section titled “Training Phase”Using the 60% training split, we train 5 models with different values of :
Which yields a better model?
We use each of the 5 models to predict on the validation data and compute the accuracy.
- Use the coming from the highest accuracy.
Using this , run the optimization on the training + validation set. This yields and , and our end model is .
We use our end model on the test set, which the model has never seen before, so we get an “honest” reading.