Professional Documents
Culture Documents
Machines
Large Margin Classifier
Recap: logistic regression
If , we want ,
If , we want ,
Recap: logistic regression
Cost of example:
If (want ): If (want ):
Support vector machine
Logistic regression:
-1 1 -1 1
If , we want (not just )
If , we want (not just )
SVM Cost Function
Whenever :
𝑐𝑐𝑐𝑐𝑐𝑐𝑡𝑡1 𝜃𝜃 𝑇𝑇 𝑥𝑥 𝑖𝑖 = 𝑚𝑚𝑚𝑚𝑚𝑚 (0,1 − 𝜃𝜃 𝑇𝑇 𝑥𝑥 𝑖𝑖 )
-1 1
Whenever :
-1 1
SVM Cost Function
Whenever :
𝑐𝑐𝑐𝑐𝑐𝑐𝑡𝑡1 𝜃𝜃 𝑇𝑇 𝑥𝑥 𝑖𝑖 = 𝑚𝑚𝑚𝑚𝑚𝑚 (0,1 − 𝑦𝑦 𝑖𝑖 (𝜃𝜃 𝑇𝑇 𝑥𝑥 𝑖𝑖 ))
-1 1
Whenever 𝑦𝑦 (𝑖𝑖) = −1 :
-1 1
SVM Hypothesis and Cost Function
ℎ𝜃𝜃 𝑥𝑥 = 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠(𝜃𝜃 𝑇𝑇 𝑥𝑥)
𝑚𝑚
• Margin = 𝒚𝒚 𝜽𝜽 ⋅ 𝒙𝒙
• Margin is proportional to the
distance of a point from the
decision boundary
• Binary classifier makes error
Distance fromwhen Margin
decision is less than
boundary zero point x:
of a data
𝜃𝜃⋅𝑥𝑥 • Margin also gives a measure of
𝑖𝑖𝑖𝑖 𝜃𝜃 ⋅ 𝑥𝑥 > 0
𝜃𝜃 confidence 𝜃𝜃⋅𝑥𝑥
𝜃𝜃⋅𝑥𝑥
= 𝑦𝑦 𝜃𝜃
− 𝑖𝑖𝑖𝑖 𝜃𝜃 ⋅ 𝑥𝑥 < 0
𝜃𝜃
𝜃𝜃 ⋅ 𝑥𝑥 = 𝜃𝜃 𝑥𝑥 cos 𝑑𝑑
𝑥𝑥+ 𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 𝜃𝜃 ⋅ 𝑥𝑥 > 0
𝑥𝑥− 𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚 𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 𝜃𝜃 ⋅ 𝑥𝑥 < 0
SVM Margin
Distance between the positive and Where 𝐶𝐶 is the trade off parameter
negative support vectors:
𝜃𝜃 ⋅ 𝑥𝑥+ 𝜃𝜃 ⋅ 𝑥𝑥− SVM is called large margin classifier
𝐷𝐷 = −
𝜃𝜃 𝜃𝜃
2
𝐷𝐷 =
𝜃𝜃
Large margin classifier in presence of outliers
x2
x1
Large margin classifier in presence of outliers
x2
x1
SVM parameters:
C( ). Large C: Lower bias, high variance.
Small C: Higher bias, low variance.