<?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 Atul Arya on Medium]]></title>
        <description><![CDATA[Stories by Atul Arya on Medium]]></description>
        <link>https://medium.com/@atularya.iitkgp?source=rss-ea83b6b1ba4f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IkDqRsc-R20OrBCRCGverw.png</url>
            <title>Stories by Atul Arya on Medium</title>
            <link>https://medium.com/@atularya.iitkgp?source=rss-ea83b6b1ba4f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:33:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@atularya.iitkgp/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[Why Adam Became the Default Optimizer in Deep Learning]]></title>
            <link>https://medium.com/@atularya.iitkgp/why-adam-became-the-default-optimizer-in-deep-learning-366f51611396?source=rss-ea83b6b1ba4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/366f51611396</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Atul Arya]]></dc:creator>
            <pubDate>Mon, 25 May 2026 13:41:00 GMT</pubDate>
            <atom:updated>2026-05-26T07:31:04.329Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riJGmk1SSI5uYGbk-IFWVQ.png" /></figure><p>Vanilla gradient descent has a problem.</p><p>Imagine you’re descending a narrow mountain valley — steep walls on either side, a gentle slope running along the bottom toward the minimum.</p><p>A fixed-step optimizer like SGD looks at the current slope and takes a step. But the slope sideways is much steeper than the slope forward. So it overcorrects side to side, zigzagging violently across the valley instead of moving cleanly along the bottom.</p><p>Each zigzag wastes a step. The model is technically learning, but slowly and clumsily — spending most of its energy correcting its own overcorrections instead of moving toward the answer.</p><p>This is the core problem that a generation of optimizers was designed to solve. And Adam is where that story ends.</p><h3>Quick Recap: Where We Are</h3><p>In Post 1, <a href="https://medium.com/@atularya.iitkgp/gradient-descent-explained-intuitively-for-machine-learning-08364f797288">gradient descent</a> takes a step downhill by a size set by the learning rate α.</p><p>In Post 2, the <a href="https://medium.com/p/47e69cf39fa0">loss function</a> defines what “downhill” means.</p><p>In Post 3, <a href="https://medium.com/p/52f2181a454f">backpropagation</a> tells every weight its gradient — how much it contributed to the error.</p><p>What we never questioned: <em>is taking the same size step every time actually smart?</em></p><p>It isn’t. And that’s what this post is about.</p><h3>Problem 1: SGD Zigzags</h3><p>SGD (Stochastic Gradient Descent) is the simplest optimizer. At each step, it computes the gradient and moves in the opposite direction by a fixed amount.</p><pre>w := w − α · gradient</pre><p>The problem is that this treats every direction identically. In a loss landscape with steep walls and a gentle floor — which is common in deep learning — SGD bounces back and forth between the walls while inching forward along the floor.</p><p>The result: slow convergence, noisy training curves, and sensitivity to the choice of learning rate. Too large, and it bounces forever. Too small, and it crawls.</p><h3>The First Fix: Momentum</h3><p>Momentum adds one idea: memory.</p><p>Instead of reacting only to the current gradient, it builds up a velocity — like a ball rolling downhill that accelerates as it goes.</p><pre>v := β · v + α · gradient<br>w := w − v</pre><p>The β term (typically 0.9) controls how much past gradients influence the current step. A high β means the optimizer remembers more history and builds up more speed in consistent directions.</p><p>This dampens the sideways zigzagging beautifully. When gradients keep pointing in the same direction (down the valley floor), momentum builds up and the optimizer moves faster. When gradients keep reversing (bouncing off the walls), momentum cancels them out.</p><p><strong>What Momentum fixes:</strong> zigzagging, slow progress through ravines. <strong>What it doesn’t fix:</strong> it still uses the same learning rate for every parameter.</p><h3>Problem 2: Not All Parameters Are Equal</h3><p>Here’s something SGD and Momentum both ignore: different parameters need different step sizes.</p><p>In a deep neural network, some weights get large gradients on almost every step — they’re highly active, constantly being nudged. Others get tiny gradients rarely — they’re mostly dormant, perhaps connected to rare features.</p><p>If you use the same learning rate for both, you’re making a bad trade-off. The active weights take steps that are too large and overshoot. The dormant weights take steps that are too small and barely learn.</p><p>What you really want is an optimizer that adapts — giving larger steps to parameters that haven’t moved much, and smaller steps to parameters that have been moving a lot.</p><h3>The Full Fix: Adam</h3><p>Adam (Adaptive Moment Estimation) solves both problems simultaneously.</p><p>It maintains two running values for each parameter:</p><p><strong>m — the first moment (mean of gradients).</strong> This is essentially momentum — a smoothed average of recent gradients that dampens zigzagging.</p><p><strong>v — the second moment (mean of squared gradients).</strong> This tracks how large the gradients have been. Parameters with consistently large gradients get a large v. Parameters with small or rare gradients get a small v.</p><p>The update rule divides by the square root of v:</p><pre>w := w − α · m / (√v + ε)</pre><p>In plain English: the step size for each weight is automatically scaled by its gradient history.</p><ul><li><strong>Large v</strong> (weight has been getting big gradients) → divide by a large number → small effective step → prevents overshooting</li><li><strong>Small v</strong> (weight rarely updates) → divide by a small number → large effective step → helps dormant weights actually learn</li></ul><p>The ε (epsilon) is just a tiny number added to prevent division by zero.</p><p><strong>What Adam fixes:</strong> zigzagging (via momentum) + unequal parameter scaling (via adaptive rates). It works well out of the box, with almost no tuning required. This is why it became the default.</p><h3>SGD vs Momentum vs Adam: The Visual Story</h3><p>On a ravine-shaped loss surface:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Paq2x6mndL4Y-NNl0uSgBQ.png" /></figure><p>One honest caveat: for certain tasks — particularly image classification with careful tuning — SGD with momentum can still outperform Adam on final accuracy. Adam gets you there faster; SGD sometimes gets you slightly further. In practice, Adam is the sensible default for most problems, especially when starting out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1qnGO1rR2ezQdynXHEg86A.png" /></figure><h3>The Full Series in One Paragraph</h3><p>A neural network makes predictions <strong>(forward pass)</strong>. Gradient descent is the algorithm trying to mininze the error. Those predictions are scored by a <strong>loss function</strong>. The score travels backwards through the network via <strong>backpropagation</strong>, giving every weight its gradient. Then an <strong>optimizer</strong> — ideally Adam — uses those gradients to update the weights to decides exactly how to take the downhill steps: how large, how adaptive, how fast. Repeat thousands of times. That’s deep learning.</p><p>These four concepts aren’t separate topics. They’re a single loop, running on every training step of every model ever built.</p><p>If you’re just joining this series, start with <a href="https://medium.com/@atularya.iitkgp/gradient-descent-explained-intuitively-for-machine-learning-08364f797288?postPublishedType=repub">Part 1: Gradient Descent</a> Explained, then <a href="https://medium.com/@atularya.iitkgp/what-are-loss-functions-the-scorecards-of-machine-learning-47e69cf39fa0?postPublishedType=repub">Part 2: Loss Functions</a>, then <a href="https://medium.com/@atularya.iitkgp/backpropagation-explained-without-the-scary-math-52f2181a454f?postPublishedType=repub">Part 3: Backpropagation</a> before reading this post — each one builds directly on the last.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=366f51611396" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backpropagation Explained Without the Scary Math]]></title>
            <link>https://medium.com/@atularya.iitkgp/backpropagation-explained-without-the-scary-math-52f2181a454f?source=rss-ea83b6b1ba4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/52f2181a454f</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Atul Arya]]></dc:creator>
            <pubDate>Sun, 24 May 2026 13:26:00 GMT</pubDate>
            <atom:updated>2026-05-26T07:05:11.951Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PwRJmHcl1GSu1YCB8ceV8Q.png" /></figure><p>Imagine you’re a manager overseeing a four-person assembly line.</p><p>At the end of the line, a product comes out defective. You need to figure out who made the mistake.</p><p>You don’t start from the beginning of the line. You start at the end — with the last person — and work backwards. How much did <em>they</em> contribute to the defect? Then the person before them. Then the one before that. All the way back to the start.</p><p>That is backpropagation.</p><p>It’s not a mysterious algorithm. It’s a structured way of assigning blame — tracing an error backwards through a neural network so that every weight knows exactly how much it contributed to the mistake.</p><h3>Quick Recap: Where We Are in the Series</h3><p>In Post 1, we learned that <a href="https://medium.com/@atularya.iitkgp/gradient-descent-explained-intuitively-for-machine-learning-08364f797288">gradient descent</a> rolls a model “downhill” toward lower error by adjusting its parameters step by step.</p><p>In Post 2, we learned that <a href="https://medium.com/p/47e69cf39fa0">loss functions</a> define what “error” actually means — they measure the distance between the model’s prediction and the correct answer.</p><p>But we left one question unanswered:</p><p><em>In a deep neural network with millions of weights across dozens of layers — how does gradient descent know which weights to adjust, and by how much?</em></p><p>That’s the job of backpropagation.</p><h3>What a Neural Network Actually Does</h3><p>Before we go backwards, let’s quickly go forwards.</p><p>A neural network is a series of layers. Each layer takes numbers in, multiplies them by weights, adds a bias, and passes the result to the next layer. This happens over and over until the final layer produces a prediction.</p><p>This left-to-right journey is called the <strong>forward pass</strong>.</p><p>Think of it like a telephone game. A message (your input data) enters at one end, gets transformed at each station, and arrives at the other end as a prediction. If the prediction is wrong, someone along the line made a bad transformation.</p><p>Backpropagation figures out who.</p><h3>Phase 1: The Forward Pass</h3><p>Data enters the network at the input layer.</p><p>Each neuron receives some inputs, multiplies each one by its weight (how much importance it assigns to that input), sums them up, and passes the result forward.</p><p>Layer by layer, this continues until the output layer produces a number — the model’s prediction.</p><p>At this stage, the network doesn’t know if it’s right or wrong. It’s just doing math, left to right.</p><h3>Phase 2: Compute the Loss</h3><p>The prediction reaches the end. Now we compare it to the correct answer using a loss function.</p><p>The result is a single number: the loss.</p><p>High loss means the prediction was far off. Low loss means it was close.</p><p>This number is the starting signal for everything that follows. Without it, the network has no feedback. With it, it has a precise measure of how wrong it was — and that’s enough to start fixing things.</p><h3>Phase 3: The Backward Pass</h3><p>Here’s where backpropagation begins.</p><p>The loss travels backwards through the network, one layer at a time, asking the same question at each step:</p><p><em>How much did this layer’s weights contribute to the final error?</em></p><p>The layer closest to the output answers first — it gets the full error signal and calculates its share of the blame. It then passes a modified signal to the layer before it. That layer does the same calculation. And so on, all the way back to the first layer.</p><p>By the time the signal reaches the input layer, every single weight in the network has received a number — its <strong>gradient</strong> — that says: <em>if you increase this weight slightly, here’s how much the loss will increase or decrease.</em></p><p>No chain rule notation required to understand this intuitively. Think of it as a report card traveling backwards through the assembly line. Each worker (layer) gets their score. The question “how do I improve?” is answered before the next shift (next training step) begins.</p><h3>Phase 4: Update the Weights</h3><p>Now gradient descent takes over.</p><p>Every weight in the network gets nudged slightly in the direction that reduces the loss, by an amount controlled by the learning rate α.</p><pre>w := w − α · gradient</pre><p>This is exactly the same update rule from Post 1 — applied now to every weight in the entire network simultaneously.</p><p>One full cycle — forward pass → loss → backward pass → weight update — is called one <strong>training step</strong>.</p><p>A typical model does this thousands or millions of times. Each step, the weights shift slightly. Each shift makes the predictions a little more accurate. The loss slowly falls.</p><p>That’s learning.</p><h3>Why Backprop Was a Big Deal</h3><p>Before backpropagation was popularized in the 1980s, training deep neural networks was largely unsolved. Nobody had an efficient way to figure out how to update weights in middle layers — layers far from the output where the error signal was hard to trace.</p><p>Backpropagation solved this cleanly: compute the loss at the end, propagate the blame backwards layer by layer, update everything at once.</p><p>This single insight unlocked deep learning. Without it, modern neural networks — the kind that power image recognition, language models, and everything in between — wouldn’t exist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rw9O_FNJzDq-tZdLsJnkCQ.png" /></figure><h3>The Full Picture So Far</h3><p>Three posts in, here’s what we’ve built:</p><ol><li><a href="https://medium.com/@atularya.iitkgp/gradient-descent-explained-intuitively-for-machine-learning-08364f797288?postPublishedType=repub"><strong>Gradient descent</strong></a> — the algorithm that rolls the model toward lower error</li><li><a href="https://medium.com/@atularya.iitkgp/what-are-loss-functions-the-scorecards-of-machine-learning-47e69cf39fa0"><strong>Loss functions</strong></a> — the scorecards that measure how wrong a prediction is</li><li><strong>Backpropagation</strong> — the mechanism that tells every weight in the network exactly how much it contributed to the error</li></ol><p>These three things work together on every single training step of every neural network ever trained.</p><p>There’s one piece left: <em>what if gradient descent itself could be smarter?</em> What if instead of taking the same size step every time, it adapted — moving faster when it’s confident, slower when the terrain is tricky?</p><p>That’s what optimizers do. And Adam is the one that changed everything.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52f2181a454f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Are Loss Functions? The Scorecards of Machine Learning]]></title>
            <link>https://medium.com/@atularya.iitkgp/what-are-loss-functions-the-scorecards-of-machine-learning-47e69cf39fa0?source=rss-ea83b6b1ba4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/47e69cf39fa0</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Atul Arya]]></dc:creator>
            <pubDate>Sat, 23 May 2026 13:01:00 GMT</pubDate>
            <atom:updated>2026-05-26T07:05:46.918Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*lqS4wclRxZ8DG-FjhWYBog.png" /></figure><p>Imagine you’re training for a marathon.</p><p>Every day, you run a set distance. And every day, your coach tells you one number: how far off your pace you were from the target.</p><p>That number is your feedback signal. Without it, you’d have no idea whether you’re improving or getting worse. You’d just be running blindly, hoping something changes.</p><p>Machine Learning models have the same problem.</p><p>A model makes predictions. But predictions are meaningless unless something measures <em>how wrong</em> they are — and turns that wrongness into a number the model can act on.</p><p>That measurement is called a <strong>loss function</strong>.</p><h3>What Is a Loss Function?</h3><p>A loss function takes two inputs:</p><ul><li>What the model <strong>predicted</strong> (ŷ)</li><li>What the correct answer actually <strong>was</strong> (y)</li></ul><p>And it returns one output: a number representing how far apart those two things are.</p><p>Higher loss = worse prediction.</p><p>Lower loss = better prediction.</p><p>Zero loss = perfect prediction (which almost never happens in practice, and that’s fine).</p><p>In the previous post, we talked about <a href="https://medium.com/@atularya.iitkgp/gradient-descent-explained-intuitively-for-machine-learning-08364f797288?postPublishedType=repub">gradient descent </a>— the algorithm that rolls the model “downhill” toward better performance. But downhill toward <em>what</em>, exactly?</p><p>The loss function is what creates the hill.</p><p>Gradient descent doesn’t work in a vacuum. It needs a surface to descend. The loss function is that surface — it defines the landscape, and gradient descent finds the lowest point in it.</p><p>Different loss functions create different landscapes. And that means choosing the wrong one can send your model rolling toward the wrong valley entirely.</p><h3>Loss Function #1: Mean Squared Error (MSE)</h3><p>MSE is the most common loss function for <strong>regression tasks</strong> — problems where you’re predicting a continuous number, like house prices, temperatures, or stock values.</p><p>The formula looks like this:</p><pre>J(θ) = (1/n) Σ (yᵢ − ŷᵢ)²</pre><p>In plain English:</p><ul><li>For each data point, subtract the prediction from the true value</li><li>Square that difference</li><li>Average all those squared differences together</li></ul><p>The squaring step is the key insight. Here’s why it matters.</p><p>Suppose your model’s prediction is off by 2. Squared, that becomes 4. Now suppose it’s off by 4 — twice as wrong. Squared, that becomes 16 — <em>four times</em> the penalty.</p><p>MSE doesn’t punish errors proportionally. It punishes large errors disproportionately hard.</p><p>This is intentional. If your model makes one catastrophically bad prediction, MSE makes sure the model <em>really feels it</em> and is forced to correct for it.</p><p><strong>When MSE works well:</strong> When large errors are genuinely dangerous — medical predictions, structural engineering, financial forecasting. You want the model to care deeply about avoiding big mistakes.</p><p><strong>When MSE struggles:</strong> When your data has outliers you don’t trust. A single bad data point can dominate the entire loss, dragging the model away from otherwise good performance. In those cases, you might reach for MAE instead.</p><h3>Loss Function #2: Mean Absolute Error (MAE)</h3><p>MAE is MSE’s more forgiving sibling.</p><pre>J(θ) = (1/n) Σ |yᵢ − ŷᵢ|</pre><p>In plain English: take the absolute difference between each prediction and true value, then average them. No squaring.</p><p>If the model is off by 2, the penalty is 2. If it’s off by 4, the penalty is 4.</p><p>Linear. Proportional. No drama.</p><p>This makes MAE significantly more <strong>robust to outliers</strong>. A single wild data point contributes only its actual error to the loss — not its squared error. It doesn’t get to hijack the whole training process.</p><p><strong>When MAE works well:</strong> Noisy datasets, real-world data with measurement errors, situations where outliers are more likely to be bad data than genuinely important signals.</p><p><strong>When MAE struggles:</strong> The gradient of MAE is constant — it’s always ±1, regardless of how close the prediction is to the true value. As the model improves and gets very close to the answer, gradient descent is still taking the same size steps. It never “slows down” near the minimum, which can make convergence jittery.</p><p>MSE, by contrast, has a gradient that naturally shrinks as the loss approaches zero — so descent becomes gentler and more precise near the bottom.</p><p><strong>A useful mental model:</strong> MSE is the perfectionist — it loses sleep over big mistakes. MAE is the pragmatist — it treats all errors fairly, no panic, no drama.</p><h3>Loss Function #3: Binary Cross-Entropy</h3><p>MSE and MAE work well for regression. But what about <strong>classification</strong> — predicting whether an email is spam or not, whether a tumor is malignant or benign, whether a customer will churn?</p><p>For classification, the model’s output isn’t a continuous number. It’s a <strong>probability</strong> — a value between 0 and 1 representing how confident the model is.</p><p>For these tasks, we use Binary Cross-Entropy (also called log loss):</p><pre>J(θ) = −[y · log(p) + (1 − y) · log(1 − p)]</pre><p>This looks intimidating. Let’s break it apart.</p><p><strong>When the true label is 1 (positive class):</strong></p><p>The formula reduces to: −log(p)</p><p>If the model predicts p = 0.99 (very confident, and correct) → loss ≈ 0.01. Almost nothing.</p><p>If the model predicts p = 0.01 (very confident, but <em>wrong</em>) → loss ≈ 4.6. Enormous.</p><p><strong>When the true label is 0 (negative class):</strong></p><p>The formula reduces to: −log(1 − p)</p><p>Now the model is punished for predicting a <em>high</em> probability. If it says “99% chance this is positive” when the answer is actually negative, loss explodes.</p><p>The key behavior: <strong>cross-entropy is merciless toward confident wrong answers.</strong></p><p>An uncertain model (predicting 0.5) gets a moderate penalty. A confident model that’s right gets almost no penalty. But a confident model that’s <em>wrong</em> gets punished severely.</p><p>This is exactly what you want for classification. You’re not just training the model to get the right label — you’re training it to be appropriately <em>uncertain</em> when it doesn’t know.</p><p><strong>Why not use MSE for classification?</strong> You can, technically. But MSE treats probability outputs like continuous numbers. It doesn’t understand that predicting 0.01 vs 0.99 for a binary outcome are fundamentally different situations. Cross-entropy is specifically shaped to match the geometry of probability — that’s why it’s the standard.</p><h3>How Loss Functions Connect to Gradient Descent</h3><p>Here’s the thread that ties everything together.</p><p>In the last post, gradient descent needed a landscape — a surface with hills and valleys — so it could roll downhill toward the minimum.</p><p>The loss function <em>is</em> that landscape.</p><p>Every choice of loss function creates a different surface. MSE creates smooth parabolic bowls. Cross-entropy creates steep logarithmic cliffs near confident wrong answers. MAE creates sharp V-shaped valleys.</p><p>Gradient descent doesn’t know or care which surface it’s on. It just follows the slope. But the shape of the surface completely determines whether it converges smoothly, slowly, or gets stuck.</p><p>This is why picking the right loss function isn’t a minor implementation detail — it’s one of the most consequential modeling decisions you make.</p><h3>Quick Reference</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y6A008T3SJSMTT3ubPH-PQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66LyzG5lzZiYFk4IyReIfQ.png" /></figure><h3>What’s Next</h3><p>We now have two pieces of the puzzle:</p><ol><li><a href="https://medium.com/@atularya.iitkgp/gradient-descent-explained-intuitively-for-machine-learning-08364f797288?postPublishedType=repub"><strong>Gradient descent</strong></a> — the algorithm that minimizes loss by following the slope downhill</li><li><strong>Loss functions</strong> — the landscape that defines what “downhill” means</li></ol><p>But there’s still a missing link: <em>how does the gradient actually travel backward through a deep neural network with dozens of layers?</em></p><p>That’s backpropagation — and it’s the subject of the next post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47e69cf39fa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gradient Descent Explained Intuitively for Machine Learning]]></title>
            <link>https://medium.com/@atularya.iitkgp/gradient-descent-explained-intuitively-for-machine-learning-08364f797288?source=rss-ea83b6b1ba4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/08364f797288</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Atul Arya]]></dc:creator>
            <pubDate>Fri, 22 May 2026 15:12:50 GMT</pubDate>
            <atom:updated>2026-05-26T07:03:22.193Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-cVv9l56yqjTEIyJ5uPXZg.png" /></figure><p><em>The engine that teaches machines to learn — intuition, math, and everything in between.</em></p><p><strong>Part of the ML Foundations series.</strong> If you haven’t read <a href="https://medium.com/@atularya.iitkgp/the-7-assumptions-of-linear-regression-explained-like-a-data-scientist-4aa4e4fd04e6"><em>The 7 Assumptions of Linear Regression</em></a>, check it out first — this post picks up where it left off. We found the best-fit line there. Here, we learn <em>how</em> the model actually finds it.</p><h3>The Blindfolded Mountain Climber</h3><p>Imagine standing blindfolded on a mountain during a freezing storm.</p><p>The higher you are on the hill, the harsher the winds become. The ground is unstable. Every wrong step makes things worse. Naturally, you want to move toward the valley — the lowest point — because that’s where conditions are most stable and safe.</p><p>But there’s a challenge: <strong>you cannot see the entire mountain.</strong></p><p>So how do you move?</p><blockquote>You take a small step in the direction where the ground slopes downward the most. Then you stop. Feel the slope again. Take another step downward. Step by step, you eventually reach the valley.</blockquote><p><strong>That is exactly how Gradient Descent works in Machine Learning.</strong></p><figure><img alt="Figure 1: Each step follows the downward slope. The model is the blindfolded climber, moving toward the lowest point (minimum cost) step by step." src="https://cdn-images-1.medium.com/max/754/1*nHvKy5EoFdTOFTDsXUou9A.png" /><figcaption><em>Figure 1: Each step follows the downward slope. The model is the blindfolded climber, moving toward the lowest point (minimum cost) step by step.</em></figcaption></figure><p>In Machine Learning, the “mountain height” represents the model’s error. A higher position means worse predictions, larger errors, and an unstable model. The valley represents minimum cost — the point where predictions are as accurate as possible.</p><p>Gradient Descent is the algorithm that moves the model downhill by continuously adjusting its parameters to reduce error.</p><h3>What Problem Does Gradient Descent Actually Solve?</h3><p>In my previous post on linear regression, we used this equation:</p><p>Y = β₀ + β₁X + ε</p><p>The model needs to find the best values of β₀ and β₁. But how? It can’t just guess and check every possible combination — that would take forever.</p><p>Instead, the model:</p><ol><li>Makes a prediction with current parameter values</li><li>Calculates how wrong the prediction is (the <em>cost</em>)</li><li>Uses Gradient Descent to nudge the parameters in the direction that reduces the cost</li><li>Repeats until the cost is minimized</li></ol><blockquote><strong>In simple terms</strong></blockquote><blockquote>The model starts with random guesses for its parameters. Gradient Descent is the strategy it uses to improve those guesses — step by step — until it finds the combination that produces the least error.</blockquote><h3>The Cost Function — Measuring How Wrong You Are</h3><p>Before the model can descend, it needs to measure its current “height” — i.e., how bad its current predictions are. This is the <strong>cost function</strong> (also called the loss function).</p><p>The most common one is <strong>Mean Squared Error (MSE)</strong>:</p><p>J(θ) = (1/n) · Σ(yᵢ − ŷᵢ)²</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*HaM1na6uxxOOmIfqRObJgA.png" /></figure><p>Higher J(θ) = worse model.</p><p>Lower J(θ) = better model.</p><p>The goal is to find θ that makes J(θ) as small as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*jmjZKZaC4E7EV94BQj07Yw.png" /><figcaption><em>Figure 2: The cost function forms a bowl shape. Gradient Descent moves the parameters along this curve toward the minimum.</em></figcaption></figure><h3>The Gradient — Which Way Is Down?</h3><p>The word “gradient” is just a fancy word for <strong>slope</strong>.</p><p>At any point on the cost curve, the gradient tells you two things:</p><ul><li><strong>Direction:</strong> which way does the cost increase?</li><li><strong>Magnitude:</strong> how steep is the slope at this point?</li></ul><p>Gradient Descent moves <em>opposite</em> to the gradient — if the slope goes up to the right, you step left. This is the “descent” part.</p><blockquote><strong>In simple terms</strong></blockquote><blockquote>The gradient is like checking which direction is uphill. You then take a step in the <em>opposite</em> direction — downhill.</blockquote><h3>The Update Rule — The Heart of Gradient Descent</h3><p>Now for the math. At every step, Gradient Descent updates the model parameter using this rule:</p><p>θ := θ − α · ∂J(θ)/∂θ</p><p>Let’s break every piece of this down:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*ZmA7cXQqDG0PxX-QAqjHpg.png" /></figure><p>This one equation is applied <strong>repeatedly</strong> — thousands or millions of times — until the model converges to the minimum.</p><h3>The Learning Rate α — The Size of Your Steps</h3><p>The learning rate α is perhaps the most important hyperparameter in Gradient Descent. It controls <strong>how large each step is</strong>.</p><p>There are three scenarios, and understanding them is critical:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*emnlLShVasmK7thO3iRU_g.png" /><figcaption><em>Figure 3: Three learning rate scenarios. Too small = slow convergence. Just right = smooth descent. Too large = overshooting and divergence.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*40Y_mA6wvlvEgd4lx1cgJg.png" /></figure><blockquote><strong>Real-world tip</strong></blockquote><blockquote>There is no single perfect learning rate. Common starting values: 0.01, 0.001, 0.1. Techniques like <em>learning rate scheduling</em> (reducing α over time) are widely used in deep learning to get the best of both worlds — fast early steps, precise final steps.</blockquote><h3>Types of Gradient Descent</h3><p>Not all gradient descent is the same. The three variants differ in <strong>how much data they use per step</strong>:</p><blockquote><strong>In simple terms</strong></blockquote><blockquote>Batch GD is like reading every book in the library before taking one step. SGD is like reading one page and immediately moving. Mini-Batch GD is the sweet spot: read a chapter, then step. This is why almost every modern ML framework defaults to mini-batch.</blockquote><h3>Local vs Global Minima — The Hidden Trap</h3><p>On a convex cost function (a perfect bowl shape), there is only one minimum — the global minimum. Gradient Descent always finds it.</p><p>But in complex models like neural networks, the cost surface is <strong>non-convex</strong> — it has multiple valleys. Gradient Descent can get stuck in a <em>local minimum</em>, never reaching the true bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*AiEOdORPKvdQI63OKqihkg.png" /><figcaption><em>Figure 4: Two balls starting at different positions on the same curve. Ball A gets trapped in a local minimum. Ball B reaches the global minimum. Starting position and learning rate both influence the outcome.</em></figcaption></figure><blockquote><strong>In simple terms</strong></blockquote><blockquote>Think of the blindfolded climber again. If they start on the wrong side of a ridge, they might reach a small valley and think they’re done — not knowing there’s a deeper valley just over the hill. This is the local minima problem.</blockquote><p>For simple models like linear regression, the cost surface is always convex (a perfect bowl) — so this isn’t a problem. But for deep neural networks with millions of parameters, navigating non-convex surfaces is a central challenge.</p><h3>Why This Matters in Deep Learning</h3><p>Gradient Descent isn’t just a linear regression trick. It is the engine behind:</p><ul><li><strong>Neural networks</strong> — every weight update in a network is gradient descent</li><li><strong>Backpropagation</strong> — the algorithm that computes gradients through layers, then GD applies the update</li><li><strong>Large Language Models</strong> — GPT, Claude, Gemini — all trained by running gradient descent for billions of steps</li><li><strong>Computer vision, speech, recommendation systems</strong> — gradient descent is universal</li></ul><blockquote><strong>The bigger picture</strong></blockquote><blockquote>Every time a model “learns” — whether it’s detecting a face, predicting house prices, or generating text — it’s updating parameters using gradient descent. You’ve just learned the fundamental mechanism behind modern AI.</blockquote><h3>Quick Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*u6qzUCYSkxMNlngXMUUJ8A.png" /></figure><blockquote><em>Gradient Descent is not just a mathematical trick. It is the mechanism by which machines learn from data — adjusting, step by step, toward a better version of themselves. Every model you’ve ever used was shaped by it.</em></blockquote><p><strong>Up next in the series →</strong> Now that you know <em>how</em> models learn, the next post covers <a href="https://medium.com/@atularya.iitkgp/backpropagation-explained-without-the-scary-math-52f2181a454f"><strong>Backpropagation</strong> </a>— the algorithm that computes the gradients that Gradient Descent uses. They’re two halves of the same process.</p><p><em>If this was useful, follow to catch the next one.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08364f797288" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 7 Assumptions of Linear Regression — Explained Like a Data Scientist]]></title>
            <link>https://medium.com/@atularya.iitkgp/the-7-assumptions-of-linear-regression-explained-like-a-data-scientist-4aa4e4fd04e6?source=rss-ea83b6b1ba4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4aa4e4fd04e6</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[econometrics]]></category>
            <dc:creator><![CDATA[Atul Arya]]></dc:creator>
            <pubDate>Sun, 10 May 2026 20:39:47 GMT</pubDate>
            <atom:updated>2026-05-11T15:47:31.824Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qInYK9r5NlD8c_mfFwT9QA.png" /></figure><h4>A practical and intuitive guide to understanding the assumptions behind reliable regression models.</h4><p><em>Most tutorials just list them out like textbook definitions. Understanding them deeply is what separates someone who can run regression from someone who can trust it.</em></p><p>If you’ve ever built a linear regression model, you’ve heard it: <em>“Make sure the assumptions are satisfied.”</em> But what exactly are they? Why do they matter? And what happens when they fail?</p><h3>Before We Start: The Setup</h3><p>In a regression problem, <strong>X</strong> represents independent variables (input features), <strong>Y</strong> is the dependent variable (target), and <strong>ε</strong> is the error term — the difference between actual and predicted values.</p><p>Y = β0 + β1X + ε</p><p>Where β0 is the intercept, β1 is the slope/coefficient, and ε is the residual/error term. The goal: find the best line explaining the relationship between X and Y. But for that line to be <em>statistically reliable</em>, seven assumptions must hold.</p><h3>1. Linearity</h3><blockquote>The relationship between independent variable(s) and the dependent variable must be linear.</blockquote><p>I<em>n simple terms:</em></p><p><em>- If X increases, Y should change in a predictable linear way.</em></p><p><em>- The model assumes a straight-line relationship.</em></p><p><strong><em>Example:</em></strong></p><ul><li><em>Hours studied vs exam score</em></li><li><em>Advertising spend vs sales</em></li><li><em>Experience vs salary</em></li></ul><p>Even polynomial terms are allowed if the model stays linear in its <em>parameters</em>:</p><p>Y = β0 + β1X2 + ε (linear in β, non-linear in X)</p><p><strong>Regression line diagram — linear vs. non-linear fit</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a-0e_quRmrq-uevkLPXN-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eX1Ot-J4gt9VTL4cvq-bww.png" /></figure><h3>2. Independence of Observations</h3><blockquote>Every observation must be independent of every other observation — one data point should not influence another, and errors should not be correlated.</blockquote><p>This matters most for time-series data (stock prices, sensor readings) where today&#39;s value depends on yesterday&#39;s. Violations lead to misleading p-values and overconfident predictions.</p><p><strong><em>Example:</em></strong></p><ul><li><em>Random survey responses</em></li><li><em>Daily temperature readings</em></li><li><em>Independent customer purchases</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJJ1OKvTFRALLkj3nFPnNw.png" /></figure><h3>3. No Perfect Multicollinearity</h3><blockquote>Independent variables must not be perfectly correlated with each other.</blockquote><p><strong><em>Example:</em></strong></p><p>If two features contain identical information (e.g. height in cm and height in meters), the model cannot uniquely estimate their coefficients. Classic symptoms: huge coefficient values, sign flips, and model instability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kiby7OEwsplXz5I6nK-TMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyxWYfVzlnZoVkMEP3Ky9g.png" /></figure><h3>4. Zero Conditional Mean (Exogeneity)</h3><blockquote>The error term must not be related to the independent variables.</blockquote><p>E(ε | X) = 0</p><blockquote>In simple Terms:</blockquote><blockquote>There should be no hidden pattern left in the errors . The model must capture all systematic relationships.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPNbqIucOz0IIz4w98kH4w.png" /></figure><h3>5. Homoscedasticity</h3><p>A fancy word with a simple meaning.</p><blockquote>The variance of residuals must remain constant across all values of X.</blockquote><p>Var(ε | X) = σ²</p><p>When variance is non-constant, it’s called <em>heteroscedasticity</em> — residuals fan out like a cone. Coefficients may still be unbiased, but standard errors (and thus p-values) become wrong.</p><p>Homoscedasticity vs. heteroscedasticity — residual plots</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSct-RRI7RrJoQXPztrj-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZB-MWql9-ZY6Det8F3XH2A.png" /></figure><h3>6. No Autocorrelation</h3><blockquote>Residuals must not be correlated with each other over time.</blockquote><p>This assumption mainly relevant in time-series data.</p><p><strong><em>Example:</em></strong></p><p><em>If today’s error is positive, and tomorrow’s error is also likely positive.</em></p><p>If today’s error predicts tomorrow’s error, the model has missed <strong>temporal</strong> structure. Use the <strong>Durbin-Watson statistic</strong> to test: values near 2 indicate no autocorrelation; &lt;1 or &gt;3 are warning signs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Frp5n7B7Xpq3kC1mII5llA.png" /></figure><h3>7. Normality of Residuals</h3><blockquote>Residuals should follow a normal distribution.</blockquote><p>ε ~ N(0, σ²)</p><p>This matters most for hypothesis testing, confidence intervals, and small datasets. In large datasets, the Central Limit Theorem softens the impact of non-normality — but it’s still worth checking.</p><p>Normal distribution of residuals — bell curve</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G4GmPw8epn41VwmcriZMgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HSvJQYSOwrpB0rgYWUZ9w.png" /></figure><h3>Quick Reference Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P72EXvzu-1eY5lirIy23cg.png" /></figure><p>Linear regression is not just about fitting a line. It’s about understanding whether the model’s assumptions hold, whether the coefficients are trustworthy, and whether the statistical inference is valid.</p><p>A model with high accuracy but broken assumptions can still produce <em>misleading conclusions</em>. That’s why strong data scientists don’t just build models — they <strong>diagnose them</strong>.</p><h3>Found this useful?</h3><p>If this article helped you understand regression assumptions better, follow me for more practical Data Science and ML content. More deep-dives on diagnostics, model selection, and statistical inference are coming — the kind that actually help you build models you can <em>trust</em>.</p><p>If you’re starting your journey into Data Science, Machine Learning, and Statistics, follow along — more deep-dive articles coming soon.</p><p>Cheers, Keep Learning ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4aa4e4fd04e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>