<?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 Adarsh Pathak on Medium]]></title>
        <description><![CDATA[Stories by Adarsh Pathak on Medium]]></description>
        <link>https://medium.com/@adarshp199877?source=rss-b52f579252de------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cx-s_yLTwhGoJ1FK-Z4SNg.png</url>
            <title>Stories by Adarsh Pathak on Medium</title>
            <link>https://medium.com/@adarshp199877?source=rss-b52f579252de------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 03:51:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adarshp199877/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[Mathematics of Linear Regression]]></title>
            <link>https://medium.com/mathematics-and-ai/mathematics-of-linear-regression-60d7d1db1b39?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d7d1db1b39</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[learning-rate]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Sun, 03 May 2020 17:22:43 GMT</pubDate>
            <atom:updated>2020-05-04T12:35:20.680Z</atom:updated>
            <content:encoded><![CDATA[<p>So till now we have learn basic algebra and optimisation technique. Now we can proceed with our first machine learning algorithm. So let&#39;s see how we can write our own linear regression code. This article is application of previous articles. If you have not read it please read it first for better understanding.</p><p><a href="https://medium.com/mathematics-and-ai/gradient-descent-algorithm-convergence-performance-behaviour-c4f67138f15f">Gradient Descent Algorithm | Convergence, Performance, Behaviour</a></p><p>Let’s take an example to understand that example better. Suppose you have a experience vs salary dataset. Now your task is to make a machine learning model which will predict salary for given experence. What will you do?</p><p>Let’s see how it’s look like on graph then we will decide what we have to do next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*-VqfwyyImaNTWnSZpButRA.png" /><figcaption>experience vs salary chart</figcaption></figure><p>Above graph gives clear hint that we have to find a equation of line for which distance of each dataset is as least as possible. Let me explain this line with an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*bTaEoZY5Ta3ZUA9l2hgueg.png" /><figcaption>explanations of examples</figcaption></figure><p>From above figure you can see that we want to minimize d1, d2, d3, d4,d5, d6. How will you solve this problem now?</p><p>Before we start to solve this problem let’s first write an equation for that line. And we know that equation of line is <strong>y = mx+c </strong>where m is slope of line and c in intercept. So our task is to find best value of <strong>m and c</strong> for which distance of line from each dataset is minimum. Here is your dataset with 10 examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*L8leD6uAcB2ZDwGNiaYlhw.png" /><figcaption>Dataset</figcaption></figure><p>We will use <a href="https://en.wikipedia.org/wiki/Mean_squared_error">Mean Square Error</a> method here because it is differentiable and it gives us absolute value. And our task will be only to minimise numerical value of error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkFUthoLWxr9beFtCrMCtQ.png" /><figcaption>MSE formula</figcaption></figure><p>Y(i) is actual value and and Y_hat(i) is predicted value or calculated value. m is total number of examples given.</p><p>lets suppose our values of m is 1 and c is -2 . (m = 1 , c = -2)</p><p>With this equation our new line equation will be <strong>Y = X-2</strong></p><p>lets calculate Y_hat for first example. Y_hat(0) = 0–2</p><p>Y_hat(0) = -2 but actual value is 30000. so error is also huge for this which is 29998². This error is not acceptable . Now lets guess another value of m and c.</p><p>let’s say m = 1 , c = 3000 new equation of line is <strong>Y = X— 3000 .</strong></p><p>Lets calculate new value for this equation Y_hat(0) = 0–3000 which is -3000. Our new error will be 27000² this value is also not acceptable. And you can keep on guessing values of m and c and find error values. This process can be very time consuming. Let&#39;s use our previous gradient descent technique to find minimum error.</p><p>Our task is to find value of m and c for which error is minimum. For this we have to differentiate our error with respect to m and c.</p><p>We can write Y(i) = m*X(i) + c .</p><h4>∂m = ∂<em>error/</em>∂m​ = 2​(<em>mX</em>(<em>i</em>)+<em>c</em>−<em>y_hat</em>(<em>i</em>))<em>X</em>(<em>i</em>)/m</h4><h4>∂c = ∂error/∂c​=2​(mX(i)+c−y_hat(i))/m</h4><p>Now lets keep on updating our m value till we do not get minimum error value. for this we have to use again gradient descent algorithm</p><p>m_new = m — alpha * ∂m</p><p>c_new = c — alpha * ∂c</p><p>alpha is step size or learning rate.</p><p>Here is python code for this algorithms which will help you to find best value of m and c.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fa73436dc6ab75dbec7e2040300c00c/href">https://medium.com/media/8fa73436dc6ab75dbec7e2040300c00c/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60d0d0011973140aef372cfaf6305461/href">https://medium.com/media/60d0d0011973140aef372cfaf6305461/href</a></iframe><p>you can initialise w and b with any value.</p><p>Here is the python notebook with more explanation. You can check it for complete implementation.</p><p><a href="https://colab.research.google.com/drive/1ME9ZcfIhWGP3g0pTwfVE7SCGZZoWI1X9">Google Colaboratory</a></p><p>Feel free to ask your doubts. If you have any suggestions please let me know. Thanks for reading this articles. Hope this articles helps you to understand linear regression better.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d7d1db1b39" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/mathematics-of-linear-regression-60d7d1db1b39">Mathematics of Linear Regression</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gradient Descent Algorithm | Convergence, Performance, Behaviour]]></title>
            <link>https://medium.com/mathematics-and-ai/gradient-descent-algorithm-convergence-performance-behaviour-c4f67138f15f?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4f67138f15f</guid>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[convergence]]></category>
            <category><![CDATA[gradient]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Mon, 20 Apr 2020 07:52:51 GMT</pubDate>
            <atom:updated>2020-04-20T07:52:51.881Z</atom:updated>
            <content:encoded><![CDATA[<p>Lets move one step further and explore deep mathematics of gradient descent algorithm. This article is part 2 of my previous article so please read article before this if you had not read that yet. If you are familiar with gradient descent algorithm them you can skip part-1. here is the link of part-1 ( <a href="https://medium.com/mathematics-and-ai/mathematics-and-ai-optimisation-algorithms-gradient-descent-algorithm-781e350027e1">https://medium.com/mathematics-and-ai/mathematics-and-ai-optimisation-algorithms-gradient-descent-algorithm-781e350027e1</a> )</p><p>In previous article we had seen that how does it calculate values so that our function gives least error. Now let’s explore gradient descent algorithm in more detail.</p><p><strong>Why does this algorithm makes sense?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*hFG7bHMNVGm0gKyiwrbVvQ.png" /></figure><p>This is our last example we had seen. So the first question is why does is goes from A to B? What will happen if A was at opposite part(increasing cure) , will it still decreases to B?</p><p><strong>A := A— alpha * dA </strong>we are using this formula in gradient descent algorithm.</p><p>dA = df/dA = slop of function</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*EjfmFSAhm35mpITEGp_CIw.png" /><figcaption>Gradient descent explaining</figcaption></figure><p>if we start from point A then slope at that point will be negative so dA is negative and A := A+alpha * (dA) so A will move in forward direction if we start from point B its slope will be positive B:=B-alpha*dB will decrease and it will again move towards minima point.</p><p><strong>When will it stop moving?</strong></p><p>If dA or dB will be equal to zero or in other words when we reach at any optimal point A or B will stop moving and that will be our optimal solution.</p><p><strong>How does alpha can affect the algorithm?</strong></p><p>What if alpha is very large? like alpha = 80</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*ExCyzXHsb5NfihqQZggtMQ.png" /><figcaption>alpha is large</figcaption></figure><p>If alpha is very large then it will show very unusual behaviour. Our function will come time converse some time diverse. It may not be converse to optimal value.</p><p>What if alpha is too small? alpha = 0.00001</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*iuKHHgbLYlAryKm2komBAQ.png" /><figcaption>small value of alpha</figcaption></figure><p>If alpha is very small it will converse at very slow rate. It may take couple of minutes to converses at optimal point.</p><p>So performance of gradient descent algorithm mostly depends upon the value of alpha. Most common value of alpha is 0.1 , 1 ,0.01, 0.05 . You can set these values.</p><p>This algorithms does not guarantees for absolute minima. This may be the biggest drawback of this algorithm. There are more advance optimisation algorithms used in deep learning. Which i will explain later in other articles.</p><p>One other drawback of this algorithm is that is uses whole dataset to calculate one value of dA or dB. If our dataset is too large this algorithm does works well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*DIspufXTjFR6FbbhUIMABQ.png" /><figcaption>J, db , dW calculation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*aYY5KIKUFRyqRxeMewTTdw.png" /><figcaption>W and b calculation</figcaption></figure><p>You can put w and b values in equation of line to find more accurate prediction. Y = w*x + b</p><p>J is our error function which is often referred as cost function.</p><p>Hope you understand these basic concepts which we will implement in machine learning algorithms further. I will keep writing new articles daily. You can follow me for my new articles. <strong>Mathematics and AI </strong>is my collection where i am uploading articles. So follow this page also. If this article helps you to understand gradient descent algorithm then give claps . Thank you…..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4f67138f15f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/gradient-descent-algorithm-convergence-performance-behaviour-c4f67138f15f">Gradient Descent Algorithm | Convergence, Performance, Behaviour</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mathematics and AI | Optimisation Algorithms| Gradient descent algorithm]]></title>
            <link>https://medium.com/mathematics-and-ai/mathematics-and-ai-optimisation-algorithms-gradient-descent-algorithm-781e350027e1?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/781e350027e1</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[optimization-algorithms]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Sun, 19 Apr 2020 12:23:24 GMT</pubDate>
            <atom:updated>2020-04-19T12:55:52.523Z</atom:updated>
            <content:encoded><![CDATA[<h3>Explaining mathematical part of Gradient descent algorithm</h3><p>One of the most popular term you will often listen in machine learning is optimisation or optimising cost function. We will start our machine learning journey with gradient descent optimisation. So what it is? How it is so useful in machine learning?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*lHedngCyyuvImUEZezR_eQ.png" /><figcaption>Gradient descent example</figcaption></figure><blockquote>Gradient Descent is an optimisation algorithm used for minimising cost of a function.</blockquote><p>So still not clear what is Gradient descent algorithm? Let’s understand this algorithm with an example. Suppose you are paragliding and you found some problem in your parasuite. So you decide to land on any nearby hill to avoid any damage. Now to are at the top of a hill and you know that if you are able to reach bottom of that hill someone will help to reach home. So how will you find the bottom point of that hill? To reach the bottom point of that hill you have to first decide in which <strong>direction</strong> you have to move. Suppose there is a junction of three roads. One which from which you are coming, second is going down and third is again going at another top. If you are running <strong>very fast </strong>and not able to see difference it is possible that you choose again a wrong path. At the end of that wrong path you observe that you are again at the top of the hill but this time at second peak. So to avoid this mistake you have to decide how fast you have to move so that you can avoid these mistakes or in simple words you have to decide your <strong>step size</strong>.</p><p>Gradient descent algorithm is also searching for lowest point of the hill. With two help of direction and step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*c_KsV3hsscqcqQ7ETz7bsg.png" /><figcaption>Gradient descent example</figcaption></figure><p>In above figure gradient descent algorithm is trying to reach at point to from point A with the help of direction and step size. Arrow is step size and arrow direction is the direction of that algorithm.</p><p>Gradient descent formula:</p><blockquote>NextPosition = CurrentPosition — stepSize * Direction</blockquote><p>Above equation can be written as:</p><blockquote>J := J — alpha * dJ</blockquote><p>Both equations are same you can compare each term.</p><blockquote>alpha -&gt; step size</blockquote><blockquote>dJ -&gt; direction</blockquote><p>Let’s take another example to understand this concept mathematically.</p><p>Suppose you have a line Y = mx+c ; you have x1 = 10 , Y1= 6 and x2 = 20, Y2 = 11 ; Your task is to find best value of m and c which gives least error to calculate Y;</p><p>Y_hat is the calculated value of Y using random value of m and c.</p><p>error = (Y_hat - Y )²</p><p>We are using mean square method because we want to focus on only difference between real value and calculated value not its sign wether it is negative or positive. Here our aim is to minimise this error. error = ((mx1 + c — Y1)² +(mx2 + c — Y2)²)/2;</p><p>How will you calculate the best value of m and so that error is minimum? Yes differentiate this equation with respect to m and c.</p><p>dm = d(error)/dm = (mx1+c — Y1)*x1 + (mx2+c — Y2)*x2</p><p>dc = f(error)/dc = (mx1+c — Y1) + (mx2+c — Y2)</p><p>dm and dc will tell us direction towards which our m and c value will go to minimise error.</p><p>m := m — alpha * dm</p><p>c := c — alpha *dc</p><p>here alpha tells us how fast we have to move and dm and dc tells us in which direction we have to move to get better result.</p><p>Initially assume any value of m, c and alpha.</p><p>say m = 8, c = 3 , alpha = 0.0001; x1 = 10 , Y1= 6, x2 = 20, Y2 = 11</p><p>error = ((mx1 + c — Y1)² +(mx2 + c — Y2)²)/2;</p><p>error = 14516.5</p><p>m := 8–0.001 * ((8*10+3–6)*10 + (8*20+3–11)*20)</p><p>c := 3–0.1*((8*10+3–6)+(8*20+3–11))</p><pre>error: 14516.5<br>m: 7.619<br>c: 2.978243</pre><p>now calculate new error with new m and c value;</p><p>if you repeat this process 10 times you will get:</p><pre>1th iteration<br>error: 13096.447052877047<br>m: 7.257115271<br>c: 2.957576005587<br><br> 2th iteration<br>error: 11815.310801857855<br>m: 6.913386779433239<br>c: 2.937944330047583<br><br> 3th iteration<br>error: 10659.501720246768<br>m: 6.586903607471434<br>c: 2.9192960303591593<br><br> 4th iteration<br>error: 9616.759676844307<br>m: 6.276800539006786<br>c: 2.901581769536067<br><br> 5th iteration<br>error: 8676.023887830148<br>m: 5.982255766747838<br>c: 2.884754685881916<br><br> 6th iteration<br>error: 7827.315590603369<br>m: 5.702488714352801<br>c: 2.8687702688016814<br><br> 7th iteration<br>error: 7061.632195054385<br>m: 5.436757967828756<br>c: 2.8535862408444346<br><br> 8th iteration<br>error: 6370.85178948882<br>m: 5.184359310714784<br>c: 2.839162445664121<br><br> 9th iteration<br>error: 5747.646988259523<br>m: 4.9446238578420525<br>c: 2.825460741601462<br><br> 10th iteration<br>error: 5185.4072072540985<br>m: 4.716916282725146<br>c: 2.8124449006049663</pre><p>this is very bad error nut you you repeat this process for 100 times you will get:</p><pre>95th iteration<br>error: 1.0658150106056041<br>m: 0.46037831265621054<br>c: 2.5670644456671083<br><br> 96th iteration<br>error: 0.9854683784524862<br>m: 0.4576582036863987<br>c: 2.5668780581669157<br><br> 97th iteration<br>error: 0.9129808303159086<br>m: 0.455074659327578<br>c: 2.5666994585772995<br><br> 98th iteration<br>error: 0.8475835449031676<br>m: 0.4526208279854672<br>c: 2.566528256201628<br><br> 99th iteration<br>error: 0.7885829111876942<br>m: 0.45029020181758894<br>c: 2.5663640799449348</pre><p>and your new Y value with this m and c is : 7.069266098120824 which is not close to our expected result.</p><p>Applying this algorithm on two values of x did not give better result.But if we are working on more than 1000 values of x then we have to find m and c which gives best result of Y then this algorithm will work fine.</p><p>In this article i am not going to coding part here i tried to explain only mathematical part of this algorithm. I will write one more article to explain more detail of it.</p><p>Hope you like this article and get more intuition of gradient descent algorithm. If you like this algorithm give a clap and share it with your friends. Follow for more articles on mathematics of deep learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=781e350027e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/mathematics-and-ai-optimisation-algorithms-gradient-descent-algorithm-781e350027e1">Mathematics and AI | Optimisation Algorithms| Gradient descent algorithm</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</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 contribute]]></title>
            <link>https://medium.com/mathematics-and-ai/how-to-contribute-74fadbe45a99?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/74fadbe45a99</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[contributor]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Sat, 18 Apr 2020 16:25:22 GMT</pubDate>
            <atom:updated>2020-04-18T16:25:22.416Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey! Explain what you know better and help others to understand the concept.</p><h4>How to contribute?</h4><blockquote>Just send an email of your first write up at <strong>adarshp199877@gmail.com</strong> with subject “<strong>New contributor of Mathematics and AI</strong>”.</blockquote><p>Briefly explain each topic with example and requires graphics and figures. Minimum 170 words required to publish.</p><p>Thank you for joining us. Don’t forget to follow for more updates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74fadbe45a99" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/how-to-contribute-74fadbe45a99">How to contribute</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maths and AI | Concave, Convex Function and Minima and Maxima of a function]]></title>
            <link>https://medium.com/mathematics-and-ai/maths-and-ai-concave-convex-function-and-minima-and-maxima-of-a-function-83b0f65f5cce?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/83b0f65f5cce</guid>
            <category><![CDATA[calculus]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Sat, 18 Apr 2020 16:05:12 GMT</pubDate>
            <atom:updated>2020-04-18T16:05:12.268Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most important term you will see while implementing Machine Learning models is concave , convex functions and maxima and minima of a function. Lets see what it is.</p><p>Plot graph of function f(x) and see its graph. If the function is concave, its graph will be inverted bowl shape and if it convex it shape will be of bowl shape. So next question is how will you plot the graph of a very complex function. example:- g(x) = x² + x*sin(x) + exp(-x), can you plot this function on paper? Probably No without computers help you can not plot them. So how will you find whether g(x) is concave or convex?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*TvQ2jSrAsA40rs_5s2zzJg.png" /><figcaption>Convex and Convex functions</figcaption></figure><p>Lets plot g(x) first can find wether it is concave or convex.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*M3ihMT5II5Mf7724be5PXw.png" /><figcaption>g(x) graph</figcaption></figure><p>This graph helps us to find that g(x) is a convex function. Can you solve this problem without plotting a graph? Let’s solve it mathematically and later we will verify our answer with the help of this graph.</p><h4>Steps to find whether a function is concave or convex:</h4><ol><li>Differentiate function twice.</li><li>if the second derivation of the function is positive then we can say it is convex otherwise the function is convex.</li></ol><p>Solve g(x) using derivative method.</p><p>g(x) = x² + x*sin(x) + exp(-x)</p><p>differentiate g(x) with respect to x.</p><p>g’(x) = 2x + sin(x) + x*cos(x)- exp(-x)</p><p>again differentiate g’(x) with respect to x.</p><p>g’’(x) = 2 + cos(x) + cos(x)- x*sin(x) +e(-x)</p><p>g’’(x) = 2 + 2cos(x)-x*sin(x) + exp(-x)</p><p>Can you explain whether g’’(x) is positive or negative?</p><blockquote>g’’(x) = 2+2cos(x) + exp(-x)- x*sin(x)</blockquote><p>if we choose a range of x from -infinity to 2 that is (-infinity &lt;x≤2). In this range we can say g’’(x) will always be positive .It means this function is convex function which is True. But what if we increase the range of x. If x &lt; 0 then exp(-x) will increase exponentially so g’’(x) will always be greater than 0. What if x &gt; 0?</p><p>In that case g’’(x) only depends on x*sin(x) value . since we know that sin(x) will oscillate from [-1 , 1] . g’’(x) will some times increase some time decrease. But overall if we observe the graph it is increase linearly. Check graph of g’’(x) in range[0,100] .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*mzX-JNhrUu0fR4OpcHHvMw.png" /><figcaption>g’’(x) graph in range [1,100]</figcaption></figure><p>So in that graph x is varying from [-100 , 100]. In some interval g(x) is concave and in some interval it is convex. In this type of problem we can calculate convexity or concavity behaviour in a interval. We can also conclude from the function that global maximum and global minimum value of the function is at infinity and -infinity. That this function have <strong>local minimum</strong> and <strong>local maximum</strong> value in fixed interval. But there is no<strong> global minimum</strong> and <strong>global maximum</strong> value.</p><h4>How to calculate minimum and maximum value of a function:</h4><p>Before we discuss about global minimum and global maximum values, let’s discuss first how to calculate minimum and maximum value?</p><h4>Steps to calculate maxima and minima of a function:</h4><ol><li>Differentiate function f(x) and find value of x=a such that f’(a) = 0</li></ol><p>2. Again differentiate f’(x) and check if f’’(a) ≥ 0 then the f(a) will be minimum value of f(x).</p><p>3. If f’’(a)&lt; 0 then f(a) is maximum value of f(x).</p><p>This calculation helps us to find local minimum and local maximum value of f(x). Local minimum and local maximum value is least and maximum value of a function f(x) in that interval.</p><blockquote>A function f(x) can have more that one local minimum and local maximum value.</blockquote><p><strong>Global Maximum and Global Minimum value</strong></p><blockquote>Global or absolute minimum is the lowest value of the function</blockquote><blockquote>Global or absolute maximum is the greatest value of the function.</blockquote><blockquote>A function f(x) can have only one absolute maximum and absolute minimum value.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*N8GTE16gRMGlwH5rOrpcww.png" /><figcaption>courtesy mathisfun.com</figcaption></figure><p>Hope you like this article and understand the most important concept of maxima and minima and concave, convex functions. If you like this article give a clap. Share it with your friends or in your connections. Follow me and AI and Maths for more future articles on AI algorithms.Here i have point out topics which i will explain in this series. <a href="https://medium.com/@adarshp199877/ai-and-mathematics-121e4e200680">https://medium.com/@adarshp199877/ai-and-mathematics-121e4e200680</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83b0f65f5cce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/maths-and-ai-concave-convex-function-and-minima-and-maxima-of-a-function-83b0f65f5cce">Maths and AI | Concave, Convex Function and Minima and Maxima of a function</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maths and AI | Calculus-1 | Importance of calculus in Machine Learning]]></title>
            <link>https://medium.com/mathematics-and-ai/maths-and-ai-calculus-1-importance-of-calculus-in-machine-learning-f86d7a22f7cf?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/f86d7a22f7cf</guid>
            <category><![CDATA[differentiation]]></category>
            <category><![CDATA[calculus]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Sat, 18 Apr 2020 11:02:13 GMT</pubDate>
            <atom:updated>2020-04-18T11:28:05.906Z</atom:updated>
            <content:encoded><![CDATA[<p>Calculus is one of most important parameter in calculus. In this article I will explain briefly about calculus.Here I am assuming that you have some basic idea of derivatives.</p><h4>What is derivative and how to calculate derivative of a function f(x)?</h4><p>The <strong>derivative</strong> of a function of a real variable measures the sensitivity to change of the output value with respect to a change in its input value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*MLI41ZExUjfmQJUi3tWB5g.png" /><figcaption>Derivative of f(x)</figcaption></figure><p>Let’s take an example to calculate derivative:</p><p>f(x) = 3x+9</p><p>We want to know what is the rate of change of f(x) with small change in x. To calculate this we will find its derivative.</p><p>derivative of f(x) = f’(x) = 3</p><p>So we can conclude from our calculation that in above function, rate of change of f(x) with respect to x will be constant.</p><h4>What is chain rule?</h4><p>So in above example our f(x) was 3x+9 and we simply want to find its rate change with respect to x. Now how will we calculate rate of change of new function g(x) = sin(f(x)). We can rewrite g(x) = sin(3x+9) . Can you find the rate of change of g(x) with respect to x. To differentiate this you have to follow some steps:</p><ol><li>First differentiate Sin(f(x)) with respect to x which is Cos(f(x)).</li></ol><p>2. Now differentiate f(x) with respect to x which is 3.</p><p>3. multiply both differentiations which will be your final answer.</p><p>differentiation of g(x) = cos(f(x))*f’(x) = 3cos(3x+9)</p><blockquote><strong>Advance rules of derivatives (chain rule) which we will use in machine learning.</strong></blockquote><p>suppose y = sin(t) ; t = exp(k) ; k = 3x+9</p><p>You have to find dy/dx . How will you calculate this?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*DaDBWkyLUUxPgEurcNlY_g.png" /><figcaption>dy/dx calculation</figcaption></figure><p>This is how you can compute any differentiation of a function. This formula is widely used in deep learning. Do better practice of this rule to understand deep learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*1k1A3njlm29Uc4pumVooXA.png" /><figcaption><a href="https://quickmath.com/webMathematica3/quickmath/calculus/differentiate/basic.jsp">https://quickmath.com/webMathematica3/quickmath/calculus/differentiate/basic.jsp</a> article</figcaption></figure><p>Here is one of the article which i personally like the most about differentiation.(optional read: — <a href="https://medium.com/analytics-vidhya/unraveling-automatic-differentiation-6d5f0196f219">https://medium.com/analytics-vidhya/unraveling-automatic-differentiation-6d5f0196f219</a>)</p><p>If you understand chain rule and basics of differentiation then you are almost ready to learn machine learning algorithms. Before starting machine learning i will briefly explain the python programming language so that you can write your program and test it.</p><p>Hope you understand this article. If you like my article please give give a clap and write you opinion about this article.Also suggest me how can i improve this article if you found any errors.</p><p>I am writing this articles under the publication AI and Mathematics. So don’t forget to follow that to get latest articles and many more. Share this articles with your friends who love AI or learning AI.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f86d7a22f7cf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/maths-and-ai-calculus-1-importance-of-calculus-in-machine-learning-f86d7a22f7cf">Maths and AI | Calculus-1 | Importance of calculus in Machine Learning</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maths and AI | Inverse of A Matrix]]></title>
            <link>https://medium.com/mathematics-and-ai/maths-and-ai-inverse-of-a-matrix-37169cb98287?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/37169cb98287</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[inverse]]></category>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[linear-algebra]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 14:42:40 GMT</pubDate>
            <atom:updated>2020-04-17T14:42:40.720Z</atom:updated>
            <content:encoded><![CDATA[<p>Second article of Linear Algebra series.</p><p>In previous article I explain about matrix and its multiplication and Transpose of matrix. In this article we will find the inverse of a matrix and its importance.</p><h4>What is inverse?</h4><p>Let’s take a example to understand better this concept. given a number A= 8 , you have to find the inverse of A. To calculate this we have to just get reciprocal of the number that is 1/8 . If you multiply number with its inverse you will get 1. Same concept had been used in matrix inverse also. Only difference here is that here you have to calculate inverse of a arranged collection of numbers in systematic way. So that if we multiply original matrix with its inverse we get Identity matrix.</p><h4>Why we need Inverse of matrix?</h4><p>If we take a simple example of two linear equation. And you have to calculate the variables x and y. We can solve this problem in two ways.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*qIPff8vq2YVITKRVac-K3Q.png" /><figcaption>two linear equation</figcaption></figure><p>1st Method is put the value of y = 10–4x in first equation and get value of x and then value of y. But this method will be so difficult if we have large set of variables. In that case you have to use matrix method. In computer programming implementing matrix is much easier than any other method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*hN8XOgdtzpQXCzZ0fn247A.png" /><figcaption>Matrix form of equation</figcaption></figure><p>We can rewrite the above equation in matrix form. Here our linear equation in matrix form is:</p><p>AX = b</p><p>X = b/A</p><p>we know that 1/A is inverse of A.</p><p>X = b* Inverse(A);</p><p>to get the value of X we have to divide b with A. In matrix you can not simply divide two matrices. But we know how to multiply matrices. So to get the value of X we have to multiply b with inverse of A.</p><h4>Now the most important question is how to calculate inverse of A?</h4><p>We have to check some points before our calculation.</p><ol><li>Number of rows should be equal to number of columns.(Square matrix)</li><li>It’s determinant must not be equal to zero.</li></ol><p>Steps to calculate inverse of a matrix.</p><ol><li>Calculate determinant of the matrix. In this example determinant is (2*1–3*4 = -10).</li><li>Find adjoint of matrix.</li><li>Inverse(A) = adjoint(A)/(determinant(A))</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1y8Z5HjFAxB5IcNlObXJA.png" /><figcaption>Inverse of A</figcaption></figure><p>Once you calculate the inverse matrix simply multiply with b matrix. That will be your final answer of X.</p><p>Inverse of a matrix is one of the most important term in Machine learning or computer programming. You can find in-build functions in many programming languages to calculate inverse of matrix.</p><p>So I hope you have some better understanding about the importance if Inverse in matrix and its some basic use. I will explain other uses of it in Machine learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37169cb98287" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/maths-and-ai-inverse-of-a-matrix-37169cb98287">Maths and AI | Inverse of A Matrix</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics Of Linear Alzebra | What is Matrix?]]></title>
            <link>https://medium.com/mathematics-and-ai/basics-of-linear-alzebra-what-is-matrix-20ef559e2ba5?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/20ef559e2ba5</guid>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[multiplication]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[linear-alzebra]]></category>
            <category><![CDATA[transpose]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 13:36:45 GMT</pubDate>
            <atom:updated>2020-04-19T12:32:41.518Z</atom:updated>
            <content:encoded><![CDATA[<h3>Basics Of Linear Algebra | What is Matrix? How to add and Multiply two matrices? How to Transpose a Matrix ?</h3><p>This is my first Article of Maths and AI series. This article is all about basics of linear algebra. Here I will explain about matrix and different types of matrix.</p><h4><strong>What is matrix?</strong></h4><p>A matrix is a rectangular a<em>rray</em> of numbers, symbols, or expressions, arranged in r<em>ows</em> and c<em>olumns</em>. Okay let me explain this definition with a simple example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*u3OB7hMAXh4uMakb9yNDgA.png" /><figcaption>A 2*2 matrix of Integers</figcaption></figure><p>Above example is matrix of numbers . You can replace the numbers other elements such as alphabets , or any equations.</p><p>No of rows in above matrix is: 2</p><p>No of columns in above matrix is: 2</p><h4>How to write the dimension of the matrix?</h4><p>Dimension- (number of row ,number of columns)</p><p>so the dimension of above matrix is:- (2,2)</p><h4>How to Add Two Matrices?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*MOH9QJyh1LnxJkq4HIXSgA.png" /><figcaption>Two (2*2) matrix</figcaption></figure><p>Let say A is a matrix with dimension (2,2) and B is a matrix with dimension (2,2). So how will you calculate their sum?</p><blockquote>Before we add matrices check the dimensions of matrices. To add two matrices <strong>both the matrices must have the same dimensions</strong>.</blockquote><p>So A and B have same dimesion. We can add them direclty. So our Answer matrix C = A+B</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*Ykn1TcgL1VfrWwiDJCeDnw.png" /><figcaption>Sum of A and B matrix</figcaption></figure><blockquote>Dimension of C will be equal to dimension of A and B.</blockquote><p><strong>How to Multiply two matrices?</strong></p><blockquote>Let M is equal to multiplication result of A and B. For valid multiplication of two matrices we have to check first that <strong>No of columns in matrix A should be equal to No of rows of Matrix B.</strong></blockquote><p>Dimension of matrix M will be equal to (No of rows in Matrix A * No of Columns in Matrix B). In above example Dimension of M is (2,2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*_fALppmWUbVRbHNheUwC2A.png" /><figcaption>Multiplication of A and B</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*ApiJAO7rtg0i0s4oP9eBWw.png" /><figcaption>Final M matrix</figcaption></figure><p>Here you can check more examples of matrix multiplication.</p><h3>Transpose a Matrix?</h3><p>To transpose Matrix A you have to replace rows with columns and vice versa.</p><p>Lets take example of A. To Transpose matrix A :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*oUn7_lb7ua2BTNb109fdMw.png" /><figcaption>Transpose of Matrix A</figcaption></figure><h3>Summary:</h3><p>Here is quick summary what you had learn in this article-</p><ol><li>Two matrices can be added only when they have same dimension</li><li>To multiply two matrices check dimensions of both the matrices and match number of columns of matrix A should be equal to number of rows in matrix B.</li></ol><p>3. To transpose a matrix just replace rows with columns and vice versa.</p><p>This was my first article on Mathematics and AI. Hope you get better understanding about matrix addition and multiplication. Don’t forget to check other resources for better understanding. In next article I will explain how to calculate Inverse of Matrix.</p><p>Thanks for reading this article. If you have any better suggestion to improve this article or other articles then please let me know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20ef559e2ba5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/basics-of-linear-alzebra-what-is-matrix-20ef559e2ba5">Basics Of Linear Alzebra | What is Matrix?</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI and Mathematics]]></title>
            <link>https://medium.com/mathematics-and-ai/ai-and-mathematics-121e4e200680?source=rss-b52f579252de------2</link>
            <guid isPermaLink="false">https://medium.com/p/121e4e200680</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Adarsh Pathak]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 11:38:23 GMT</pubDate>
            <atom:updated>2020-04-17T15:06:05.525Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*8x6gapymd9kBPDtrKadV0Q.png" /></figure><p>From now I will daily post one articles here. It will simply explain the hidden side of Artificial Intelligence. Even if you less mathematics or programming knowledge you can learn how Deep Learning is working, how to develop your own neural network from scratch. I will try to simplify each topics with better example. These are some topics which I will explain in detail.</p><p>Topics:</p><ol><li>Linear Algebra</li></ol><p>2. Calculus and Optimisation</p><p>3. Python</p><p>4. Numpy and Pandas</p><p>5. Plotting and Data Visualization</p><p>6. Machine Learning</p><p>7. Deep Learning-1(Introduction)</p><p>8. Bayesian Methods for Machine Learning</p><p>9. Natural Language Processing</p><p>10. Reinforcement Learning</p><p>11. Deep Learning in Computer Vision</p><p>I will explain how you can develop your deep learning/ Machine Learning models without using and external library. This series will be mostly mathematical. So I will explain all mathematical terms used in this topics, so you can easily understand how mathematics is working in backend of each model.</p><p>Along with this I will share links of useful resources and articles so that you can get better intuition.</p><p>You can suggest me any topic which I should Explain. If you find any error please let me know. I will correct it as soon as possible and try to minimise error as much as I can do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=121e4e200680" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mathematics-and-ai/ai-and-mathematics-121e4e200680">AI and Mathematics</a> was originally published in <a href="https://medium.com/mathematics-and-ai">Mathematics and AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>