What are kernels in machine learning and SVM and why do we need them?

Simply the best explanation of SVM i ever found.
----------------------------------------------------------------------------------------------
We have 2 colors of balls on the table that we want to separate.
We get a stick and put it on the table, this works pretty well right?
Some villain comes and places more balls on the table, it kind of works but one of the balls is on the wrong side and there is probably a better place to put the stick now.
SVMs try to put the stick in the best possible place by having as big a gap on either side of the stick as possible.
Now when the villain returns the stick is still in a pretty good spot.
There is another trick in the SVM toolbox that is even more important. Say the villain has seen how good you are with a stick so he gives you a new challenge.
There’s no stick in the world that will let you split those balls well, so what do you do? You flip the table of course! Throwing the balls into the air. Then, with your pro ninja skills, you grab a sheet of paper and slip it between the balls.
Now, looking at the balls from where the villain is standing, they balls will look split by some curvy line.
Boring adults the call balls data, the stick a classifier, the biggest gap trick optimization, call flipping the table kernelling and the piece of paper a hyperplane.
-----------------------------------------------------------------------------------------------
Now see this:
--------------------------------------------------------------------------------------------
One other point that I like to mention about the SVM (unrelated to this question) is how it is defined by the boundary case examples. (taken from CS109 course:SVM Explanation)
Assume you want to separate Apples from oranges using SVM. The Red square are Apples and the blue circles are oranges.
Now see the support vectors(The filled Points) which define the margin here.
Intuitively the filled Blue circle is an Orange that looks very much like an Apple. While the filled Red squares are Apples that very much look like oranges.
Think for this another time. If you would want your kid to learn to differentiate between an apple and orange you would show him a perfect apple and a perfect orange. But not SVMs they want to only see an apple that looks like an orange and vice versa. This approach is very different from how most Machine learning algorithms operate, and maybe thats why it works so well in some cases.
If you want to learn more about Data Science and Machine Learning, I would like to call out this excellent course by Andrew Ng. This was the one that got me started. Do check it out.
Also, I will continue writing beginner friendly data science posts. Follow me up at Medium or Subscribe to my blog to be informed about them.

Comments

Popular posts from this blog

Maxpooling vs minpooling vs average pooling

Generative AI - Prompting with purpose: The RACE framework for data analysis

Best Practices for Storing and Loading JSON Objects from a Large SQL Server Table Using .NET Core