SVM TNP
SVM TNP
By
Dr.Trilok Nath Pandey
SCOPE,VIT,Chennai
Support Vector Machines
• The support vector machine (SVM), an approach for classification that was developed
in the computer science community in the 1990s and that has grown in popularity
since then.
• This classifier unfortunately cannot be applied to most data sets, since it requires
that the classes be separable by a linear boundary.
• support vector classifier, an extension of the maximal margin classifier that can be
applied in a broader range of cases.
Maximal Margin Classifier
• In this section, we define a hyperplane and introduce the concept of an
optimal separating hyperplane.
• What Is a Hyperplane?
• In a p-dimensional space, a hyperplane is a flat affine subspace of
hyperplane dimension p - 1.
• For instance, in two dimensions, a hyperplane is a flat one-dimensional
subspace—in other words, a line. In three dimensions, a hyperplane is a
flat two-dimensional subspace—that is, a plane.
• The mathematical definition of a hyperplane is quite simple. In two
dimensions, a hyperplane is defined by the equation
Maximal Margin Classifier
• for parameters β0, β1, and β2. When we say that (Eqn) “defines” the
hyperplane, we mean that any X = (X1, X2)T for which (Eqn) holds is a point on
the hyperplane. Note that (Eqn) is simply the equation of a line, since indeed
in two dimensions a hyperplane is a line.
• Equation can be easily extended to the p-dimensional setting:
• then X lies on the other side of the hyperplane. So we can think of the
hyperplane as dividing p-dimensional space into two halves.
Maximal Margin Classifier
The hyperplane 1 + 2X1 + 3X2 = 0 is shown. The blue region is the set of points for which 1 + 2X1 + 3X2 > 0,
and the purple region is the set of points for which 1 + 2X1 + 3X2 < 0.
Maximal Margin Classifier
Now suppose that we have a n×p data matrix X that consists of n training observations in p-
dimensional space,
Maximal Margin Classifier
The Maximal Margin Classifier
• In general, if our data can be perfectly separated using a hyperplane, then there will in fact exist an
infinite number of such hyperplanes.
• In order to construct a classifier based upon a separating hyperplane, we must have a reasonable
way to decide which of the infinite possible separating hyperplanes to use.
• A natural choice is the maximal margin hyperplane (also known as the optimal separating
hyperplane), which is the separating hyperplane that is farthest from the training observations.
• That is, we can compute the(perpendicular) distance from each training observation to a given
separating hyperplane; the smallest such distance is the minimal distance from the observations to
the hyperplane, and is known as the margin.
• The maximal margin hyperplane is the separating hyperplane for which the margin is largest that is,
it is the hyperplane that has the farthest minimum distance to the training observations.
• We can then classify a test observation based on which side of the maximal margin hyperplane it
lies.
• This is known as the maximal margin classifier.
Maximal Margin Classifier
• We can label the observations from the blue class as yi = 1 and
those from the purple class as yi = -1. Then a separating
hyperplane has the property that
The Maximal Margin Classifier
• The maximal margin hyperplane is the separating hyperplane for which
the margin is largest—
• that is, it is the hyperplane that has the farthest minimum distance to
the training observations.
• We can then classify a test observation based on which side of the
maximal margin hyperplane it lies.
• This is known as the maximal margin classifier.
The Non-separable Case
• However, we can extend the concept of a separating hyperplane in
order to develop a hyperplane that almost separates the classes,
using a so-called soft margin.