SVM Algorithm

SVM Algorithm (Support Vector Machine)

Introduction

The goal of the SVM algorithm is to create a better line or decision boundary that divides the n-dimensional space into classes so that in the future we can easily incorporate new data points into the right category. This best decision boundary is called the hyperplane.

SVM selects the extreme points / vectors that will help create the hyperplane. These extreme cases are called support vectors, hence the algorithm is called the support vector machine. Do you want to study more about data science? you can check out Data Science training in Kochi.

Here are the rules:

– Inputs can be scalars, vectors or matrices.

– The linear combinations of inputs that span all training vectors are used as expected outputs.

– For scalars this means that a single point makes up an input vector and all other points make up a single output vector for each class you want to predict (example: if you want to predict “A” versus “B” with both having values 0 and 1, then you could use 5 as your first input and 1 as your second input).

– The value of an expected output is determined by that single point’s position on the input vector.

– If no decision boundary separates the two classes, then all values of expected outputs are equally likely. This means that if you only have a single point in your input vector, then you cannot predict with high confidence what class that point belongs to.

– For vectors and matrices this means that you have multiple points (inputs) making up each class’ vector of expected values, but all other points (that do not span the entire space) make up a single output for each class.

For example, if you want to predict the probability of a house being a “B” or a “C”, where both house values are in range of [0,1], then you can use 5’s coefficients as the first input, and allow all other points in your input space (all non-zero values except 5) to contribute to your output vector.

If you want to separate two classes that could be further separated by more terms than this model can handle (ex: if there are three classes with vectors of coeffiecients and you keep only the first two), then SVM is not suited because the linear combinations of inputs with higher exponents will still intersect at some point.

– In this case you would need something like K-NN, which will use all the points and their labels in your data set and try to classify them by how far they are from each other (ex: for two classes , if the mean label of a point is greater than 75% than class A, then it is closer to class A).

– For linear data sets (where all inputs are 0 or 1), if you want to evaluate your model’s accuracy on unseen data, then use the following equation to find the probability for a given label that was unseen in training: . This assumes that your data values fall in range of 0 to 1. In this case SVM can be used as a classifier.

Example

Conclusion

--

--

A Content marketing enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store