Lecture 3
Lecture 3
Shahadat Hoshen
Lecturer,
Dept. of CSE, NUBTK
Support Vector Machines
Support Vector Machines, a supervised machine learning
algorithm used for classification and regression tasks and
effective in dealing with complex, high-dimensional
datasets.
SVM performs classification by first transforming the
training records into higher dimensions. Then, within the
new dimension, it searches for the best decision boundary
that separates the training records of one class from others.
The main objective of SVMs is to find the best hyperplane
that separates the data points of different classes in a way
that maximizes the margin, or the distance, between the
classes. This hyperplane serves as the decision boundary
for classifying new, unseen data points.
Support Vector Machines
Study in details
Linear vs Non-linear SVM
When we can easily separate data with hyperplane by
drawing a straight line is Linear SVM. When we cannot
separate data with a straight line we use Non–Linear
SVM.
Linear vs Non-linear SVM
Similarly,
S2 = ,S2 = S3 = ,S3 =
~
~
Linear SVM Solve
¿ 𝛼 1~
𝑠1 ⋅ ~
𝑠 1+ 𝛼2 ~
𝑠 2 ⋅~
𝑠 1+ 𝛼3 ~
𝑠 3 ⋅~
𝑠 1=− 1
¿ 𝛼 1~
𝑠1 ⋅ ~
𝑠 2+ 𝛼2 ~
𝑠2 ⋅ ~
𝑠 2+ 𝛼3 ~
𝑠3 ⋅ ~
𝑠 2=+ 1
¿ 𝛼1 ~
𝑠 1 ⋅~
𝑠3 + 𝛼2 ~
𝑠 2 ⋅~
𝑠 3 +𝛼3 ~
𝑠3 ⋅ ~
𝑠3 =+1
( )( ) ( )( ) ( )( )
1 1 3 1 3 1
𝛼1 0 0 +𝛼 2 1 0 +𝛼 3 − 1 0 =− 1
1 1 1 1 1 1
( )( ) ( )( ) ( )( )
1 3 3 3 3 3
¿ 𝛼1 0 1 + 𝛼2 1 1 +𝛼 3 − 1 1 =1
1 1 1 1 1 1
( )( ) ( )( ) ( )( )
¿1 ¿3 ¿3 ¿3 ¿3 ¿3
𝛼1 ¿0 ¿ − 1 +𝛼 2 ¿ 1 ¿ −1 +𝛼 3 ¿ − 1 ¿ − 1 = 1
¿1 ¿1 ¿1 ¿1 ¿1 ¿1
Linear SVM Solve
¿ 𝛼 1 ( 1+0 +1 ) +𝛼 2 ( 3 +0+ 1 )+ 𝛼3 ( 3+ 0+1 ) =−1
¿ 𝛼 1 ( 3 +0+ 1 ) +𝛼2 ( 9+1+ 1 )+ 𝛼3 ( 9 −1+ 1 )=1
¿ 𝛼 1 ( 3 +0+ 1 ) +𝛼2 ( 9 −1+1 ) + 𝛼3 ( 9+1+ 1 )=1
¿ 2 𝛼1 + 4 𝛼 2 +4 𝛼3 =−1
¿ 4 𝛼 1+11 𝛼2 +9 𝛼 3=1
¿ 4 𝛼 1+ 9 𝛼2 +11 𝛼 3=1
¿ 𝛼1=− 3.5
¿ 𝛼2= 0.75
¿ 𝛼 3= 0.75
Linear SVM Solve
𝑤∧¿ ∑ ❑𝛼 𝑖 ~
~ 𝑠𝑖
𝑖
() () ( )
¿1 ¿3 ¿3
¿=− 3.5 ¿ 0 +0.75 ¿ 1 + 0.75 ¿ −1
¿1 ¿1 ¿1
( )
¿1
¿= ¿ 0
¿ −2
W= , b= -2
Linear SVM Solve
Problem: 2
Here are some data point:
and 1 and forms a curve like the "S" form that curve is
called the Sigmoid function or the logistic function.
Probability is either 0 or 1, depending on whether the event
happens or not.
For binary predictions, you can divide the population into