Support Vector
Machine (SVM)
Discussion
2
After
hardship,
there will be
ease. This is
Allah’s
promise. So
never lose
hope in
times of
hardships
and
calamities.
•A Quick Recap (Important Concepts)
•What is Support Vector Machine (SVM)
•How does SVM Work?
•SVM Kernels
•SVM Use Cases
•Advantages and Disadvantages
•Hands-on Implementation in Python
•SVM on Cancer Dataset
•SVM on IRIS flower Dataset
3
What is Machine Learning?
4
Applications of SVM:
5
What is Support Vector Machine:
• SVM is a linear model used for
• Classification and Regression
• Solve linear and non-linear problems
• Main idea behind is really simple:
• Algorithm creates a line/hyperplane
which separates the data into classes
6
A Quick Concept:
7
8
Why SVM?
9
Why SVM?
10
Why SVM?
SVM is a supervised learning method that looks at the data and sorts
it into one of the two categories
11
Why SVM?
12
What is SVM?
13
What is SVM?
14
15
What is SVM?
16
17
What is SVM?
18
What is SVM?
19
20
What is a hyperplane?
● Simple task with only two features, you
can think of a hyperplane as a line that
linearly separates and classifies a set of
data.
● Intuitively, the farther from the
hyperplane our data points lie, the
more confident we are that they have
been correctly classified.
● So when new testing data are added,
whatever side of the hyperplane it lands
will decide the class that we assign to
it.
21
In technical terms we say distance b/w points and line should be
maximum
What is SVM?
And hyperplane has the maximum distance to the support vectors of
any class
22
If we select a hyperplane having low margin, then there is a high
chance of misclassification
What is SVM?
From the distance margin , we get the optimal hyperplane, now
based on this hyperplane we can say new point is Male
23
How do we find the right hyperplane?
- Segregate the two classes within the data?
- Margin:
Distance between the hyperplane and the
nearest data point from either set.
- Goal:
Choose a hyperplane with the greatest
possible margin between the hyperplane
and any point within the training set
giving a greater chance of new data being classified correctly.
There will never be anydata point inside the margin
24
25
26
Understanding Dimensions:
27
28
29
SVM Kernels:
30
Understanding Kernel
31
Understanding Kernel
32
Understanding Kernel
33
Understanding Kernel
34
Non-Separable Case
35
Non-Linear Decision Boundaries
36
37
•. Advantage/Disadvantages of SVM
● Advantages
● SVM works relatively well when there is clear margin of
separation between classes.
● SVM is more effective in high dimensional spaces.
● SVM is effective in cases where number of dimensions is
greater than the number of samples.
● SVM is relatively memory efficient
● Disadvantages
● SVM algorithm is not suitable for large data sets
● SVM does not perform very well, when the data set has more noise
i.e. target classes are overlapping.
● In cases where number of features for each data point exceeds the
number of training data sample , the SVM will under perform.
How to Implement SVM?
39
Thank you
Any Question?
40