0% found this document useful (0 votes)
12 views20 pages

ML Lec-19

Uploaded by

bhargavr3103
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views20 pages

ML Lec-19

Uploaded by

bhargavr3103
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

ML

LECTURE-19
BY
Dr. Ramesh Kumar Thakur
Assistant Professor (II)
School Of Computer Engineering
v Support Vector Machine or SVM is one of the most popular Supervised Learning algorithms, which is
used for Classification as well as Regression problems.

v However, primarily, it is used for Classification problems in Machine Learning.

v 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.

v This best decision boundary is called a hyperplane.

v SVM chooses the extreme points/vectors that help in creating the hyperplane.

v These extreme cases are called as support vectors, and hence algorithm is termed as Support Vector
Machine.
v Consider the below diagram in which there are two different categories that are classified using a decision
boundary or hyperplane:
v Example: 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, a model can be created by using the SVM algorithm.
v 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.
v 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.
v On the basis of the support vectors, it will classify it as a cat. Consider the below diagram:

v SVM algorithm can be used for Face detection, image classification, text categorization, etc.
v SVM can be of two types:
v Linear SVM: Linear SVM is used for linearly separable data, which means if a dataset can be
classified into two classes by using a single straight line, then such data is termed as linearly separable
data, and classifier is used called as Linear SVM classifier.

v Non-linear SVM: Non-Linear SVM is used for non-linearly separated data, which means if a dataset
cannot be classified by using a straight line, then such data is termed as non-linear data and classifier
used is called as Non-linear SVM classifier.
v Hyperplane: There can be multiple lines/decision boundaries to segregate the classes in n-dimensional
space, but we need to find out the best decision boundary that helps to classify the data points.
v This best boundary is known as the hyperplane of SVM.
v The dimensions of the hyperplane depend on the features present in the dataset, which means if
there are 2 features, then hyperplane will be a straight line. And if there are 3 features, then
hyperplane will be a 2-dimension plane.
v We always create a hyperplane that has a maximum margin, which means the maximum distance
between the data points.

v Support Vectors:
v The data points or vectors that are the closest to the hyperplane and which affect the position of the
hyperplane are termed as Support Vector.
v Since these vectors support the hyperplane, hence called a Support vector.
v Linear SVM:
v The working of the SVM algorithm can be understood by using an example. Suppose we have a dataset
that has two tags (green and blue), and the dataset has two features x1 and x2.
v We want a classifier that can classify the pair(x1, x2) of coordinates in either green or blue.
v Consider the below image:
v So as it is 2-d space so by just using a straight line, we can easily separate these two classes.
v But there can be multiple lines that can separate these classes. Consider the below image:
v The SVM algorithm helps to find the best line or decision boundary; this best boundary or region is
called as a hyperplane.
v SVM algorithm finds the closest point of the lines from both the classes. These points are called
support vectors.
v The distance between the vectors and the hyperplane is called as margin.
v And the goal of SVM is to maximize this margin.
v The hyperplane with maximum margin is called the optimal hyperplane.
v Non-Linear SVM: If data is linearly arranged, then we can separate it by using a straight line, but for
non-linear data, we cannot draw a single straight line.
v Consider the below image:
v So to separate these data points, we need to add one more dimension.
v For linear data, we have used two dimensions x and y, so for non-linear data, we will add a third
dimension z. It can be calculated as:
v z=x2 +y2
v By adding the third dimension, the sample space will become as below image:
v So now, SVM will divide the datasets into classes in the following way.
v Consider the below image:
v Since we are in 3-d Space, hence it is looking like a plane parallel to the x-axis.
v If we convert it in 2d space with z=1, then it will become as:

v Hence we get a circumference of radius 1 in case of given non-linear data.


our task is to find values for the αi such that

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy