Professional Documents
Culture Documents
Linear Regression & SVM
Linear Regression & SVM
B
What’s Slope?
A slope of 2 means that every 1-unit
change in X yields a 2-unit change in Y.
B
Linear Regression
Method of least squares: estimates the
best-fitting straight line
| D|
( xi x )( yi y ) xy x y
w i 1
w1 n
1 (x x)
| D|
i
2
x 2
( x ) 2
i 1 n
w y w x
0 1
Example
x is the number of years
of work experience of a
college graduate
y is the corresponding
salary of the graduate
Example
| D|
( x x )( y y)
w
i i
i 1
1 (x x)
| D|
i
2
i 1
Example
B2
B2
B2
B2
b21
b22
margin
b11
b12
Find hyperplane maximizes the margin => B1 is better
than B2
Support Vector Machines
B2
b21
b22
margin
b11
b12
Margin (cont…)
B1
w x b 0
w x b 1
w x b 1
b11
2
b12 Margin 2
1 if w x b 1 || w ||
f (x)
1 if w x b 1
Support Vector Machines
A separating hyperplane can be written as
W●X+b=0
where W={w1, w2, …, wn} is a weight vector
and b a scalar (bias)
For 2-D it can be written as
w0 + w1 x1 + w2 x2 = 0
The hyperplane defining the sides of the
margin:
H1: w0 + w1 x1 + w2 x2 ≥ 1 for yi = +1
H2: w0 + w1 x1 + w2 x2 ≤ – 1 for yi = –1
References
https://medium.com/machine-learning-10
1/chapter-2-svm-support-vector-machine-
theory-f0812effc72
https://www.ibm.com/support/knowledgec
enter/de/SS3RA7_15.0.0/com.ibm.spss.m
odeler.help/svm_howwork.htm
https://towardsdatascience.com/kernel-fu
nction-6f1d2be6091
Thank you