{"id":172122,"date":"2026-01-28T13:13:09","date_gmt":"2026-01-28T12:13:09","guid":{"rendered":"https:\/\/liora.io\/en\/?p=172122"},"modified":"2026-02-06T07:21:57","modified_gmt":"2026-02-06T06:21:57","slug":"svm-support-vector-machines-unveiled-understanding-implementation-significance","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/svm-support-vector-machines-unveiled-understanding-implementation-significance","title":{"rendered":"SVM (Support Vector Machines) Unveiled: Understanding, Implementation, Significance"},"content":{"rendered":"<h2 class=\"wp-block-heading\" id=\"h-welcome-to-the-first-part-of-this-mini-series-dedicated-to-svm\">Welcome to the first part of this mini-series dedicated to SVM. <\/h2>\t\t\n\t\t<p>When we think of <a href=\"https:\/\/liora.io\/en\/machine-learning-engineer-all-about-the-job\">Machine Learning,<\/a> we generally think of recent methods that are still poorly understood and used empirically, like a sorcerer&#8217;s apprentice.<\/p><p>Indeed, genetic algorithms, <a href=\"https:\/\/liora.io\/en\/convolutional-neural-network-everything-you-need-to-know\">neural networks,<\/a> boosting&#8230; these algorithms are often described as &#8220;black boxes&#8221;. In other words, while it&#8217;s easy to comment on the input and output of the algorithm independently, when it comes to detailing the exact contribution of each input to the final result, it&#8217;s a different kettle of fish. Blame it on too many parameters, the use of random events&#8230;<\/p><p>Nevertheless, among this <a href=\"https:\/\/liora.io\/en\/algorithm-what-is-it\">myriad of algorithms,<\/a> each more complex than the last, there is one whose advanced age belies its effectiveness and simplicity.<\/p><p>Conceptualized by Vladimir Vapnik in the early 60s, it entered the computer world in 1990. Since then, it has become a reference for all those interested in supervised learning techniques. Even today, it continues to be taught, studied and widely used. As you may have gathered, we&#8217;re talking about <strong>Support Vector Machines (SVM).<\/strong><\/p><p><strong>\u26a0\ufe0fWarning:<\/strong> talking about the simplicity of such an algorithm is like talking about the smallness of the Moon. We know it&#8217;s small compared with its surroundings, but we couldn&#8217;t possibly walk around it.<\/p><p>This article will be divided into 2 parts. In the first, we&#8217;ll introduce you to the basic principle of Margin Classifiers, and their limitations.<\/p><p>In the second part, we&#8217;ll go into more detail about SVMs, with the aim of providing an overview of how they work.<\/p>\t\t\n\t\t\t<h3 class=\"wp-block-heading\" id=\"h-maximal-margin-classifiers\">Maximal Margin Classifiers<\/h3>\t\t\n\t\t<p>As is often the case in science, before tackling the problem as such, we prefer to study a particular case, which is simpler to solve. So we&#8217;ll begin this presentation with a study of a cousin of <strong>SVMs, Maximal Margin Classifiers.<\/strong><\/p><p>Suppose we have a dataset containing 2 types of observations: &#8220;+&#8221; and &#8220;-&#8220;. Our objective is to be able to predict the class (&#8220;+&#8221; or &#8220;-&#8220;) of a new observation, represented here by an &#8220;x&#8221;.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"349\" height=\"231\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm.png\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm.png 349w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm-300x199.png 300w\" sizes=\"(max-width: 349px) 100vw, 349px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>Instinctively, we understand that the observation should be classified as a &#8220;-&#8221; here. But it&#8217;s difficult to explain the reasons why.<\/p><p>We&#8217;ll apply the <strong>following method:<\/strong><\/p><p>Draw a straight line separating the 2 classes. If the observation lies above this line, we&#8217;ll call it a &#8220;+&#8221;, otherwise a &#8220;-&#8220;. Here, for example, observation &#8220;x&#8221; is above the line, so it&#8217;s a &#8220;-&#8220;.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"349\" height=\"231\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm2.png\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm2.png 349w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm2-300x199.png 300w\" sizes=\"(max-width: 349px) 100vw, 349px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>The method seems to work well. However, in the particular case of our problem, there are an infinite number of straight lines perfectly separating the 2 sets.<\/p><p>Each of them delimits a different space and represents a different answer to the problem. The question is how to choose the best straight line from all the possible ones.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"349\" height=\"231\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm3.png\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm3.png 349w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm3-300x199.png 300w\" sizes=\"(max-width: 349px) 100vw, 349px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>On the previous figure, it seems logical to say that the central line separates the data better than the other 2. Indeed, as it is far from both the &#8220;+&#8221; and the &#8220;-&#8220;, it is unlikely to classify an observation in one class when it is actually very close to the other.<\/p><p>In <strong>mathematics, the distance separating a straight line from the nearest observation is called the margin.<\/strong> The central straight line has a larger margin than the other two.<\/p><p>In other words, the straight line that best separates the 2 classes is the one with the highest margin. Do you now understand where the term &#8220;Maximal Margin Classifiers&#8221; comes from?<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"349\" height=\"231\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm4.png\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm4.png 349w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm4-300x199.png 300w\" sizes=\"(max-width: 349px) 100vw, 349px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>In our example, the continuous line is the best separating line. The margin, shown as a dotted line, is maximum. You&#8217;ll have noticed that the same distance separates the straight line from the 3 nearest observations. This is a<strong> characteristic that is systematically found for the best straight line.<\/strong><\/p><p>The <strong>Maximal Margin Classifier<\/strong> algorithm uses this method to calculate the best straight line.<\/p><p>What&#8217;s important to remember from this introduction is that it&#8217;s enough to find the line with the largest margin to be <a href=\"https:\/\/liora.io\/en\/management-of-unbalanced-classification-problems-ii\">able to classify all new observations.<\/a><\/p><p>What&#8217;s more, when it exists, it&#8217;s relatively simple to calculate the equation of the separation line (if you&#8217;re interested in the details of the calculations, I recommend the MIT OpenCourseWare video, which deals precisely with this subject .<\/p><p>This is a quick and easy way to answer the problem at hand.<\/p><p>However, the method we&#8217;ve just seen has two major shortcomings. It is highly sensitive to extreme values (also known as outliers).<\/p><p>The arrival of an outlier (the highest &#8220;-&#8220;) completely disrupts the result.<\/p><p>Worse still, in case you were wondering: No, there isn&#8217;t always a straight line separating the 2 classes perfectly. This is the case, for example, in the following image:<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"349\" height=\"231\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm6.png\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm6.png 349w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/10\/svm6-300x199.png 300w\" sizes=\"(max-width: 349px) 100vw, 349px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>In the end, we end up with an algorithm that, in some cases, doesn&#8217;t work at all.<\/p><p>In the next article dedicated to SVMs, we&#8217;ll look at how we can give our algorithm more flexibility, by <a href=\"https:\/\/liora.io\/en\/management-of-unbalanced-classification-problems-i\">allowing it to make a few classification errors, to improve its overall performance.<\/a><\/p><p>Are you interested in Machine Learning techniques? Would you like to learn how to master them? Our data science training courses are just what you need!<\/p>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Discover our courses<\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to the first part of this mini-series dedicated to SVM. When we think of Machine Learning, we generally think of recent methods that are still poorly understood and used empirically, like a sorcerer\u2019s apprentice. Indeed, genetic algorithms, neural networks, boosting\u2026 these algorithms are often described as \u201cblack boxes\u201d. In other words, while it\u2019s easy [\u2026]<\/p>\n","protected":false},"author":78,"featured_media":172124,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2433],"class_list":["post-172122","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/172122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=172122"}],"version-history":[{"count":3,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/172122\/revisions"}],"predecessor-version":[{"id":205304,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/172122\/revisions\/205304"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/172124"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=172122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=172122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}