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.88RBF kernel handles non-linear boundaries.
Example 2 (python)
# Always scale features for SVMsScale-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.
