Professional Documents
Culture Documents
MACHINE
Prof. Subodh Kumar Mohanty
The idea of support vectors and its
importance
Introduction
• The support vector machine is currently considered to be the best off-the-
shelf learning algorithm and has been applied successfully in various
domains.
• Support vector machines were originally designed for binary classification.
• Then, it is extended to solve multi-class and regression problems.
• But, it is widely used in classification objectives.
• The objective of the support vector machine algorithm is to find a hyperplane
in an N-dimensional space (N — the number of features) that distinctly
classifies the data points.
• To separate the two classes of data points, there are many possible
hyperplanes that could be chosen. Our objective is to find a plane that
has the maximum margin, i.e the maximum distance between data
points of both classes.
Possible
hyperplanes
• Maximizing the margin distance provides some reinforcement so that
future data points can be classified with more confidence.
Possible
hyperplanes
• Maximizing the margin distance provides some reinforcement so that
future data points can be classified with more confidence.
• The goal is to 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.
• Hyperplanes are decision boundaries that help classify the data points.
• Data points falling on either side of the hyperplane can be attributed to
different classes.
• Also, the dimension of the hyperplane depends upon the number of
features.
• It becomes difficult to imagine when the number of features exceeds 3.
• Support vectors are data points that are closer to the hyperplane and
influence the position and orientation of the hyperplane.
• Using these support vectors, we maximize the margin of the classifier.
• Deleting the support vectors will change the position of the hyperplane.
• These are the points that help us build our SVM (that works for a
new/test data).
• In order to classify a dataset like the one above it’s necessary to move
away from a 2d view of the data to a 3d view.
• Explaining this is easiest with another simplified example.
• Imagine that our two sets of colored balls above are sitting on a sheet
and this sheet is lifted suddenly, launching the balls into the air.
• While the balls are up in the air, you use the sheet to separate them.
• This ‘lifting’ of the balls represents the mapping of data into a higher
dimension.
Cons
• Isn’t suited to larger datasets as the training time with SVMs can be high
• Less effective on noisier datasets with overlapping classes
Applications
• SVM is used for text classification tasks such as category assignment,
detecting spam and sentiment analysis.
• It is also commonly used for image recognition challenges, performing
particularly well in aspect-based recognition and color-based
classification.
• SVM also plays a vital role in many areas of handwritten digit
recognition, such as postal automation services.
Derivation of Support Vector Equation
Comparison with logistic regression
Training set:
m examples
Sigmoid function
Hyperplane separates the feature space into two half space and
Linear Maximal Margin Classifier for
Linearly Separable Data
• For linearly separable, many hyperplanes exist to perfrom separation.
• SVM framework tells which hyperplane is best.
• Hyperplane with the largest margin which minimizes training error.
• Select the decision boundary that is far away from both the classes.
• Large margin separation is expected to yield good generalization.
• in wTx + w0 = 0, w defines a direction perpendicular to the hyperplane.
• w is called the normal vector (or simply normal) of the hyperplane.
• Without changing the normal vector w, varying w0 moves the
hyperplane parallel to itself.
test data point test data point
(will be predicted as square) (will be predicted as circle)
such that
or equivalently,
ii.
iii.
iv.
After solving the dual problem numerically, the resulting optimum
values are used to compute and using the KKT conditions.
• w is computed using condition (i) of KKT conditions
• from, condition (iii), it can be said that Very small percentage have
• most among N, vanish with = 0.
• whose are the support vectors and they lie on the margin.
• w is the weighted sum of these training instances that are selected as the
support vectors:
Penalize the errors by assigning extra cost and change the objective
function to
where,
‘σ’ is the variance and our hyperparameter
||X₁ - X₂|| is the Euclidean (L₂-norm) Distance between two points X₁ and X₂
Radial Basis Kernel
• The maximum value that the RBF kernel can get is 1 and occurs when d₁₂ is
0 which is when the points are the same, i.e. X₁ = X₂.
• When the points are the same, there is no distance between them and
therefore they are extremely similar.
• When the points are separated by a large distance, then the kernel value is
less than 1 and close to 0 which would mean that the points are dissimilar.
• There are no golden rules for determining which admissible kernel will
result in the most accurate SVM.
• In practice, the kernel chosen does not generally make a large difference in
resulting accuracy.
• SVM training always finds a global solution, unlike neural networks (to be
discussed in the next chapter) where many local minima usually exist.