Machine Learning Β· Chapter 15 of 40

Support Vector Machines (SVM)

SVMs find the optimal boundary that separates classes by the widest MARGIN.

With kernels (RBF, polynomial), they can capture complex non-linear boundaries.

Example 1 (python)
from sklearn.svm import SVC
m = SVC(kernel='rbf', C=1.0).fit(X_train, y_train)
print(m.score(X_test, y_test))
Output
0.88

RBF kernel handles non-linear boundaries.

Example 2 (python)
# Always scale features for SVMs

Scale-sensitive like KNN.

Key points

  • Finds max-margin boundary.
  • Kernels enable non-linear boundaries.
  • Requires scaled features.
  • Slower on very large datasets.
πŸ’‘ Note: C controls how much the model tolerates misclassifications. Small C = wider margin, more errors allowed.

πŸ“ Quick Quiz

1. SVMs find the:

2. The 'RBF' kernel enables:

3. Before SVM you should: