<?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 Balaji Venktesh on Medium]]></title>
        <description><![CDATA[Stories by Balaji Venktesh on Medium]]></description>
        <link>https://medium.com/@balajivenky06?source=rss-215d4bf8d7e1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Balaji Venktesh on Medium</title>
            <link>https://medium.com/@balajivenky06?source=rss-215d4bf8d7e1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:40:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@balajivenky06/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[Importance of Taylor Series in Deep Learning Models !!]]></title>
            <link>https://medium.com/@balajivenky06/importance-of-taylor-series-in-deep-learning-models-81275d0e19a6?source=rss-215d4bf8d7e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/81275d0e19a6</guid>
            <category><![CDATA[taylor-series]]></category>
            <category><![CDATA[calculus]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gradient-descent-math]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Balaji Venktesh]]></dc:creator>
            <pubDate>Sun, 08 Aug 2021 14:10:09 GMT</pubDate>
            <atom:updated>2021-11-16T03:07:16.147Z</atom:updated>
            <content:encoded><![CDATA[<h3>Importance of Taylor Series in Deep Learning Models !!</h3><p>Hello Friends,</p><p>Welcome Back !! I took some time to choose an interesting topic for our readers to benefit. We have been talking around in general topic related to analytics and this time i wanted to focus on one of the fundamental mathematic concepts we read during our school days, yet we not sure where it has been applied in real world applications — “<a href="https://en.wikipedia.org/wiki/Taylor_series"><strong>Taylor Series</strong></a>”.</p><p>Earlier in my previous article — <a href="https://ainxt.co.in/six-modules-of-any-machine-learning-applications/">https://ainxt.co.in/six-modules-of-any-machine-learning-applications/</a>, we talked about 6 jars of any Machine Learning Models — Data, Tasks, Models, Loss Functions, Learning Algorithm &amp; Evaluation. Today we will uncover, how “ <a href="https://mathworld.wolfram.com/TaylorSeries.html">Taylor Series</a>” applied in Loss Functions for effective learning models particularly in the context of <a href="https://ainxt.co.in/temperature-prediction-with-tensorflow-dataset-using-cnn-lstm/">Deep Learning</a> Models.</p><p>To get into the basics, Refer our previous articles highlighted below, in order to make most out of this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/167/0*JZ858_PLoIobeJ0T" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/163/0*nIsQ298hH4WGUvvv" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/157/0*fK9HGP4DhyERjw-M" /></figure><h3>Introduction</h3><p>In a nutshell, Learning Algorithms are how effectively our Machine Learning models able to understand the mapping between Input Variables vs Output Predictor variables. Consider below example, in order to predict O/P from given I/P values, we used Sigmoid Function <strong>1 / 1 + e ^-( (w*x ) + b)</strong> (To know more about this — Refer our earlier article -&gt; <a href="https://ainxt.co.in/deep-learning-on-types-of-activation-functions/">https://ainxt.co.in/deep-learning-on-types-of-activation-functions/</a> ) as our learning function.</p><p>Now learning algorithm will iterate with different values “ <strong>w</strong>” (the slope) &amp; “ <strong>b</strong> “ (the intercept) and compute the loss function i.e. difference between predicted output values vs original output values for a given inputs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*sifFrlvfjtZJjWhm.png" /></figure><h3>Random Guessing</h3><p>What is the best way to determine w &amp; b such that loss function achieved global minimum value ?</p><p>Earlier we started with “ <strong>Random Guess”</strong> of w &amp; b values (say begin with 0). Lets say this loss value is our baseline value. Next we will slightly increase/decrease the value of w &amp; b such that <strong>w = w</strong>+/- <strong>Δw &amp; b = b +/- Δb</strong>. This new w &amp; b might reduce the loss or can increase the loss, depending on which our next guess depends on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*AxOdudAp5qRGU7OT.png" /></figure><p>The only problem in this manual guess approach is <strong>Δw &amp; Δb </strong>is coming from random guess and we cant assure of guess will reach us to global minimum after certain iterations. Also we cant afford to run operations for more number of times.</p><p>Hence, we need a more principle way of “ <strong>calculating loss which is guided by mathematical loss functions</strong> “. Our objective is whenever we change the value of w &amp; b, we want to ensure that loss is steadily decreasing.</p><h3>Mathematical Approach</h3><p>So, Let’s assume a vector <strong>θ = [w, b] </strong>and want to find optimal vector <strong>Δθ = [Δw, Δb] </strong>by changing different values of w &amp; b. While changing the values of w &amp; b, we want to ensure the change in values is very small. Hence we multiply <strong>η</strong> with <strong>Δw, Δb </strong>where <strong>η -&gt; Step Controller </strong>such that <strong>θ = θ +/- η*Δθ</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*nD-3XWheBSNoUrJB.png" /></figure><p>Now the question still remain how do i get the <strong>Δθ </strong>in a principled manner, so that every point when i compute loss <strong>L(θ)new</strong> with new values of w &amp; b should be less than <strong>L(θ)old </strong>i.e.<strong> L(w) &gt; L(w+η*Δw)</strong>. We need to prove that new <strong>Δw, Δb </strong>values loss values less than previous values. This opens up our interest of today’s topic “<a href="https://tutorial.math.lamar.edu/classes/calcii/taylorseries.aspx"><strong>Taylor Series</strong></a>”.</p><h3>Taylor Series Introduction</h3><p>What Taylor Series tells us that if you have a function <strong>f(x)</strong> and if you know that value of that function at certain point( <strong>say x</strong>), then it’s value at new point which is very close to x, can be given by below expression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*mO6AP7KIARr8Qa25.png" /></figure><p>Now lets correlate this equation with our problem. We are going to take a small step away from w i.e. <strong>Δw</strong> and we want to make sure the loss decreases. Voila!!!!!!! Taylor series actually helps to find the next small step. How ? Let’s breakdown !!</p><p>If you notice the formula of Taylor Series, the function value after the small step <strong>f(x+Δx)</strong> as compared to function before small step<strong> f(x) is “f(x) + Sum Of Other Values” </strong>as highlighted below. This “ <strong>Sum of other values</strong>” actually depends on <strong>Δx</strong>. If <strong>Δx </strong>is such that <strong>“Sum of Other Values” </strong>that is adding to<strong> f(x) </strong>to be negative, then the new loss <strong>f(x+Δx) &lt; f(x).</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*7EFWESRJ4DoJQlbp.png" /></figure><p>So, we need to find <strong>Δx </strong>such that right side of equation -ve. The more -ve, the more better. <strong>f’(x), f”(x), f”’(x) -&gt; </strong>are derivatives of given input function f(x).</p><p>Example: Let <strong>f(x)</strong> = x³ then 1st Order derivative <strong>f’(x) = d/dx(f(x))</strong>=3*x², similarly 2nd Order derivative<strong> f”(x) = d/dx(f’(x))</strong>=6x</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*HTUv0HF3LTmBSHd6.png" /></figure><p><strong>Note:</strong> Now you can assume value for x (say x=3) and very small step size <strong>Δx </strong>(say Δx=0.0001) and substitute in Taylor series formula and see if loss value decreased or not. If not, then our assumption of <strong>Δx</strong> is not good.</p><h3>More Intuitions about Taylor Series</h3><p>To make more sense, i replaced function <strong>f</strong> with <strong>L</strong> that denotes loss function &amp; replaced <strong>x</strong> &amp; <strong>Δx </strong>with<strong> w &amp; Δw -&gt; </strong>slope loss value we try to minimize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*4Y_41OGx1Qh1e1MM.png" /></figure><p>Again i repeat, crux of taylor series is somehow we need to find <strong>Δw</strong>, so that “ <strong>Sum of Other Values</strong>” turns to be <strong>-Ve</strong>. Then new loss will be small than previous value.</p><p>In above formula, we represent only scalar loss function i.e. only for slope w, but we know we have to compute new value for intercept b also, hence we represent the Taylor Series as Vector <strong>θ = [w, b]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*9ufs98HjT-eOiKT5.png" /></figure><p>Let’s simply our new Vector — Taylor Series Formula, we know <strong>η </strong>will always be very small<strong> (say η = 0.0001)</strong>. If so next higher order terms like <strong>η², η³ </strong>will be very very small, hence can be approximated to 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*kyFFozDlaj5JtJYI.png" /></figure><p>Now all our job is to find the value of <strong>u</strong> i.e. <strong>Δθ</strong> , such that <strong>η*u^T*Δθ*L(θ)</strong> will be negative.</p><h3>Partial Derivatives To Gradient’s</h3><p>By comparing <strong>Δθ*L(θ)</strong> analogy with Original Taylor Series Equation, it is 1st order partial derivative since <strong>θ </strong>is a vector of<strong> [w, b] </strong>i.e. vector with 2 variables.</p><p>What is <a href="https://en.wikipedia.org/wiki/Partial_derivative"><strong>Partial Derivatives</strong></a> ? Lets start with derivative function <strong>f(w) = w³</strong>, then 1st order derivative <strong>d/dw(f(w))= 3*w²</strong>. But i now have a function dependent on 2 variables <strong>f(w, b) = w³ + b²</strong>. In this case, we can find derivative with respect to w first and with respect to b separately, called as <a href="https://www.khanacademy.org/math/multivariable-calculus/multivariable-derivatives/partial-derivative-and-gradient-articles/a/introduction-to-partial-derivatives">Partial Derivatives</a>.</p><p>Hence, <strong>∂f(w, b)/∂w = 3*w²</strong> -&gt; calculating partial derivative 0f w keeping b as constant. Similarly <strong>∂f(w, b)/∂b = 2*b</strong> by keeping 2 as constant. Putting these partial derivatives in vector as below is known as “<a href="https://en.wikipedia.org/wiki/Gradient_descent#:~:text=Gradient%20descent%20is%20a%20first,the%20direction%20of%20steepest%20descent."><strong>Gradient</strong></a>” ​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*F22Mx7EphWsxksu3.png" /></figure><p>Going back, <strong>Δθ*L(θ)</strong> is nothing but collection of partial derivatives with respect to w &amp; b. We know <strong>L(θ+Δu) </strong>-&gt; Real No { <strong>ℝ}</strong>, <strong>L(θ) </strong>-&gt; also a real no { <strong>ℝ</strong>}, <strong>η</strong> -&gt; also a real no {ℝ}, hence <strong>u^T*Δθ*L(θ)</strong> should also be a real no !!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*mnnU62umkJMvKWFW.png" /></figure><h3>Gradient Descent Update Rule</h3><p>So far we have came to, <strong>L(θ+η*u) = L(θ) + η*u^T*Δθ*L(θ)</strong>. We are yet to find the value of <strong>u</strong> such that <strong>η*u^T*Δθ*L(θ) </strong>becomes -Ve.</p><p>Rewriting above equation as <strong>L(θ+η*u) — L(θ) = η*w</strong>. The New move <strong>η*u</strong> would be favorable only if, <strong>L(θ+η*u) — L(θ) &lt; 0 </strong>implies <strong>u^T*Δθ*L(θ) &lt; 0</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*QhIHcXW9xXow3nrC.png" /></figure><p><strong>u </strong>is vector of<strong> [w, b] </strong>and <strong>Δθ*L(θ) </strong>is again a gradient vector of partial derivatives with respect to w &amp; b as saw earlier. Whenever a <a href="https://en.wikipedia.org/wiki/Dot_product"><strong>dot product</strong></a> happens between 2 vectors, there involves “ <strong>Cos</strong> <strong>Angle </strong>— <strong>β</strong>” between these 2 vectors given as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*nZd9YtHAkx7lumaa.png" /></figure><p>We are interested only in Numerator, hence multiply throughout by denominator, we get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*ukUYa_1N14nnHDEo.png" /></figure><p>we want <strong>u^T*Δθ*L(θ) </strong>as negative as possible and maximum negative we can achieve<strong> -k </strong>and this will happen only when <strong>cos angle -β </strong>between 2 vectors is<strong> -1</strong>. From elementary mathematics,<strong> Cos = -1</strong> then <strong>β = 180 degrees</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*tYC702-bev-XPOtO.png" /></figure><p>Thus, Gradient Descent Rule,</p><ul><li>The direction that we intend to move in should be 180 degree with respect to the gradient</li><li>In other words, move in a opposite direction to the gradient</li></ul><h3>Updated Parameter Rule</h3><p>Now our parameter update rule looks like find the gradients <strong>Δw &amp; Δb </strong>and move in opposite direction, hence<strong> “-” </strong>in the formula.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*TcS99Sn7dqqAF5jP.png" /></figure><h3>Complete Learning Algorithm</h3><p>Finally, we saw the update rule where the vector <strong>u </strong>and <strong>gradient vector </strong>should be opposite to each other i.e. <strong>u = -Δθ*L(θ)</strong> so that angle between them is 180 degrees. So we have data i/p &amp; original o/p given, fitted in a model that uses sigmoid function. Now we use the update rule such that Loss function reaches global minima.</p><p>We initialize random w, b values first and substitute in sigmoid function and find the predicted o/p &amp; compute Loss function <strong>L(w, b)</strong> i.e. sum of squares of difference between Original Vs Predicted Output values. Once we have the loss function, we can find the derivative of Loss function with respect to w &amp; b i.e. <strong>Δw =</strong></p><p>We can fix step size <strong>η </strong>such that <strong>Δw &amp; Δb </strong>are very very small. Using this we can find new w &amp; b which when plugged in sigmoid function, the loss between previous predicted outcome vs new predicted outcome is actually lesser. We will iterate over certain steps such than there is no improvement in loss values, we reached our minima.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*FFTa3Fkndha3Lkga.png" /></figure><h3>Conclusion:</h3><p>Almost every machine learning algorithm one or other way uses <a href="https://machinelearningmastery.com/gradient-descent-for-machine-learning/">Gradient Descent Optimization</a> to compute loss function such that our models performs better. Taylor Series is actually behind Gradient Descent Rule Algorithm. We might have studied Taylor Series in our school days but without understanding the intuitions / logic behind and its practical application. We also noticed that we used little bit of trigonometry like cos , dot products which in turn helps to come to our derive the final rules.</p><p>I hope this article gives you a new source of information and do let us know your kind feedback to improvise further. <strong><em>I have taken inspiration from IIT professor Mithesh Khapra’s original course on </em></strong><a href="https://www.investopedia.com/terms/d/deep-learning.asp#:~:text=Deep%20learning%20is%20an%20artificial,for%20use%20in%20decision%20making.&amp;text=Also%20known%20as%20deep%20neural%20learning%20or%20deep%20neural%20network."><strong><em>Deep Learning</em></strong></a><strong><em> offered at </em></strong><a href="https://padhai.onefourthlabs.in/"><strong><em>https://padhai.onefourthlabs.in/</em></strong></a><strong><em> for this article</em></strong>.</p><p>Do check his course for more information. We will back with next article, till then keep reading our other articles 🙂</p><ul><li><a href="https://ainxt.co.in/deep-learning-on-types-of-activation-functions/">https://ainxt.co.in/deep-learning-on-types-of-activation-functions/</a></li><li><a href="https://ainxt.co.in/vectors-and-matrices-why-do-we-care-for-them-in-analytics/">https://ainxt.co.in/vectors-and-matrices-why-do-we-care-for-them-in-analytics/</a></li><li><a href="https://ainxt.co.in/understanding-feature-selection-for-model-accuracy-in-regression/">https://ainxt.co.in/understanding-feature-selection-for-model-accuracy-in-regression/</a></li><li><a href="https://ainxt.co.in/complete-guide-to-clustering-techniques/">https://ainxt.co.in/complete-guide-to-clustering-techniques/</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/164/0*lMeakui0l7_8fAd6" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/167/0*KElnOL9lhqeYUp3v" /></figure><p><em>Originally published at </em><a href="https://ainxt.co.in/importance-of-taylor-series-in-deep-learning-machine-learning-models/"><em>https://ainxt.co.in</em></a><em> on August 8, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81275d0e19a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>