CSL0777 L23
CSL0777 L23
CSL0777 L23
Lecture No. 23
Support Vector Machine Algorithm
Mr. Praveen Gupta
Assistant Professor, CSA/SOET
Outlines
• SVM Algorithm for Machine Learning
• Types of SVM
• Hyper plane and support vectors in SVM
• How does Linear SVM work?
• How does Non Linear SVM work?
• Python implementation of the CNN algorithm
• References
Student Effective Learning Outcomes(SELO)
01: Ability to understand subject related concepts clearly along with
contemporary issues.
02: Ability to use updated tools, techniques and skills for effective domain
specific practices.
03: Understanding available tools and products and ability to use it effectively.
Support Vector Machine Algorithm
•Support Vector Machine or SVM is one of the most
popular Supervised Learning algorithms, which is
used for Classification as well as Regression
problems. However, primarily, it is used for
Classification problems in Machine Learning.
•The goal of the SVM algorithm is to create the best
line or decision boundary that can segregate n-
dimensional space into classes so that we can easily
put the new data point in the correct category in the
future. This best decision boundary is called a
hyperplane.
4 / 22
Support Vector Machine Algorithm
•SVM chooses the extreme points/vectors that help in creating the
hyperplane. These extreme cases are called as support vectors, and
hence algorithm is termed as Support Vector Machine.
4 / 22
Support Vector Machine Algorithm
•Suppose we see a strange cat that also has some features of
dogs, so if we want a model that can accurately identify
whether it is a cat or dog, so such a model can be created by
using the SVM algorithm.
•We will first train our model with lots of images of cats and
dogs so that it can learn about different features of cats and
dogs, and then we test it with this strange creature.
•So as support vector creates a decision boundary between
these two data (cat and dog) and choose extreme cases
(support vectors), it will see the extreme case of cat and dog.
On the basis of the support vectors, it will classify it as a cat.
4 / 22
Support Vector Machine Algorithm
4 / 22
Types of SVM
4 / 22
Support Vectors in the SVM algorithm
4 / 22
How does SVM works(Linear SVM)?
4 / 22
How does SVM works(Linear SVM)?
4 / 22
How does SVM works(Linear SVM)?
4 / 22
How does SVM works(Linear SVM)?
4 / 22
How does SVM works(Linear SVM)?
4 / 22
How does SVM works(Non Linear SVM)?
4 / 22
How does SVM works(Non Linear SVM)?
4 / 22
How does SVM works(Non Linear SVM)?
4 / 22
How does SVM works(Non Linear SVM)?
4 / 22
How does SVM works(Non Linear SVM)?
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
#importing datasets
data_set=
pd.read_csv('user_data.c 4 / 22
sv')
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
4 / 22
Python implementation of the SVM algorithm
Accuracy = (TP+TN)\Total
(66+24)\100= .90
Therefore accuracy of the model is 90%
4 / 22
Learning Outcomes