Lecture7C Classification
Lecture7C Classification
n Outline:
1. Introduction
2. K Nearest Neighbor (KNN)
3. Artificial Neural Network (ANN)
4. Support Vector Machine (SVM)
Binary classifier
§ Applications:
Common binary classification algorithms
§ Naïve Bayes
§ K Nearest Neighbor
§ Decision Trees
§ Logistic Regression
§ Recall § ROC
§ Precision § AUC
§ F1-score § …
Example of binary classification
Threshold
edges
§ Use a midpoint as threshold
§ Training data:
Ignore it!!!
Soft margin
This is Soft Margin
Classifier
How to choose a good soft margin?
?
How to choose a good soft margin?
1D data
Support vector classifier
2D data
Support vector classifier
3D data
Support vector classifier
cured
cured
uncured patients uncured
patients
patients patients
Support
Vector
Machines
(SVM)
SVM: a visual explanation (cont)
Alice Zhao
SVM: a visual explanation (cont)
SVM: a visual explanation (cont)
Margin = distance
between the hyperplane
and the closest data point
from either class.
margin
Margin (cont)
What is a hyperplane?
Hyperplane
Support
vectors
How to find the optimal hyperplane?
à Constrained
optimization
problem
à Using
Lagrange
multipliers
technique
How to find the optimal hyperplane? (cont)
2
|𝑤|
How to find the optimal hyperplane? (cont)
subject to.
Quadratic programming solving
Ø Kernel trick
Ø Mixed
Soft-margin SVM
subject to:
The role of C parameter
§ Effects of C:
Ø Cross validation
Kernel trick
§§ When
C controls
data the
is not
trade-off
linearlybetween:
separable:
ØØ Map data to a
Maximizing higher
the dimensional feature space where data
margin
Ø becomes separable
Minimizing the classification errors
§ Effect of
Decision boundary
Summary