0:02 welcome back in this video I will
0:04 discuss support Vector machine in
0:06 machine learning also I will discuss
0:08 what are the different type of svm
0:11 algorithms are there and how svm
0:13 algorithm works
0:16 support Vector machine or svm is one of
0:18 the most popular supervised machine
0:20 learning algorithm which are used to
0:22 solve the classification as well as
0:25 regression kind of problems so in this
0:27 case first we need to understand what is
0:30 the supervised here supervisor means in
0:32 this case we need to give the label data
0:35 as an input to this particular algorithm
0:36 and what is classification
0:39 classification problems are those where
0:41 the target contains discrete number of
0:44 possibilities for example if you want to
0:47 solve a problem where we want to classify
0:48 classify
0:52 a male as a spam mail or a not spam in
0:53 this case we have only two possibilities
0:56 so such kind of problems are called as
0:58 classification problems
1:00 but if the target label contains
1:02 continuous values such kind of problems
1:03 are called as regression kind of
1:06 problems for example let us say that we
1:09 want to know the increase in salary of
1:12 an employee based on his performance in
1:14 this case the increase in salary is a
1:16 continuous in nature hence such kind of
1:18 problems are called as regression kind
1:19 of problems
1:22 usually is svm or support Vector machine
1:24 algorithms are used to solve
1:26 classification kind of problems in
1:27 machine learning
1:30 the goal of svm algorithm is to draw a
1:33 based line or a decision boundary to
1:34 segregate the given data set into
1:37 multiple number of classes once you draw
1:39 that particular addition boundary
1:40 based on that particular decision
1:42 boundary we should be able to classify
1:44 the new example into one of the classes
1:46 over here now this particular decision
1:48 boundary is called as hyperplane in
1:50 terms of svm algorithm
1:52 now the question comes in front of us is
1:55 how to draw this particular hyperplane
1:57 given a data set let us say that we have
1:58 been given this particular data set in
2:01 this case we have two classes one is
2:03 which is drawn in blue color and another
2:06 one is drawn in you can say that green color
2:07 color
2:09 now this particular data is linearly
2:11 separable we can draw a straight line
2:12 and then we can separate this particular
2:15 data into two classes but which one is
2:18 the best line over here or the best
2:19 Edition boundary because if you look at
2:22 this particular diagram I have drawn two
2:24 lines one with the red color another one
2:27 with green color over here between these
2:29 two which one I supposed to select so
2:31 what we need to do over here is we need
2:33 to draw all possible lines the one which
2:35 is having the best accuracy that
2:37 particular line we need to select that
2:39 will be called as the hyperplane over here
2:40 here
2:41 the dimension of this particle
2:44 hyperplane depends on the features
2:46 present in that particular data set for
2:48 example we have only two features let us
2:51 say that we have X and Y in such case we
2:54 will be able to uh draw a straight line
2:55 and then we can classify that particular
2:58 data so in such case uh the hyperplane
3:00 will be a straight line but if you have
3:02 more than two data features for example
3:05 we have three features or more than
3:06 three features in such cases we cannot
3:08 draw a straight line we need to draw
3:11 something called as a plane or something
3:13 like that that will be called as the
3:15 hyperplane in this case or a two
3:17 dimensional hyper pipe over here
3:19 but very important thing is we need to
3:21 draw a hyperplane in such a way that we
3:22 will get the maximum margin I will
3:25 discuss this particular maximum margin
3:27 in detail at the later stage
3:29 now once you draw that particular
3:32 hyperplane while drawing we used to
3:34 consider two things over here the one is
3:37 which is called as the nearest points on
3:40 both the sides okay so for example if
3:42 you go with this particular data set
3:44 here this particular point and this
3:46 particular points are nearest for this
3:48 particular hyperplane so these two are
3:50 called as the support vectors in this
3:53 particular case so for this one this one
3:55 is the nearest one and this is the
3:57 second nearest one this one and this one
3:58 will be called as a support Vector for
4:01 this particular hyper plane but based on
4:03 uh the maximum margin we will select
4:05 between these two things but end of the
4:07 day the one which is having the nearest
4:08 data point for that particular
4:11 hyperplane that will be called as the
4:13 support Vector over here
4:15 now coming back to the next part of our
4:18 discussion that is uh what are the
4:21 different type of svm are there there
4:23 are mainly two type of svm we have one
4:26 is called as a linear SPM another one is
4:29 called as non-linear svm the linear svm
4:32 is one where we can separate the data
4:35 with the help of a straight line for
4:37 example we have been given a data and we
4:39 can separate that particular data with
4:41 the help of a straight line such kind of
4:44 svm is called as linear svm if we are
4:48 unable to draw a straight line to divide
4:49 that particular data set into classes
4:52 such kind of svm is called as non-linear
4:56 svm for example uh I will consider one
4:59 example to understand this linear svm in
5:01 detail let us say that this is a data
5:04 set given to us in this case one class
5:07 of data is drawn with star color another
5:09 set of data is called as is drawn with
5:11 the circle over here
5:14 now this particular data can be
5:16 separated with the help of straight n
5:18 hence it is called as the linear svm
5:19 over here but the question comes in
5:22 front of us uh when we draw multiple
5:24 number of straight lines to separate
5:25 this particular data which particular
5:27 straight line should be considered as a
5:29 hyper plane over here so that can be
5:31 understand with the help of this
5:33 particular diagram what we do over here
5:35 is for example if you consider d as a
5:38 hyperplane for this one this one and
5:40 this one will become the support vectors
5:43 over here so we need to draw a parallel line
5:44 line
5:46 which will test this particular support
5:48 vectors and they are parallel to what
5:50 you can say that our hyper plane and
5:52 then this distance we need to calculate
5:54 so this distance you can say that it is
5:56 uh M1
5:57 similarly we have to do it for this
6:00 particular B also for this particular B
6:02 this will become one support vector and
6:03 this will become another support Vector
6:05 we need to draw a straight line over
6:06 here we need to draw a straight line
6:09 over here I have drawn it here correctly
6:11 and then we need to calculate this
6:14 particular margin over here now let us
6:17 say that this margin is equal into M2
6:20 now if you compare this M1 and M2 the
6:23 margin M1 is smaller compared to this M2
6:25 so we can say that between these two
6:28 this particular B is the best line which
6:30 will divide this particular data set
6:32 into two classes over here so B will be
6:34 considered as the hyperplane in this
6:37 particular case over here but it may not
6:39 be the case all the time because we need
6:41 to do it for all possible lines the one
6:42 which will give you the maximum margin
6:44 that should be considered over here the
6:47 calculation of this particular maximum
6:49 margin can be shown mathematically
6:50 something like this let us assume that
6:53 this is your hyperplane and this is the
6:55 first support vector and this is a
6:58 second support vector what uh what
7:00 actually happens over here is uh for
7:03 this particular hyperplane we will uh
7:05 write this particle equation that is W
7:08 into X plus b is equal to zero now when
7:10 I write something like this on this
7:13 particular side on one side uh for this
7:16 particular support Vector we will get W
7:18 into X plus b is equivalent to minus 1
7:21 on another side we will get plus one if
7:22 you go beyond this particular thing it
7:24 will be less than minus 1 if you go
7:26 behind this side it will be greater than
7:28 or equal into 1 over here because of
7:30 that from here to here we will get
7:32 distance 1 from here to here we will get
7:34 distance one for each and every what we
7:37 can say that uh the support vectors so
7:40 what we need to do over here is we need
7:42 to get an hyperplane where we will get
7:44 the maximum value for this particular
7:46 condition that is 2 divided by
7:49 cardinality of w if you get this
7:52 particular maximum value for that
7:54 particular W should be considered as you
7:57 can say that the final hyperplane over
8:00 here the next type of svm is called as
8:04 non-linear svm this non-linear svm is
8:06 one where we will not be able to draw a
8:07 straight line to divide this particular
8:10 data into two classes over here if you
8:11 look at this particular thing if I draw
8:13 anywhere a straight line I will not be
8:15 able to classify this particular data
8:17 into two classes here so what I need to
8:19 do is I need to convert this particular
8:21 data into what is that called as linear
8:24 data for that reason we can use
8:25 something called as a mapping functions
8:27 or something like that in this case I
8:29 have used one mapping function here that
8:31 is z is equal to x square plus y Square
8:33 so when you do this particular thing on
8:35 all these particular data points the
8:37 data points will look something like
8:40 this so all green will go and sit over
8:42 here all blue will go and sit over here
8:44 so what we need to do we need to apply
8:46 this particular function on the top of
8:48 this one we will get another axis that
8:51 is called as Z over here so x axis and Z
8:54 axis so for this particular data set
8:56 definitely we can apply the linear svm
8:58 over here so again we need to draw all
9:01 possible lines which will separate this
9:03 particular data into two classes and
9:06 then we need to identify the one
9:07 straight line which will give you the
9:09 maximum margin and then that we need to
9:11 consider here this is how the support
9:14 Vector Machine Works in machine learning
9:16 I hope you understood what is support
9:17 Vector machine what are the different
9:20 type of support Vector machines and how
9:22 support Vector Machine Works in machine learning
9:23 learning
9:25 I hope the concept is clear if you like
9:27 the video do like and share with your
9:29 friends press the Subscribe button for
9:31 more videos press the Bell icon for