<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by A Man Kumar on Medium]]></title>
        <description><![CDATA[Stories by A Man Kumar on Medium]]></description>
        <link>https://medium.com/@myselfaman12345?source=rss-b8cb17d05018------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*oex2rI94WTOCLcwMh_9xng.jpeg</url>
            <title>Stories by A Man Kumar on Medium</title>
            <link>https://medium.com/@myselfaman12345?source=rss-b8cb17d05018------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 01:35:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@myselfaman12345/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[C and Gamma in SVM]]></title>
            <link>https://medium.com/@myselfaman12345/c-and-gamma-in-svm-e6cee48626be?source=rss-b8cb17d05018------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6cee48626be</guid>
            <category><![CDATA[svm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[A Man Kumar]]></dc:creator>
            <pubDate>Mon, 17 Dec 2018 14:17:16 GMT</pubDate>
            <atom:updated>2018-12-17T14:17:16.840Z</atom:updated>
            <content:encoded><![CDATA[<p>I assume you know about SVM a little bit. But I am going to cover an overview of SVM.</p><p>What is our goal for SVM?</p><p>Answer: To find the best point(in 1-D), line(in 2-D), plane(3-D), hyperplane(in more than 3-D) to separate the classes. Have a look below image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK11R1QHxP0vxxAotAcdgg.jpeg" /></figure><p>But it is separable dataset but when we have non-separable dataset then what will do?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FC4-6ahYVhM1dJGcK5T9FA.jpeg" /></figure><p>In the above image if we choose A then we are getting two errors but if we choose B we do not get any error. But do you think B is the right choice to make a decision boundary? off course NO. A looks better decision boundary even if we are having the errors. In this image, you noticed that error play an important role in SVM.</p><p>So in this Blog, Our objective is how to find better C and Gamma.</p><p>Before going to find better C and Gamma. Let me introduce what are C and Gamma.</p><h4>What is C ?</h4><p>C- It is a hypermeter in SVM to control error. What does that mean to control error or margin? Let’s understand with visualization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*41AH2g04MckoTYdsJg_V_w.png" /></figure><p>You can see if we have low C means low error and if we have large C means large error.</p><p>In low C we have only one error but in case of large C, we have four errors.</p><p>let’s see some other dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oQoJMQ6yWGjeTGyReod7zw.jpeg" /></figure><p>In the above image, when we choose low C we have no error but in case of high C, we have two errors. but B or low C is not the best decision boundary. A looks better decision boundary. So you can observe that low C or less error does not mean better decision boundary.</p><p>let’s see one more example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a-S3nBN8MvfeM8UDzYCFtw.jpeg" /></figure><p>in the above image, we can see that low C means low error, medium C means medium error and large C means high error. And here medium C giving is the better model.</p><p>So what we have learnt so far that low C less error and large C high error. Note that it does not mean that low error means we have a good model. It totally depends upon on datasets that how much error dataset consists. There is no thumb of rules that low C will work always or high C or medium C.</p><p>So now so far we have learnt that what is C and how it can be used. Now let’s move to Gamma.</p><h4>What is Gamma?</h4><p>Gamma is used when we use the Gaussian RBF kernel. if you use linear or polynomial kernel then you do not need gamma only you need C hypermeter. Somewhere it is also used as sigma. Actually, sigma and gamma are related. That relation is below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e0egz03XaEpnrljHhkkz-Q.jpeg" /></figure><p>So here Gamma and sigma are the same things.</p><p>Gamma is a hyperparameter which we have to set before training model. Gamma decides that how much curvature we want in a decision boundary.</p><p>Gamma high means more curvature.</p><p>Gamma low means less curvature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cEGzYstJlRDQMv8rNcDk4g.jpeg" /></figure><p>As you can see above image if we have high gamma means more curvature and if we have low gamma then less curvature.</p><p>So the question is when we should tune high or low gamma?</p><p>The answer is it totally depend upon data to data.</p><p>So till here, we have learnt Gamma and C.let’s recap what we have learnt yet.</p><p>C is a hypermeter which is set before the training model and used to control error and Gamma is also a hypermeter which is set before the training model and used to give curvature weight of the decision boundary.</p><p>For choosing C we generally choose the value like 0.001, 0.01, 0.1, 1, 10, 100</p><p>and same for Gamma 0.001, 0.01, 0.1, 1, 10, 100</p><p>we use C and Gammas as grid search. See below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4bHVLc6fOEOv2CDbSgbYQA.jpeg" /></figure><p>Above image shows how grid search works. the set which gives the better result we choose that value of Gamma and C.</p><p>I hope you understood what is C and Gamma and how it can be used to train model.</p><p>if you like this article please give a clap. It motivates me to write more blog.</p><p>Thanks for Reading.</p><p>Credit: <a href="http://www.appliedaicourse.com/">www.appliedaicourse.com</a> and his team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6cee48626be" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>