<?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 Sameer Negi on Medium]]></title>
        <description><![CDATA[Stories by Sameer Negi on Medium]]></description>
        <link>https://medium.com/@sameer-negi17?source=rss-1774d3ff6ea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5cPHOt053EveTpoI0ra-GQ.png</url>
            <title>Stories by Sameer Negi on Medium</title>
            <link>https://medium.com/@sameer-negi17?source=rss-1774d3ff6ea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 19:15:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sameer-negi17/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[Check what’s within You : Poem by Lavanya Khamitkar]]></title>
            <link>https://sameer-negi17.medium.com/check-whats-within-you-poem-by-lavanya-khamitkar-ef2b1ec4d836?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef2b1ec4d836</guid>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Fri, 18 Dec 2020 07:39:14 GMT</pubDate>
            <atom:updated>2020-12-18T07:39:14.038Z</atom:updated>
            <content:encoded><![CDATA[<h3>Check what’s within You : Poem by Lavanya Khamitkar</h3><p>Usually we call each other a‘<strong>bitch</strong>’….<br>girls all here do ….<br>for you sitting over there….<br>a hard truth to dissolve…<br>Moreover teenagers, adolescent call each other a bitch…<br>Criticize or speak of slander ….<br>Ahem ahem …!<br>Does they posses the quality of a bitch as in a female dog?</p><p>Just a slang or a cuesta or gamester ….<br>let’s analyze…<br>Wearing short outfits…<br>Red lipstick …<br>Dressing up irregular…<br>Different opinions than crowd..<br>Boozing like “a man”<br>Having more “guy friends”<br>Whatever be in millions ..<br>For instance -<br>I enjoy, behave because it is my essence;my persona…<br>I cannot carry or hook up to people opinions or their lifestyle..<br>Just because I am “the one who defines me”<br>Why should I drop one n get over it for being a different me…<br>To strut or gloat..<br>Makes no sense…<br>Right ??<br>When someone asks you to change yourself for them you deny or at times you adapt but not to the core or liking …<br>Same way …<br>I do !!<br>then why am I called “a bitch”</p><p>Certainly because I have an divergent opinion …<br>My behavior is strange, odd or peculiar …<br>But I hope it can’t be a bizarre to public …<br>Neither strange calling it a taboo…<br>Evidently I don’t give a shit whatsoever…<br>So stop having an opinion about me …<br>No verdict please…<br>because I need not rely on that public conclude by hearing opinions of me instead comprehending …<br>I know when to reciprocate,<br>and when to depart..<br>When to have a refinement,<br>and it makes me a distinct one.<br>To A small town , I belong !<br>Were these things make people offensive for bounds…<br>But out their is a big cosmos, who appreciate being straightforward; living yolo<br>The true one ! Not the masked one …!<br>because I don’t wanna be the one in a crowd,<br>Rather make a move to stand out.<br>Being judgmental is people’s business out there..<br>So we can’t help if people miss you or want to be with you, living oblivion always helps you, Crazy but true ..<br>Bitter but evident..<br>Acrid but dope…<br>I realized it when I crossed thresholds with people across the cosmos…<br>Yesss…<br>people like me and you exists …<br>Don’t feel like you are the one who is sad or being judged out their or someone always make you feel inferior …<br>It is just the time; which passes and you need to stay strong to take views, criticism <br>and you are not the only one in the world.<br>WHEN IN ROME DO AS THE ROMANS DO<br>True said</p><p>But till a mark I can change and even you can for something better in us..<br>Change is the human nature …<br>Go with the flow<br>Adios …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef2b1ec4d836" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming Fundamentals: Data Types]]></title>
            <link>https://medium.datadriveninvestor.com/programming-fundamentals-data-types-29ca0bd1431d?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/29ca0bd1431d</guid>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[exam-preparation]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 20:54:55 GMT</pubDate>
            <atom:updated>2020-04-10T06:51:28.493Z</atom:updated>
            <content:encoded><![CDATA[<h3>Interview Question on Data Types</h3><p>Everything in this world has mass. It occupies space. Most of them has a name. We place them in category. This is true for in programming as well.</p><p>We will cover all the post in Question &amp; Answer format because it will be helpful for your future Interviews. For a detailed explanation I will provide the youtube link.</p><p><strong>What are Fundamental Datatypes and their memory size?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*IAdAWvi3C-Df7IhQNvl_0g.png" /><figcaption>Reference : <a href="https://www.geeksforgeeks.org/">GeeksforGeeks</a>.org</figcaption></figure><p>To understand everything with the C++ example you can go through the below video. This video explains every concept with a detailed explanation and examples.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDlzm4aful_w%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDlzm4aful_w&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDlzm4aful_w%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/541a663247447334fcfd7381289c91e1/href">https://medium.com/media/541a663247447334fcfd7381289c91e1/href</a></iframe><p><strong>What is the difference between signed and unsigned?</strong></p><p>The answer is simple. The Most significant bit(MSB) is reserved for storing signs. In case of unsigned it is used for storing value.</p><p>The above answers involves binary representation of decimal. It’s recommended to go through the below video for revision on the conversion of binary to decimal and decimal to binary.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fcj2d4YdPIHo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dcj2d4YdPIHo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fcj2d4YdPIHo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5156047f2ad02cc46779bf16fcca7407/href">https://medium.com/media/5156047f2ad02cc46779bf16fcca7407/href</a></iframe><p><strong>What is minimum value of any unsigned Datatype?</strong></p><p>It will always be zero. You can also check it with the use of “std::numeric_limits&lt;unsigned short&gt;::max()” in the limits library C++.</p><p><strong>How can we determine the memory size of datatype?</strong></p><ul><li>In C++ using<strong> sizeof()</strong> operator.</li><li>In python using sys.getsizeof(x).</li></ul><p><strong>How can we declare variable that do not change through out the program?</strong></p><p>Const keyword</p><p><strong>What is the difference between const and constexpr?</strong></p><p>const keyword is evaluated at run time while constexpr at compile time. If you already know the value it’s is always recommended to use constexpr because it will save your runtime.</p><p>If you using Windows and you have problem setting up the g++ compiler. This video explains How to setup C++ Compiler in windows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FODAPvaUcL_Y%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DODAPvaUcL_Y&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FODAPvaUcL_Y%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/abffc9a1cf0e8204919d20194d3d2d8e/href">https://medium.com/media/abffc9a1cf0e8204919d20194d3d2d8e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29ca0bd1431d" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/programming-fundamentals-data-types-29ca0bd1431d">Programming Fundamentals: Data Types</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming Overview]]></title>
            <link>https://sameer-negi17.medium.com/programming-overview-125eb4df21fa?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/125eb4df21fa</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[c-plus-plus-language]]></category>
            <category><![CDATA[career-advice]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 10:00:12 GMT</pubDate>
            <atom:updated>2020-04-07T10:00:12.734Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This post is very important for the people who is starting their IT career or in the initial stages of their career.</blockquote><blockquote><strong>What is Program?</strong></blockquote><p>Are you stuck for a moment to think. It happens for me also. Lets rewind, “Program is a collection of instruction”. It is simple as that. For example :</p><p>If I say I need to drink water, What I will do?</p><ul><li>Go to the kitchen</li><li>Take a glass.</li><li>Open the tap</li><li>Fill glass with water.</li><li>Drink it.</li><li>Place the glass in the sink.</li></ul><p>There may be more steps involved if you want to drink from refrigerator or bottle. In this case we have set of instruction and this is a program. We have programmed our brain to follow these instruction when you feel thirsty.</p><p>In the same way, you provide set of instruction to computer to perform particular task. These set of instruction are know as <strong>computer program.</strong></p><p><strong>Programming </strong>is way to instruct the computer the perform the particular task. Now the most important question.</p><p><strong>Why Programming?</strong></p><p>Because to utilize the power of computer. Yes, indeed today everything is intelligent why not utilize their power. You use calculator right?. It is also programmed to perform basic mathematics calculation. It has made our life so much easier. We do programming to make our life easier.</p><blockquote><strong>Do you know</strong> the first fully functional computer is known as Electronic Numeric Integrator and Computer (ENIAC) was created in 1940’s . John Mauchly’s Short Code, proposed in 1949, was one of the first high-level languages ever developed for an electronic computer.</blockquote><p>In modern times, We work in Object Oriented Programming. We have so many language such as C,C++, Java, C#, Python, Angular etc. Every language has its own merits and demerits. As C is not object oriented. C++ is faster on hardware then any other language. Python is very user friendly language. With Angular Web Development is so easy. Its time to answer one more question.</p><p><strong>Which language should I choose?</strong></p><p>The answer is very simple. <strong>None. </strong>Do not choose any language. Always focus on programming. In my experience. I would say I have worked on the most of language I mentioned. The difference is negligible.</p><p>To give you an example I will create program to add to number in 3 different languages :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*qiAEAThGh0b6pwOY9gZCFQ.png" /><figcaption>C++ Example</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*680ChRXTDeLxZP_kziOM0w.png" /><figcaption>Python Example</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*n-ow424miDCfPQGdbO96RA.png" /><figcaption>Java Example</figcaption></figure><p>You may notice that syntax is different but the logic use to write the code is same. We also called this logic <strong>Pseudo Code.</strong></p><p><strong>Pseudo Code </strong>for adding two numbers</p><ul><li>Initialize two numbers a,b.</li><li>Add and Print them.</li></ul><p>See pretty Simple. Isn’t it? You can implement it in any language you want. So we will always learn the logic not the language. In that way we will be language Independent.</p><p>Let’s see one more example :</p><p><strong>Pseudo Code </strong>to check whether number is divisible by 2 or not.</p><ul><li>Initialize number a.</li><li>if a leaves reminder zero. Then, number is divisible</li><li>else not divisible.</li></ul><p>Lets implement it in Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*WTO_FSJcxuR1dH066rV3hA.png" /></figure><p>Always try understanding the pseudo code. Languages are just syntax which can be learnt anytime.</p><p>To read my inspiration. Please read <a href="https://medium.com/@sameer.negi17/programming-from-the-scratch-a1d66bb50670"><strong>Programming from Scratch</strong></a><strong>.</strong></p><p>I will write subsequent post. Explaining different concepts and fundamentals of language. I will use C++ as my primary language but i will definitely share the examples in all languages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=125eb4df21fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming From the Scratch]]></title>
            <link>https://medium.datadriveninvestor.com/programming-from-the-scratch-a1d66bb50670?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1d66bb50670</guid>
            <category><![CDATA[c-plus-plus-language]]></category>
            <category><![CDATA[interview-preparation]]></category>
            <category><![CDATA[programming-tutorials]]></category>
            <category><![CDATA[amazon-interview]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 06:45:02 GMT</pubDate>
            <atom:updated>2020-04-08T11:09:59.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*wAd3FIeypb3SieQY5A8qjg.png" /></figure><p>Hello, I did a lot of thinking in the past few days. I came to the conclusion that writing this post is important. You may wonder Why?</p><p>I got rejected by Amazon. This is one of the biggest disappointment in life. The reason behind this is I am an average developer and human who forgets things as he grows. The question’s which were asked to me were very basic like “What is the complexity of insertion and deletion in Array” or “What is stack and queue?”. Did I really answer them wrong? They will never tell you the reason of rejection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*BWrDqJwmtoHSlhRUrJE7Kw.png" /></figure><p>So, I decided to start the <strong>programming from scratch. </strong>I would have done it alone but my idea is to create a world where someone else doesn’t feel disappointed because of the same reason. I have decided to do a video lecture series on youtube as well as post series on medium. Video lectures will be more detailed while post will be for quick revision. So if you have an interview in a week you can go through the posts. So you will have your basic cleared.</p><p><a href="https://www.datadriveninvestor.com/2020/02/26/surviving-in-a-digital-age-of-instability/">Surviving In A Digital Age of Instability | Data Driven Investor</a></p><p>Next important thing is that it doesn&#39;t matter which general-purpose programming language you are using. You can still use the post for revision because they will be language-independent while video lectures will be made using C++. So if you want the same lecture in any other language. Do write in the comment section of the Video.</p><p>I will start with writing down the question which was asked to me in the <em>amazon phone interview.</em></p><ul><li>What is the difference between stack and queue?</li><li>What is hashing?</li><li>What is the problem if you don’t have good hashing function?</li><li>What is binary search tree?</li><li>How to delete a node in Binary Search tree?</li><li>If you give you <em>n</em> words and ask you find that which of those <em>n</em> words contains ‘x’ as character. What will the complexity of the program?</li><li>What is the insertion and deletion complexity of the fixed size array?</li></ul><p>You may feel the these question are heavily focused on Data structures but to understand them and their operation who should have your basics cleared to the core.</p><p>We will go through these subsequent topics in the next of series of the posts.</p><p>About me, I have programmed in C++, python, C, C# and Java. I feel C++ 11/14 are really good. So I will using it in the videos.</p><p>I will using Windows. So below is the C++ setup for windows that I will be using.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPLmqx-lXJtuZpqVo3qP-VhTA3Fj98E2JpH&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fplaylist%3Flist%3DPLmqx-lXJtuZpqVo3qP-VhTA3Fj98E2JpH&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FODAPvaUcL_Y%2Fhqdefault.jpg%3Fsqp%3D-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ%3D%3D%26rs%3DAOn4CLD4O64tGOhEWApGmqUmE4otTz8zYQ&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="853" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb8e45e519540cf92a7435f1e296e2f7/href">https://medium.com/media/bb8e45e519540cf92a7435f1e296e2f7/href</a></iframe><p>Please feel free to ask any questions. You can comment the question here as well as in youtube.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1d66bb50670" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/programming-from-the-scratch-a1d66bb50670">Programming From the Scratch</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Regression — Detailed Overview]]></title>
            <link>https://medium.com/data-science/linear-regression-cost-function-gradient-descent-normal-equations-1d2a6c878e2c?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d2a6c878e2c</guid>
            <category><![CDATA[cost-function]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[normal-equation]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Wed, 05 Sep 2018 19:20:10 GMT</pubDate>
            <atom:updated>2018-09-21T04:02:23.392Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aTPoc2vSaWmEOV9BuGvSQA.jpeg" /></figure><p>Someone asked me <strong><em>Why we use use Linear Regression? </em></strong>I answered, for <em>Prediction. </em>He asked me again<em> </em><strong><em>What is Prediction? </em></strong><em>I answered with a situation “Suppose you and me are walking on a road. We came across crossroads, now I tell you that we will go straight. This happens five times. Now on sixth crossroad. I ask you which way we will go. Your answer will be, we will go straight. This what you said is called prediction. </em>He asked me the next question<em> </em><strong><em>How did we do it? </em></strong><em>I explained, we looked at data or in this case my previous responses whenever we are at a crossroad and considering that we assumed that we will go straight.</em></p><p><strong>What is Linear Regression? </strong>It is an approach for modelling the relationship between dependent variable and independent variables . Again a question <strong>What are independent and dependent variables? </strong>Now the below image have some data regarding houses. We have “area of the house” and “cost of the house”. We can see that cost is dependent on area of the house as when the area increases cost will also increase and when area decreases the cost will also decrease. So we can say that <strong>cost is a dependent variable </strong>and <strong>area is an independent variable. </strong>With the help of linear Regression we will model this relationship between cost of the house and area of the house.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acnkShA4mP-hgb6WRdu50Q.jpeg" /><figcaption>Figure 1 : Example of House(Area vs Cost) Data set</figcaption></figure><p>The best way to model this relationship is to plot a graph between the cost and area of the house. The<em> area of the house is represented in the X-axis </em>while <em>cost is represented in Y-axis</em>. <strong>What will Regression Do? </strong>It will try to fit the line through these points. Left image shows the plotted points and Right image shows the line fitting the points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*lTyBbkKdamCPZHKK_3GIGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*593Bs3WSAfj0hep-iKEHoQ.png" /><figcaption>Figure 2 :Plotting Area of the house (X-axis) Vs Cost of house(Y-axis)</figcaption></figure><p>If we want to predict the cost of the house which has housing area of 1100 sq feet with the help of above image it can be done as shown in the below image As you can see the cost of 1100 sq feet house is near about 35.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*pZWTFluevbzwz3meXMreCg.png" /><figcaption>Figure 3 : Finding Cost of House when Area of house is 1100sq feet</figcaption></figure><p>Before going deeper we should understand some terms which I will be going to use for derivation and explaining mathematical interpretation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gmMomcMk4Ji9G9XIo1s0Cw.jpeg" /><figcaption>Figure 4: Terms and Notations</figcaption></figure><ul><li>M := training samples</li><li>x := input feature/variables. These can be more then one.</li><li>y := output feature/variables.</li><li>(x,y) := training example. Eg: (1000,30)</li></ul><p><strong>How is this line is represented mathematically?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*SxNfr8CMyy8MMx4lfVeMZg.png" /><figcaption><strong>Figure 5: Hypothesis h(x)</strong></figcaption></figure><p>h(x) represents the line mathematically as for now we have only one input feature the equation will be linear equation and it also resembles the line equation <em>“Y = mx + c” . </em>Now we will see what effect does choosing the value of theta will have on line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*bHy7xK_lPzci6nxV2YbaIA.png" /><figcaption><strong>Figure 6 : The value of theta will have effect the slope and intercept of the line. As you can in left and right images.</strong></figcaption></figure><p><strong>Why Linear? </strong>Linear is the basic building block. We will get into more complex problems later which may require use of non linear functions or high degree polynomial</p><p><strong>How to best fit our Data? </strong>To best fit our data we have to choose the value of theta’s such that the difference between h(x) and y is minimum. To calculate this we will define a error function. As you can see in the below right image. -</p><ul><li>Error function is defined by the difference between h(x) — y.</li><li>We are taking absolute error as square of the error because some points are above and below the line.</li><li>To take the error of all points we used Summation.</li><li>Averaged and then divided by 2 to make the calculation easier. It will have no effect on overall error.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*CJ0dQt7kyCXXVjyYstMKFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*iPm0_9Erx2q-HOAbjVUaEQ.png" /><figcaption>Figure 7 : Error Function Derivation(source : <a href="http://www.google.com/images)">www.google.com/images)</a></figcaption></figure><p>Now to visualize the relationship between Theta and Error Function(J). We will plot a graph between theta and Error function. The bottom right image shows the graph where X-axis will represent the theta and Y-axis will represent the J(theta), error function. We will assume the Theta0 will be zero. It means the line will always pass through through origin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*a-2sKKrIdXBpcT-sNefqUA.png" /><figcaption>Figure 8.1 : Plotting h(x) when theta_0 = 0 and theta_1 = 1</figcaption></figure><ul><li>We assumed some points (1,1),(2,2),(3,3) and assuming theta0 = 0 and theta1 = 1. We calculated the error and obviously it will be zero.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*4Avp6aqsJtJ7pAuvdFUm_Q.png" /><figcaption>Figure 8.2 : Calculation Of Error for Figure 8.1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*Pis0DVPkEluQvcAow4qqTQ.png" /><figcaption>Figure 8.3 : Plotting h(x) when theta_0 = 0 and theta_1 = 0.5</figcaption></figure><ul><li>Then we repeated the same process with value 0 and 0.5 and error we got is 0.58 and you can also see in the image. The line is not a good fit to the given points.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*vTPV1Ogc_N5DjCZ6L8dPKA.png" /><figcaption>Figure 8.4 : Calculation Of Error for Figure 8.3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*R5FYbaXmYu0meRg4IwYiPg.png" /><figcaption>Figure 8.5 : Graph between Error Function and Theta_1</figcaption></figure><ul><li>Now if take more values of theta we will get some thing like hand drawn diagram(bottom-right) as we can minimum is at theta1 =1</li></ul><p>But unfortunately we cannot always have theta0 = 0 because if we can some data points are like shown in the below image we can to take some intercept or we cant ever reach the best fit while theta0 having some value we will plot a 3D graph shown in right image. It will always be bowled shaped graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dV6hrFrtyiNVJJfBkcYH9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*JNOVaxLlNZk-4KyEKQsrQA.png" /><figcaption>Figure 9 : 3D plot while considering both Theta(source : <a href="http://www.google.com/images)">www.google.com/images)</a></figcaption></figure><p>3D repesentations are very difficult to study. So we will not study them. We will plot them in 2D also known an <strong>contour plots</strong></p><p>In the below images you will see the contour plots of the hypothesis. <strong>What does these eclipses represents in the image?</strong></p><ul><li>Any point on the same eclipses will give us the same value of error function J. As the three points represented by pink color on the below left image will have same value of error function.</li><li>The red points describes the hypothesis for the left image you will get theta0(intecept) = 800 and theta1(slope) = -0.5 and in the below right image theta0(intecept) = 500 and theta1(slope) = 0. So you can a line parallel to x-axis.</li><li>In the left image the red point is far from center of the ellipse and the line also not a good fit but in the right case the read is closer to center of ellipses the line is also a better fit then left image. So we can also conclude that center of ellipses will be the minima or the optimal value of theta’s which will the best fit for the given data points</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHToimePLv5XLLQ9K52m-Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBOc6-ZTI_lrQSr-IG4keA.png" /><figcaption>Figure 10 : Contour Plots(source : <a href="http://www.google.com/images">www.google.com/images</a>)</figcaption></figure><p>We have written our cost function but <strong>How to minimize it? </strong>So we have solutions to the problem</p><ul><li>Gradient Descent</li><li>Normal Equations</li></ul><h3>Gradient Descent</h3><p>We are standing at top of the hill and we look 360 degree around us. We want to take small step in the direction which will take us downhill. In case of best direction would be the direction of steepest descent. We then reach a point we follows the same steps until we reach the ground as in case of below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*70KmcEnY9WqCO1wiI6hYUA.png" /><figcaption>Figure 11 : Gradient Descent (source : <a href="https://codesachin.wordpress.com/tag/gradient-descent/">https://codesachin.wordpress.com/tag/gradient-descent/</a>)</figcaption></figure><p>There is one more thing. <strong>Are you sure that you will always reach the same minimum? </strong>I can guarantee you are not sure. In case gradient descent you can’t be sure. Lets take the mountain problem. If you start few steps from your right It is entirely possible that you end up at completely different minima as shown in below image</p><figure><img alt="Image result for gradient descent" src="https://cdn-images-1.medium.com/proxy/1*f9a162GhpMbiTVTAua_lLQ.png" /><figcaption>Figure 12 : Problem with Gradient Descent(source : <a href="https://codesachin.wordpress.com/tag/gradient-descent/">https://codesachin.wordpress.com/tag/gradient-descent/</a>)</figcaption></figure><p>We will discuss the mathematical interpenetration of Gradient Descent but let’s understand some terms and notations as follows :</p><ul><li><strong>alpha</strong> is learning rate which describes how big the step you take.</li><li><strong>Derivative </strong>gives you the slope of the line tangent to the ‘theta’ which can be either positive or negative and derivative tells us that we will increase or decrease the ‘theta’.</li><li>Simultaneous update means that both theta should be updated simultaneously.</li></ul><p>The derivation will be given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8McJOebcLiWmlaHydiuNgQ.png" /><figcaption>Figure 13 : Gradient Descent Derivation</figcaption></figure><h3>Normal Equations</h3><p>As Gradient Descent is an iterative process, Normal equations help to find the optimum solution in one go. They use matrix multiplication. The formula’s and notations are explained in the images. Below right image will explain what will be our X and y from our example. The first column of our X will always be 1 because it will be multiplied by Theta_0 which we know is our intercept to the axis&#39;s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*Wk0Y7a5Nyc4GoqsMSuJ4IA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*G6QioyjPZH05tJWhZjwAZg.png" /><figcaption>Figure 14 : Normal Equation with Example</figcaption></figure><p>The derivation of the Normal Equation are explained in below image. They use matrix notation and properties.</p><p>This image explains the</p><ul><li>‘Theta’ matrix</li><li>‘x’ matrix</li><li>hypothesis is expanded</li><li>Using those matrix we can rewrite the hypothesis as given is last step</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*TAzQ3fuV4ayNyP2PCFsmXg.png" /><figcaption>Figure 15: Notations in Normal Equations</figcaption></figure><p>Figure 16 explains the following</p><ul><li>We will replace our hypothesis in error function.</li><li>We assume z matrix as given in step 2</li><li>Error Function can be rewritten as step 3. So if you multiply transpose of Z matrix with Z matrix. we will get our step 1 equation</li><li>We can decompose z from step 2 as shown in step 4.</li><li>By the property given in Step 6. We will rewrite z as given in Step 7. Capital X is also known as design matrix is transpose of small x</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*Ww29QcShC3PwVvLfelrZ5g.png" /><figcaption>Figure 16 : Normal Equation Derivation Part 1</figcaption></figure><ul><li>Substituting z in the equation</li><li>Expand the error equation and then take derivative with respect to theta and equate it to 0.</li><li>We will get out solution. As shown in below image</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LRD9vknJAqzn64rSvBhOfw.png" /><figcaption>Figure 17: Normal Equation Derivation Part 2</figcaption></figure><h3>Comparison Between Gradient Descent and Normal Equations</h3><ul><li>We need to choose alpha, initial value of theta in case of gradient Descent but Normal equations we don’t have to choose alpha or theta.</li><li>Gradient Descent is an iterative process while Normal Equation gives you solution right away.</li><li>Normal equation computation gets slow as number of features increases but Gradient Descent performs well with features being with very large.</li></ul><p>We have seen linear regression is powerful algorithm for modeling relationship and predicting values based on that relationship. We have also discussed the methods of minimizing the error so that we can obtain the optimum values of our parameters. The linear Regression doesn’t perform well when it comes to classification problems. We will what algorithm overcomes that limitation in the next article. Keep Reading.</p><p>If you want to connect with me. Please feel free to connect with me on LinkedIn.</p><p><a href="https://www.linkedin.com/in/sameer-negi-356881115/">Sameer Negi - autonomous Vehicle Trainee - Infosys | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d2a6c878e2c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/linear-regression-cost-function-gradient-descent-normal-equations-1d2a6c878e2c">Linear Regression — Detailed Overview</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Classify when linear Regression Fails?]]></title>
            <link>https://medium.com/hackernoon/classification-and-logistic-regression-8a20a5c9603d?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a20a5c9603d</guid>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[logistic-regression]]></category>
            <category><![CDATA[classification]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Sun, 08 Jul 2018 08:59:58 GMT</pubDate>
            <atom:updated>2019-05-17T10:06:44.272Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ew0AoxyQYBy_6O1X6GPzGQ.jpeg" /></figure><p><a href="https://hackernoon.com/tagged/linear-regression">Linear regression</a> is a simple solution to our classification problems but what happens when it fails. As we will see in below problem</p><p>Suppose we want to classify <strong>Y= {0,1} </strong>and <strong>X </strong>are<strong> data samples</strong>. It is binary classification. Let’s try it with linear Regression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*ofqIt_tKJj6ZD8nBuo2gTg.png" /></figure><p>Wow, Linear Regression has done the job.It is really a good fit but what happens if i add a new data to given data set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*6ZtPRB6A7naf0ky3JuVX0A.png" /></figure><p>It’s really a bad <a href="https://hackernoon.com/tagged/solution">solution</a>. Linear Regression didn’t worked. What should we do next? If there is problem, there is solution and the solution is <a href="https://hackernoon.com/tagged/logistic-regression"><strong>Logistic Regression</strong></a><strong>. </strong>Let’s start with formal definition and have an idea what is linear and logistic Regression are:</p><p>In <a href="https://towardsdatascience.com/deep-dive-into-supervised-learning-e7952c0692e9"><strong><em>linear regression</em></strong></a>, the outcome (dependent variable) is continuous. It can have any one of an infinite number of possible values. In <strong>logistic regression</strong>, the outcome (dependent variable) has only a limited number of possible values. <strong>Logistic regression</strong> is used when the response variable is categorical in nature.</p><p>Intuitively, it also doesn’t make sense for h(x) to take values larger than 1 or smaller than 0 when we know that y ∈ {0, 1}.To fix this, lets change the form for our hypotheses h(x). We will choose hypothesis as follows :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*D4CIwT2zRCcVq88iji6qYQ.png" /></figure><p>g(z) is called <strong><em>Sigmoid function</em></strong> or L<strong><em>ogistic function</em></strong>. It look like as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*JFNqqLZoaTguEfSgTq6Zgg.png" /></figure><p>Let’s assume that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*iMFtCGIfxyxTxAPbsDgOjg.png" /></figure><p>if we combine above equations together it can be re written as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*1v8Raq07JVPheYxKXnJE7w.png" /></figure><p>As in above equation when <strong>y =0</strong>, h(x) will become 1, p(y|x;theta) = (1-h(x)) and when <strong>y =1</strong>,(1- h(x)) will become 1, p(y|x;theta) = h(x)</p><p>Now, <strong>likelihood of the parameters</strong> are given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*wA5dN-oyWu8KcYMRHQ6Xmg.png" /></figure><p>and when we <strong><em>Maximize log likelihood, </em></strong><em>it</em><strong><em> </em></strong>will be given by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*U7VoRhd7kToafLGjijqQFQ.png" /></figure><p>Now we can use <strong>Gradient Descent</strong> , we already know that h(x) is given by sigmoid function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*D4CIwT2zRCcVq88iji6qYQ.png" /></figure><p>For ease, the partial derivative of g(z) with respect to z is given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*hfBX0p8u2nUneE_k-KeClQ.png" /></figure><p>Now if apply gradient descent by taking the<strong><em> partial derivative of log likelihood with respect to theta</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*GKiNLofz7qMwggVf8p1_wQ.png" /></figure><p>If we compare the above rule to the least mean square, it looks identical but it’s not. This is a different <a href="https://hackernoon.com/tagged/learning">learning</a> algorithm because h(x) is now defined as non-linear function of theta transpose * x[i].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*6XZYyIs45VgbkgPp3aULng.png" /></figure><p>If you find any inconsistency in my post, please feel free to point out in the comments. Thanks for reading.</p><p>If you want to connect with me. Please feel free to connect with me on LinkedIn.</p><p><a href="https://www.linkedin.com/in/sameer-negi-356881115/">Sameer Negi - autonomous Vehicle Trainee - Infosys | LinkedIn</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a20a5c9603d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/classification-and-logistic-regression-8a20a5c9603d">How to Classify when linear Regression Fails?</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happens when Probability defines Linear Regression]]></title>
            <link>https://medium.com/hackernoon/probabilistic-interpretation-of-linear-regression-835de290dd46?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/835de290dd46</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[distribution]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[logistic-regression]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Sun, 08 Jul 2018 08:57:14 GMT</pubDate>
            <atom:updated>2019-05-17T10:06:44.129Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADiZaUQetyNQxJmzYY0g8Q.jpeg" /></figure><p>Why <a href="https://hackernoon.com/tagged/probability">Probability</a>? Why can’t we leave <a href="https://hackernoon.com/tagged/linear-regression">linear regression</a> just the way it is! Why to make it difficult? All these question were in my mind, when i was heading through this topic but as we know when there is loads of data suddenly randomness appears, she calls her sister probability with her. When there is probability we can’t leave Gaussian alone. All these words are so heavy that i will make sure to put some magic and make it easy for you. Let’s dive together.</p><p><em>Do you remember these equation from linear regression?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*ne0miZo9bWOYwLLXsr2zLg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*k2SQS2xeMR0P-ifLJ0MrHA.png" /></figure><blockquote>If not, Please read the article on <a href="https://towardsdatascience.com/deep-dive-into-supervised-learning-e7952c0692e9">Supervised Learning</a>.</blockquote><p>In probability theory, the very common continuous probability distribution is also known as<strong> Normal Distribution</strong> or <strong>Gaussian Distribution</strong>. This normal distribution is sometimes informally called as the <strong>bell curve </strong>as shown in the below image :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*9sYBM0h_7EJQr01PQzFSGA.gif" /></figure><p>The probability density of above normal distribution or Gaussian is given by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*tlBgq1rSoBJY6azvvgvleQ.png" /></figure><p>Where,</p><ul><li>‘mu’ is the mean</li><li>sigma is the standard deviation</li><li>sigma square is the variance</li></ul><p>Now, as we have probability distribution equation and if we write the probability distribution of the predicted values ‘<strong>Y</strong>’ of the given ‘<strong>X</strong>’ and the parameter <strong>Theta</strong> is given as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*HUH4jDbXZQ0KYo3Cv9es7Q.png" /></figure><p><em>Still the question remains, why always Gaussian? Why not something else? </em>The answer lies in the “<strong>Central Limit Theorem</strong>”. This gives us an idea that when you take a bunch of random numbers from almost any distribution and add them together, you get something which is normally distributed. The more numbers you add, the more normally distributed it gets. In a typical machine <a href="https://hackernoon.com/tagged/learning">learning</a> problem, you will have errors from many different sources (e.g. measurement error, data entry error, classification error, <a href="https://hackernoon.com/tagged/data">data</a> corruption…) and it’s not completely unreasonable to think that the combined effect of all of these errors is approximately normal.</p><p>When we wish to explicitly view the probability distribution function of theta θ, we will instead call it the <strong>Likelihood function</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*8QiqkozIqbpID9DpqTQ1OQ.png" /></figure><p>When taken for ‘<strong>m</strong>’ training examples, the likelihood function is modified as follows :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*BhYXx9Kgkey8vnXINkzDBA.png" /></figure><p><strong>Likelihood</strong> and <strong>Probability</strong> are the same things. It is called likelihood because when we want to see the above equation as function of theta while keeping ‘X’ and ‘Y’ constant.</p><p><strong><em>Principle of maximum likelihood</em></strong> says that “<em>Choose theta to maximize the likelihood or choose parameters that makes data more probable as possible</em>”. Instead of maximizing L(theta), we can also maximize any strictly increasing function of L(theta). In particular, the derivations will be a bit simpler if we instead maximize the <strong>log likelihood</strong> we call it as ℓ(theta):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*wboWuGrz2ct69staBFkEvQ.png" /></figure><p>which gives similar answer as minimizing J(theta):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*CcIWnYGv3qv8rSLhYxZXtQ.png" /></figure><p>This probabilistic Interpretation will be further used in<strong> Logistic Regression</strong>.</p><p>If you find any inconsistency in my post, please feel free to point out in the comments. Thanks for reading.</p><p>If you want to connect with me. Please feel free to connect with me on LinkedIn.</p><p><a href="https://www.linkedin.com/in/sameer-negi-356881115/">Sameer Negi - autonomous Vehicle Trainee - Infosys | LinkedIn</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=835de290dd46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/probabilistic-interpretation-of-linear-regression-835de290dd46">What happens when Probability defines Linear Regression</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into Supervised Learning]]></title>
            <link>https://medium.com/data-science/deep-dive-into-supervised-learning-e7952c0692e9?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7952c0692e9</guid>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[linear-regression]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Tue, 26 Jun 2018 10:19:29 GMT</pubDate>
            <atom:updated>2018-07-02T12:29:39.368Z</atom:updated>
            <content:encoded><![CDATA[<p>When you were in school, you were made to practice lots of addition, subtraction problems. Initially you had to check whether the answer you came up with is right or wrong but after some time you became confident on your answer that it is right. This is basically <strong>Supervised Learning</strong>.</p><p>In supervised learning, the algorithm is presented with example inputs and desired outputs. The work of algorithm is to establish a mapping between inputs and outputs. After sufficient number of inputs, the algorithm is able to predict the output with certain accuracy.</p><p>Below is the video which shows <strong>Alvin, System of AI</strong> which learns by watching the person drive. As I said, initial step is to train a network/algorithm to steer. While training human driver, steering angle are provided to Alvin. The job of Alvin is to learn “How to steer”.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FilP4aPDTBPE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DilP4aPDTBPE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FilP4aPDTBPE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c7bb9e1c6ed8378a5cc15a1758175d7/href">https://medium.com/media/2c7bb9e1c6ed8378a5cc15a1758175d7/href</a></iframe><p>In the above video there is an image which is shown below. It represents the input to the algorithm and output of the algorithm in the real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*YlDKmh61xzuA2q4Y71AK3w.png" /></figure><p>Let’s get started with supervised learning but before that you should be familiar with some notation:</p><ul><li>m : number of training examples</li><li>x : input variable/features</li><li>y : output variable/target variable</li><li>(x, y) :training example</li><li>n : number of input variable or features</li><li>theta : parameter or weights. The job of algorithm is to choose appropriate weights</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*kPYa-chlLgVtK4_DXjHVwA.png" /></figure><p>To summarize we provide training samples to learning algorithm. It provides us with a hypothesis(h). Hypothesis when provided with some input will gives us the expected output. Hypothesis is given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*ne0miZo9bWOYwLLXsr2zLg.png" /></figure><p>When we want to train for ‘m’ samples, above equation can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*k2SQS2xeMR0P-ifLJ0MrHA.png" /></figure><p>Now theta is represented as sum of the square’s of value predicted by hypothesis subtracted by the actual value for ‘m’ training samples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*QEdN8twDhTP98ZWccyF_iA.png" /></figure><p>To minimize J(theta), we use the algorithm known as <strong>Gradient Descent</strong>. It can be explained as follows: Imagine you are standing on a hill top and you want to take a small step to the direction of the steepest descent which can take you downhill as soon as possible. Gradient descent does the same. You start at a point apply gradient descent and end up at a new point and repeat the same until you reach to the minimum point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*70KmcEnY9WqCO1wiI6hYUA.png" /></figure><p>We will go through derivation of gradient descent assuming there is single training sample</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*V9GRfH5f0pVxz8Wu_gwl2g.png" /></figure><p>Now theta is given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*-9xcHLD7Bof0CYkzwTwtrQ.png" /></figure><p>Note : Alpha in above equation is the learning rate. It’s like how large the steps you want to take while descending down the hill. If you take steps too small, it will take long time to descend down the hill. If you take steps too large you may overshoot the local minima. If there are ‘m’ training samples the generalized equation is given by</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*2bZGX_-c4qLtv247mOnfcg.png" /></figure><p>I will present you with an image so that you can see gradient descent is action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*ZmzSnV6xluGa42wtU7KYVA.gif" /></figure><p>The above explained gradient descent is also known as <strong>Batch Gradient Descent</strong>. It means every time the algorithm will run for all training examples. There is one more variation of gradient descent known as <strong>Stochastic Gradient Descent</strong> or <strong>incremental descent</strong>. It is given as shown below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*MmgIAHA5IHhTTQHXfRMTDA.png" /></figure><p><strong>Advantages</strong> of stochastic gradient descent is that the parameters are updated according the gradient of the error with respect to the single training example. It has been observed that stochastic gradient descent is faster with large data sets.</p><p>If you find any inconsistency in my post, please feel free to point out in the comments. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7952c0692e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/deep-dive-into-supervised-learning-e7952c0692e9">Deep Dive into Supervised Learning</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get Started with Machine Learning]]></title>
            <link>https://sameer-negi17.medium.com/get-started-with-machine-learning-b73a6e8e42f2?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/b73a6e8e42f2</guid>
            <category><![CDATA[start-ml]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[machine]]></category>
            <category><![CDATA[learnml]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Sun, 24 Jun 2018 05:29:47 GMT</pubDate>
            <atom:updated>2018-07-04T12:46:18.339Z</atom:updated>
            <content:encoded><![CDATA[<p>If I say you that a car can drive by itself would you believe me or if I say you a car can also fly by itself. You will say that this person is going mad. But all this is true.</p><p>Well Now I have your curiosity. I will let you in on a little secret. Have you heard the word “Machine Learning”? If in case you haven’t, it means as simple as it sounds. To make machine learn is called machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*qB4GzXlGk_lyIIQKH-IaVw.png" /></figure><p>In today’s era, Machine learning has become such a hot topic. Everyone is wondering what it is? Where to get started? What projects will be working on. Let’s answer these question</p><p>We will start with formal definition of Machine learning- ‘It is field that often uses statistical Techniques to give computers the ability to learn with data, without explicitly programmed”. When you say “OK Google” in your phone. Sorry pals I am an android users. Your will chat assistant opens up and helps with your queries or have you seen face recognition in Facebook. Whenever you load an image Facebook automatically ask you if you want tag this person. Ever wondered what’s going on here. All these are examples of Machine Learning. Below is the video where you can see some applications og machine learning</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fwwh6G83NpdU%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dwwh6G83NpdU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fwwh6G83NpdU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/856b862b84cad6708034f2b38e4d13fe/href">https://medium.com/media/856b862b84cad6708034f2b38e4d13fe/href</a></iframe><p>Want to become a Machine Learning Expert? Yes, you can become a machine learning. I suggest you to start now but as always there are some prerequisite to become machine learning engineer. With my experience I will suggest some links but please explore on your own. As more you explore, the more you learn.</p><ul><li>You should have basic knowledge of <strong>computer programming</strong>: You can watch videos on YouTube or w3schools. I will suggest you to learn <strong>Python</strong> as most of the code you will write will be in Python.</li><li>You should have basic knowledge of linear Algebra, Statistic, Calculus, Probability. Below is the excellent course to refresh your knowledge with high school mathematics.</li></ul><p><a href="https://www.coursera.org/specializations/mathematics-machine-learning">Mathematics for Machine Learning</a></p><p>Once you have completed the prerequisites you are good to start with machine learning:</p><p><a href="https://www.coursera.org/learn/machine-learning">Supervised Machine Learning: Regression and Classification</a></p><p>Now you can start your journey with Machine learning. Choose you fields where you want to work in</p><p>As of today machine learning has various applications such as :</p><ul><li>Image Recoginition</li><li>Pattern Recoginition</li><li>Self Driving Car</li><li>Health care : Identifying Tumor etc</li><li>Flying Car and much more…….</li></ul><p>If you find any inconsistency in my post, please feel free to point out in the comments. Thanks for reading.</p><h4>More where this came from</h4><p>This story is published in <a href="http://blog.usejournal.com/">Noteworthy</a>, where thousands come every day to learn about the people &amp; ideas shaping the products we love.</p><p>Follow our publication to see more stories featured by the <a href="https://usejournal.com/?/utm_source=usejournal.com&amp;utm_medium=blog&amp;utm_campaign=guest_post">Journal</a> team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b73a6e8e42f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview of Kalman Filters]]></title>
            <link>https://sameer-negi17.medium.com/overview-of-kalman-filters-95d0ea71d13a?source=rss-1774d3ff6ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/95d0ea71d13a</guid>
            <category><![CDATA[gaussian]]></category>
            <category><![CDATA[kalman]]></category>
            <category><![CDATA[sensor-fustion]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[kalman-filter]]></category>
            <dc:creator><![CDATA[Sameer Negi]]></dc:creator>
            <pubDate>Thu, 14 Jun 2018 19:33:54 GMT</pubDate>
            <atom:updated>2018-06-14T19:33:54.978Z</atom:updated>
            <content:encoded><![CDATA[<p>There is nothing as perfect in this world. If you program a robot to move by one meter. Are you sure that it will move exactly one meter? No, you can’t be sure but I <em>guarantee</em> it will be off.</p><p>Great. Just Great, Now uncertainty came into picture and if there is uncertainty there will be probability. Now you can imagine who is going to enter the picture. Gaussian,Magical, magical Gaussian&#39;s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*_XOqhv1U3oW9AIDjjOo1GQ.png" /></figure><p>The Gaussian is given by its mean ( represented by the symbol mu in the equation ) and variance ( the uncertainty of the measurement, represented by sigma ). Now you want to see the magic, try to add two Gaussian’s. Any Guesses ?? A Gaussian . Product of two Gaussian’s or convolution of two Gaussian’s? You can answer it right. This is really simple. Yes, It’s Gaussian. Do you like the magic?</p><p>Can you imagine complex movements and measurements in multidimensional space. I don’t know about you but surely I won’t but its good to assume that the actual probability distributions for any motion of the robot or any sensor’s measurement follow a Gaussian distribution.</p><p>Kalman Filters just do the same. They take joint probability distribution making our life lot easier. They take mean and variance foe each dimension of our robot’s motion that we are interested in tracking and place them into a state vector and co-variance matrix respectively. Not its just the cycle of predict and update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*_KlHur60RBM8w0mavR2FKQ.png" /></figure><p>Prediction comes from the knowledge of the system.Now to track a vehicle we use the equation of motion to track the position and velocity of the object. Model can be represented as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*kg39Fh-eo3rDJ8FoJNzzdw.png" /></figure><p>and the above when represented in the matrix form looks like :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*pg60_PudYF7qbQFmKyMN3A.png" /></figure><p>now we can write it as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/140/1*4XJEK8JD4cI6ZGK6buH2Tg.png" /></figure><p>F is called transition matrix and U is known as control variable matrix. in most cases, velocity is assumed to be constant and U accounts for acceleration. We also need to add uncertainty into the system. This is given by state co-variance matrix Q.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/149/1*42wMslcIko5LSQBw_UDhBQ.png" /></figure><p><strong>Kalman Gain</strong></p><p>Most important factor in kalman algorithm is kalman gain which decides based on error from previous estimations, which of either the estimate or measurement to give more weight to. It can be explained if our prediction is good so it will have more weight and measurement will have less weight or if we are making bad estimates, then it gives weight to the new measurements to make subsequent predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*u2BH_i6MzU6OEPA_d1dxAA.jpeg" /></figure><p>This is general overview of Kalman Filters. I will be leaving Extended Kalman Filter and Unscented Kalman Filters for later.</p><p>If you find any inconsistency in my post, please feel free to point out in the comments. I’m still a learner.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95d0ea71d13a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>