<?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 Karthikmarimuthu on Medium]]></title>
        <description><![CDATA[Stories by Karthikmarimuthu on Medium]]></description>
        <link>https://medium.com/@karthikmarimuthu2010?source=rss-de2757646283------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*qvKMxNQU5e3rBV4C</url>
            <title>Stories by Karthikmarimuthu on Medium</title>
            <link>https://medium.com/@karthikmarimuthu2010?source=rss-de2757646283------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:37:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karthikmarimuthu2010/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[Automating Data Augmentation: A Beginner-Friendly Guide for Deep Learning]]></title>
            <link>https://medium.com/@karthikmarimuthu2010/automating-data-augmentation-a-beginner-friendly-guide-for-deep-learning-6e58d1d4a926?source=rss-de2757646283------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e58d1d4a926</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[data-augmentation]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Karthikmarimuthu]]></dc:creator>
            <pubDate>Wed, 23 Sep 2026 13:30:46 GMT</pubDate>
            <atom:updated>2026-09-23T13:30:46.890Z</atom:updated>
            <content:encoded><![CDATA[<p><em>From image flipping and cropping to AutoAugment and RandAugment — understanding how we can automatically create better training data</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e67TsB4ltE1d0V7hOaeoRA.png" /><figcaption>Data augmentation automatically creates variations of training images while preserving their meaning.</figcaption></figure><h3>Introduction</h3><p>Imagine we want to train a neural network to recognize cats.</p><p>We have only 1,000 cat images.</p><p>A deep learning model can easily start memorizing those images instead of learning the general visual characteristics of a cat. When we later give it a new image taken from a different angle, under different lighting, or with the cat positioned differently, the model may struggle.</p><p>One solution would be to collect another 10,000 images.</p><p>But collecting, cleaning, and labeling new data can be expensive and time-consuming.</p><p>Instead, we can create useful variations of the images we already have.</p><p>For example:</p><pre>Original Cat<br>                         │<br>        ┌────────────────┼────────────────┐<br>        ↓                ↓                ↓<br>   Flip Image       Rotate Image      Crop Image<br>        │                │                │<br>        ↓                ↓                ↓<br> Change Color       Change Brightness    Zoom</pre><p>This technique is called <strong>data augmentation</strong>.</p><p>And instead of manually deciding and applying every transformation, we can build a system that performs these operations automatically.</p><p>In this article, I will explain <strong>automated data augmentation step by step</strong>, starting from the basic idea and progressing toward techniques where machine learning itself helps determine augmentation strategies.</p><h3>1. What Is Data Augmentation?</h3><p><strong>Data augmentation is the process of creating modified versions of existing training examples while keeping their original meaning or label valid.</strong></p><p>Suppose we have this image:</p><pre>🐕 → Dog</pre><p>We could create several variations:</p><pre>Original       → Dog<br>Flipped        → Dog<br>Slightly rotated → Dog<br>Zoomed         → Dog<br>Brighter       → Dog<br>Cropped        → Dog</pre><p>The pixels are different, but the object is still a dog.</p><p>Instead of showing the model exactly the same image repeatedly, we expose it to slightly different versions.</p><p>This encourages the model to learn:</p><blockquote><em>“What makes this object a dog?”</em></blockquote><p>rather than:</p><blockquote><em>“What does this particular dog image look like?”</em></blockquote><p>That distinction is important for <strong>generalization</strong>.</p><h3>2. Why Do We Need Data Augmentation?</h3><p>Deep neural networks can contain millions or even billions of parameters.</p><p>These models are powerful, but they usually need large amounts of representative training data.</p><p>If the training dataset is too small or not sufficiently varied, the model can <strong>overfit</strong>.</p><h3>What is overfitting?</h3><p>Imagine a student preparing for an exam by memorizing the exact answers to 20 practice questions.</p><p>If the real exam contains the same questions, the student performs very well.</p><p>But if the questions are slightly different, the student struggles.</p><p>That is similar to overfitting.</p><p>A model may perform extremely well on its training data but poorly on new data.</p><p>Data augmentation makes the training problem more varied, encouraging the model to learn patterns that remain useful when it sees previously unseen examples.</p><h3>3. When Should We Use Data Augmentation?</h3><p>Data augmentation is particularly useful when:</p><ul><li>the dataset is relatively small;</li><li>collecting additional labeled data is expensive;</li><li>the model is overfitting;</li><li>real-world inputs naturally contain variations;</li><li>we want the model to become more robust.</li></ul><p>For example, suppose we are developing a traffic-sign classifier.</p><p>A stop sign photographed in the real world might appear:</p><pre>Straight        Rotated slightly<br>Bright          Dark<br>Near            Far away<br>Centered        Off-center<br>Clean           Partially obscured</pre><p>If our training data contains only perfectly centered images photographed in daylight, our model may not generalize well.</p><p>Augmentation allows us to simulate some of these realistic variations during training.</p><h3>4. Common Data Augmentation Techniques</h3><p>There are many ways to augment images. Let’s look at some of the most common ones.</p><h3>Horizontal Flipping</h3><p>An image can be mirrored horizontally.</p><pre>Original                  Flipped</pre><pre>🐕  →                   ←  🐕</pre><p>This can be useful when the direction an object faces does not change its class.</p><p>However, augmentation must make sense for the problem.</p><p>For example, horizontally flipping many natural images is reasonable.</p><p>But flipping an image containing text may create unrealistic training examples.</p><h3>Random Cropping</h3><p>Instead of always using the entire image, we randomly select part of it.</p><p>Imagine:</p><pre>+-----------------------+<br>|                       |<br>|       +---------+     |<br>|       |   🐕    |     |<br>|       |         |     |<br>|       +---------+     |<br>|                       |<br>+-----------------------+</pre><p>The inner region becomes a new training example.</p><p>This helps the network become less dependent on the exact location of an object.</p><h3>5. Rotation</h3><p>We can rotate an image slightly.</p><p>For example:</p><pre>Original<br>   🐈</pre><pre>+10°<br>     🐈</pre><pre>-10°<br> 🐈</pre><p>The model learns that an object does not stop being a cat simply because the camera was slightly tilted.</p><p>But again, context matters.</p><p>Rotating a handwritten <strong>6</strong> by 180 degrees might make it resemble a <strong>9</strong>, so not every transformation is appropriate for every dataset.</p><h3>6. Brightness and Contrast</h3><p>Real images are captured under different lighting conditions.</p><p>The same object might appear very different:</p><pre>Dark room → Normal light → Bright sunlight</pre><p>Changing brightness and contrast during training can make a model more robust to such conditions.</p><p>With TensorFlow, for example, random brightness changes can be performed with tf.image:</p><pre>image = tf.image.random_brightness(<br>    image,<br>    max_delta=0.2<br>)</pre><p>Every time the operation runs, TensorFlow can apply a different brightness adjustment.</p><h3>7. Saturation, Hue and Color</h3><p>Color properties can also be modified.</p><p>TensorFlow provides image operations such as:</p><pre>tf.image.random_saturation()<br>tf.image.random_hue()<br>tf.image.random_contrast()</pre><p>This is useful when we do not want the model to depend too strongly on one exact color or lighting condition.</p><p>Suppose all the training pictures of bananas happened to have very similar lighting.</p><p>Without enough variation, the model could accidentally learn:</p><blockquote><em>“This particular shade of yellow means banana.”</em></blockquote><p>Color augmentation encourages it to pay attention to other useful visual features as well.</p><h3>8. How Do We Automate This?</h3><p>So far, we have different transformations:</p><pre>Flip<br>Rotate<br>Crop<br>Zoom<br>Brightness<br>Contrast<br>Saturation<br>Hue</pre><p>Manually creating transformed images and saving them would be inefficient.</p><p>Instead, we can make augmentation part of the <strong>training pipeline</strong>.</p><p>The basic workflow becomes:</p><pre>Original Dataset<br>       ↓<br>Load Image<br>       ↓<br>Random Augmentation<br>       ↓<br>Preprocessing<br>       ↓<br>Neural Network<br>       ↓<br>Prediction<br>       ↓<br>Calculate Loss<br>       ↓<br>Backpropagation</pre><p>The important part is that augmentation can happen <strong>dynamically during training</strong>.</p><p>An image can therefore look slightly different each time the model encounters it.</p><h3>9. Step-by-Step Automated Data Augmentation with TensorFlow</h3><p>Let’s build a simple example.</p><p>First, import TensorFlow:</p><pre>import tensorflow as tf</pre><p>Suppose our training pipeline receives an image and its label.</p><p>We can create an augmentation function:</p><pre>def augment_image(image, label):<br>    &quot;&quot;&quot;Apply random transformations to an image.&quot;&quot;&quot;<br>    image = tf.image.random_flip_left_right(image)<br>    image = tf.image.random_brightness(image, max_delta=0.2)<br>    image = tf.image.random_contrast(<br>        image,<br>        lower=0.8,<br>        upper=1.2<br>    )</pre><pre>    return image, label</pre><p>Notice something important.</p><p>We modify the <strong>image</strong>, but we keep the <strong>label</strong>.</p><pre>Original cat → Cat</pre><pre>Flipped cat → Cat</pre><pre>Brighter cat → Cat</pre><p>The appearance changes, but its semantic class does not.</p><h3>10. Add Augmentation to the Dataset Pipeline</h3><p>TensorFlow datasets can process transformations using map().</p><p>For example:</p><pre>train_dataset = train_dataset.map(<br>    augment_image,<br>    num_parallel_calls=tf.data.AUTOTUNE<br>)</pre><p>Now augmentation becomes part of the data pipeline.</p><p>Conceptually:</p><pre>Dataset<br>   │<br>   ├── Image 1 → random augmentation ──┐<br>   ├── Image 2 → random augmentation ──┤<br>   ├── Image 3 → random augmentation ──┤<br>   └── Image 4 → random augmentation ──┘<br>                                       ↓<br>                                    Training</pre><p>We no longer need to manually generate thousands of additional image files.</p><h3>11. Augmentation Using Keras Layers</h3><p>Keras also provides preprocessing layers that can be placed directly into a model or preprocessing pipeline.</p><p>For example:</p><pre>data_augmentation = tf.keras.Sequential([<br>    tf.keras.layers.RandomFlip(&quot;horizontal&quot;),<br>    tf.keras.layers.RandomRotation(0.1),<br>    tf.keras.layers.RandomZoom(0.1),<br>])</pre><p>Then:</p><pre>model = tf.keras.Sequential([<br>    data_augmentation,</pre><pre>    tf.keras.layers.Conv2D(<br>        32,<br>        3,<br>        activation=&quot;relu&quot;<br>    ),</pre><pre>    tf.keras.layers.MaxPooling2D(),</pre><pre>    tf.keras.layers.Flatten(),</pre><pre>    tf.keras.layers.Dense(<br>        10,<br>        activation=&quot;softmax&quot;<br>    )<br>])</pre><p>The architecture now looks roughly like this:</p><pre>Input Image<br>     ↓<br>Random Flip<br>     ↓<br>Random Rotation<br>     ↓<br>Random Zoom<br>     ↓<br>Convolution<br>     ↓<br>Pooling<br>     ↓<br>Classification</pre><p>During training, the model sees randomly transformed versions of its input data.</p><h3>12. Should We Augment Validation and Test Data?</h3><p>Normally, <strong>random data augmentation should be applied to the training set, not to the validation or test sets</strong>.</p><p>Why?</p><p>Training data is used for learning:</p><pre>Training data<br>      ↓<br>Augmentation<br>      ↓<br>Model learns</pre><p>Validation and test data have a different purpose.</p><p>They help us measure how well the trained model performs on unseen data.</p><pre>Validation/Test data<br>          ↓<br>Standard preprocessing<br>          ↓<br>Model<br>          ↓<br>Evaluation</pre><p>If we randomly modify evaluation data in the same way as training data, we may make evaluation inconsistent or harder to interpret.</p><p>So a common pipeline is:</p><pre>TRAIN<br>Image → Augmentation → Preprocessing → Model</pre><pre>VALIDATION / TEST<br>Image → Preprocessing → Model</pre><h3>13. How Much Augmentation Should We Apply?</h3><p>More augmentation is <strong>not automatically better</strong>.</p><p>Suppose we rotate a normal photograph by five degrees.</p><p>The result is probably still realistic.</p><p>But suppose we rotate it by 170 degrees.</p><p>For some applications, that might create an image that would almost never occur in reality.</p><p>This leads to an important rule:</p><blockquote><strong><em>Augmentation should create plausible variations of the real data the model is expected to encounter.</em></strong></blockquote><p>The correct transformations depend on the problem.</p><p>For animal classification, horizontal flipping may make sense.</p><p>For medical images, satellite images, text recognition, autonomous driving, or facial recognition, the valid transformations can be very different.</p><p>Understanding the domain is therefore essential.</p><h3>14. The Problem with Manual Augmentation Policies</h3><p>At this point another problem appears.</p><p>We have many possible choices:</p><pre>Should rotation be 5° or 20°?</pre><pre>Should brightness change by 10% or 30%?</pre><pre>Should we flip 20% or 50% of images?</pre><pre>Should we use crop + rotation?</pre><pre>Or brightness + contrast + flip?</pre><pre>How many transformations should be applied?</pre><p>These choices form an <strong>augmentation policy</strong>.</p><p>Traditionally, ML engineers choose these policies manually and experiment until they find something that works.</p><p>But the number of possible combinations can become enormous.</p><p>That leads us to a more advanced idea:</p><h3>Can Machine Learning Find the Augmentation Strategy for Us?</h3><p>Yes.</p><p>This is known as <strong>automated data augmentation</strong> or <strong>augmentation policy search</strong>.</p><p>Instead of manually deciding the best transformations, an algorithm searches for augmentation policies that improve model performance.</p><h3>15. AutoAugment</h3><p>One influential approach is <strong>AutoAugment</strong>.</p><p>The idea is to treat augmentation-policy selection as a search problem.</p><p>Imagine a collection of possible transformations:</p><pre>Rotate<br>Flip<br>Translate<br>Shear<br>Brightness<br>Contrast<br>Color<br>Sharpness<br>...</pre><p>Each operation can also have parameters such as:</p><pre>Probability<br>Magnitude</pre><p>For example:</p><pre>Rotate:<br>    probability = 0.7<br>    magnitude = 15°</pre><pre>Brightness:<br>    probability = 0.4<br>    magnitude = 0.2</pre><p>An automated system can try different combinations and evaluate how well they work.</p><p>Conceptually:</p><pre>Possible augmentation policies<br>             ↓<br>      Search algorithm<br>             ↓<br>    Train candidate model<br>             ↓<br>Evaluate validation performance<br>             ↓<br>     Receive feedback<br>             ↓<br>Improve augmentation policy<br>             ↓<br>        Best policy<br>             ↓<br>Train final model</pre><p>The augmentation strategy itself becomes something we <strong>optimize</strong>.</p><h3>16. Reinforcement Learning for Augmentation</h3><p>One way of automating policy search is through <strong>reinforcement learning</strong>.</p><p>A controller proposes an augmentation policy.</p><p>For example:</p><pre>Policy A</pre><pre>Rotate:<br>    probability = 0.6<br>    magnitude = 10°</pre><pre>Brightness:<br>    probability = 0.4<br>    magnitude = 0.2</pre><p>A model is trained using that policy.</p><p>Its validation performance provides feedback.</p><pre>Controller<br>    ↓<br>Generate augmentation policy<br>    ↓<br>Train model<br>    ↓<br>Evaluate model<br>    ↓<br>Validation performance<br>    ↓<br>Reward<br>    ↓<br>Controller learns</pre><p>If a policy leads to better validation performance, the controller receives a better reward.</p><p>Over repeated experiments, it learns which augmentation policies tend to work well.</p><h3>17. Why Is Automated Augmentation Useful?</h3><p>Manual augmentation requires human experimentation.</p><p>We might try:</p><pre>Experiment 1 → Flip<br>Experiment 2 → Flip + Rotation<br>Experiment 3 → Crop + Brightness<br>Experiment 4 → Rotation + Contrast<br>...</pre><p>Automated augmentation turns this into an optimization problem.</p><p>This can provide several benefits:</p><p><strong>Better policies:</strong> The algorithm may discover combinations that a human would not immediately consider.</p><p><strong>Less manual tuning:</strong> Engineers spend less time testing augmentation parameters by hand.</p><p><strong>Potentially better generalization:</strong> Better augmentation policies can help models perform more reliably on unseen data.</p><p>However, automation also introduces costs.</p><p>Searching through many policies may require substantial computation because multiple models or training runs may need to be evaluated.</p><h3>18. Modern Alternatives: RandAugment</h3><p>Full policy search can be expensive.</p><p>Simpler methods such as <strong>RandAugment</strong> reduce the search space.</p><p>Instead of searching separately for many probabilities and magnitudes, RandAugment simplifies the problem around a small number of global parameters.</p><p>Conceptually:</p><pre>Choose N transformations<br>        +<br>Choose transformation magnitude M<br>        ↓<br>Apply random transformations</pre><p>For example:</p><pre>N = 2<br>M = moderate</pre><pre>Randomly choose:</pre><pre>Rotation + Contrast</pre><p>For another image:</p><pre>Brightness + Translation</pre><p>This makes automated augmentation easier and computationally cheaper than an extensive policy search.</p><h3>19. A Complete Automated Augmentation Workflow</h3><p>Putting everything together, a practical workflow could look like this:</p><pre>1. Collect and label data<br>            ↓<br>2. Split the dataset<br>   Train / Validation / Test<br>            ↓<br>3. Study realistic data variations<br>            ↓<br>4. Select candidate transformations<br>            ↓<br>5. Define augmentation ranges<br>            ↓<br>6. Build augmentation pipeline<br>            ↓<br>7. Train the model<br>            ↓<br>8. Measure validation performance<br>            ↓<br>9. Adjust or automatically search policies<br>            ↓<br>10. Select the best strategy<br>            ↓<br>11. Train the final model<br>            ↓<br>12. Evaluate on untouched test data</pre><p>The key is that augmentation is not simply about generating random images.</p><p>It should be treated as part of the overall machine-learning experiment.</p><h3>20. A Simple Practical Example</h3><p>Imagine we are developing a model to classify:</p><pre>Cats 🐈<br>Dogs 🐕<br>Horses 🐎</pre><p>Our original training image might be:</p><pre>🐕<br>      Original</pre><p>During different epochs, the model might see:</p><pre>Epoch 1 → horizontally flipped dog<br>Epoch 2 → slightly brighter dog<br>Epoch 3 → zoomed dog<br>Epoch 4 → slightly rotated dog<br>Epoch 5 → cropped dog</pre><p>The model is repeatedly seeing the <strong>same semantic object</strong>, but not exactly the same pixels.</p><p>As a result, it is encouraged to learn features that remain useful despite small visual changes.</p><p>That is the real power of data augmentation.</p><h3>Benefits of Data Augmentation</h3><p>Data augmentation can help us:</p><ul><li>reduce overfitting;</li><li>improve generalization;</li><li>increase the effective diversity of training data;</li><li>make models more robust to real-world variations;</li><li>reduce dependence on collecting additional labeled examples.</li></ul><p>Automated augmentation goes one step further by reducing the amount of manual experimentation needed to choose augmentation policies.</p><h3>Limitations</h3><p>Data augmentation is powerful, but it must be used carefully.</p><p>A badly chosen transformation can change the meaning of the data.</p><p>Consider handwritten digits:</p><pre>6  → rotate 180° → 9</pre><p>The label may no longer be correct.</p><p>Or imagine a road sign:</p><pre>Turn Left ←</pre><p>Horizontally flipping it could produce:</p><pre>→ Turn Right</pre><p>while keeping the original label.</p><p>That would introduce incorrect training data.</p><p>Therefore:</p><blockquote><strong><em>The best augmentation is not the most aggressive augmentation. It is the augmentation that realistically represents variations expected in the problem domain.</em></strong></blockquote><h3>Conclusion</h3><p>Data augmentation starts with a very simple idea:</p><blockquote><strong><em>Create meaningful variations of existing training examples so that the model learns to generalize rather than memorize.</em></strong></blockquote><p>Basic augmentation can include:</p><p><strong>flipping, cropping, rotation, zooming, brightness changes, contrast changes and color transformations.</strong></p><p>TensorFlow allows these transformations to be integrated directly into the training pipeline using tools such as tf.image and Keras preprocessing layers.</p><p>But we can go further.</p><p>Instead of manually deciding which transformations to apply, <strong>automated data augmentation</strong> treats augmentation-policy design as an optimization problem. Techniques such as AutoAugment explore different policies automatically, while approaches such as RandAugment simplify the search process.</p><p>The progression can therefore be viewed as:</p><pre>No Augmentation<br>      ↓<br>Manual Augmentation<br>      ↓<br>Randomized Augmentation Pipeline<br>      ↓<br>Automated Policy Search<br>      ↓<br>Optimized Augmentation Strategy</pre><p>For me, the most important lesson is that data augmentation is not simply a trick for creating more images.</p><p>It is a way of telling the model:</p><blockquote><strong><em>Don’t memorize exactly what you see. Learn the underlying features that should remain important when the real world changes.</em></strong></blockquote><p>And that is one of the central goals of machine learning: building models that perform well not only on the examples they have already seen, but also on new data they encounter in the real world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e58d1d4a926" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AlexNet: The CNN That Changed Computer Vision]]></title>
            <link>https://medium.com/@karthikmarimuthu2010/alexnet-the-cnn-that-changed-computer-vision-6d436f9df0bb?source=rss-de2757646283------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d436f9df0bb</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Karthikmarimuthu]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 09:04:02 GMT</pubDate>
            <atom:updated>2026-09-16T09:04:02.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B37svl5_OIPVUxTR8dmONg.png" /><figcaption>AlexNet architecture — five convolutional layers followed by three fully connected layers. Adapted from Krizhevsky, Sutskever &amp; Hinton (2012), “ImageNet Classification with Deep Convolutional Neural Networks.”</figcaption></figure><p>In 2012, Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton published <strong>“ImageNet Classification with Deep Convolutional Neural Networks.”</strong></p><p>Today, training convolutional neural networks on GPUs sounds completely normal. In 2012, however, successfully training a very large CNN on more than a million images was a major achievement.</p><p>Their network demonstrated that combining <strong>large datasets, deep convolutional neural networks, GPU computing, ReLU activations, data augmentation, and dropout</strong> could dramatically improve large-scale image recognition.</p><p>The model later became widely known as <strong>AlexNet</strong>.</p><p>This post summarizes the paper, explains how the network worked, discusses its main results, and gives my personal takeaways from studying it.</p><h3>Introduction — Why Was This Research Important?</h3><p>Object recognition is easy to describe but difficult to solve.</p><p>Imagine showing a computer these images:</p><p><strong>🐕 Dog — 🐈 Cat — 🚗 Car — ✈️ Airplane</strong></p><p>Humans can distinguish them almost instantly, even when their position, lighting, background, size, or viewing angle changes.</p><p>For a machine, an image begins simply as a large collection of pixel values.</p><p>Earlier image-recognition datasets were relatively small. But realistic objects have enormous visual variation, so the researchers argued that significantly larger datasets and models with greater learning capacity were needed. ImageNet provided exactly this opportunity: more than 15 million labeled high-resolution images across over 22,000 categories.</p><p>The ImageNet Large Scale Visual Recognition Challenge used a subset containing approximately <strong>1.2 million training images, 50,000 validation images and 150,000 test images across 1,000 classes</strong>.</p><p>The challenge was therefore:</p><blockquote><em>Can we train a sufficiently large and deep neural network to learn useful visual features directly from this enormous dataset?</em></blockquote><p>The authors’ answer was a deep <strong>Convolutional Neural Network (CNN)</strong>.</p><h3>Procedures — What Did the Researchers Do?</h3><h3>1. They built a large CNN</h3><p>The proposed network contained approximately <strong>60 million parameters and 650,000 neurons</strong>. It consisted of:</p><p><strong>Input → Conv → Conv → Conv → Conv → Conv → Fully Connected → Fully Connected → Output</strong></p><p>More precisely, the architecture contained <strong>five convolutional layers and three fully connected layers</strong>, ending with a <strong>1000-way softmax classifier</strong> corresponding to ImageNet’s 1,000 classes.</p><p>This depth was important. The researchers reported that removing even one convolutional layer reduced performance.</p><h3>What does a convolutional layer do?</h3><p>A convolutional layer learns filters that scan across an image looking for useful visual patterns.</p><p>Early layers might detect simple structures such as:</p><p><strong>edges → lines → colors → textures</strong></p><p>Deeper layers can combine these simpler patterns into increasingly complex representations:</p><p><strong>edges → shapes → object parts → objects</strong></p><p>For example, when recognizing a dog, early layers might detect edges and textures, while deeper layers may respond to structures associated with ears, eyes, fur, or an overall dog-like shape.</p><p>This hierarchical feature learning is one of the major strengths of CNNs.</p><h3>2. They used ReLU instead of traditional activation functions</h3><p>One particularly important design choice was the <strong>Rectified Linear Unit (ReLU)</strong>:</p><p><strong>f(x) = max(0, x)</strong></p><p>For example:</p><p>InputReLU output-50–10002288</p><p>At the time, activation functions such as tanh and sigmoid were common.</p><p>The researchers showed that ReLU could make training substantially faster. In the experiment presented in Figure 1, a four-layer CNN using ReLU reached a 25% training error on CIFAR-10 <strong>six times faster</strong> than an equivalent network using tanh.</p><p>This is particularly interesting today because ReLU and its variants became standard components of many deep neural networks.</p><h3>3. They trained the network using two GPUs</h3><p>The network was too large for the memory available on a single NVIDIA GTX 580 GPU, which had only 3 GB of memory.</p><p>The researchers therefore divided the network across <strong>two GPUs</strong>, placing roughly half of the kernels on each while allowing communication between the GPUs at selected layers.</p><p>This seems ordinary in modern machine learning, where distributed GPU training is common, but it was an important engineering decision at the time.</p><p>The complete training process took approximately <strong>five to six days on two NVIDIA GTX 580 3 GB GPUs</strong>.</p><h3>4. They used max pooling</h3><p>CNNs can generate very large feature maps. Pooling helps reduce their spatial dimensions while retaining important information.</p><p>AlexNet used <strong>overlapping max pooling</strong>.</p><p>Rather than averaging nearby values, max pooling keeps the largest activation within a region.</p><p>For example:</p><pre>2  8<br>4  3</pre><pre>Max Pooling → 8</pre><p>The intuition is that a strong feature response can remain important even if its exact position changes slightly.</p><p>The researchers used pooling regions of <strong>3 × 3 with a stride of 2</strong>, creating overlapping pooling regions. They reported slightly lower error rates than with the non-overlapping pooling configuration they compared against.</p><h3>Fighting One of Deep Learning’s Biggest Problems: Overfitting</h3><p>With around <strong>60 million parameters</strong>, overfitting was a serious concern.</p><p>The researchers primarily addressed it using <strong>data augmentation and dropout</strong>.</p><h3>Data Augmentation</h3><p>Instead of collecting millions of additional images, they created variations of existing training images.</p><p>One technique involved extracting random <strong>224 × 224 patches</strong> from 256 × 256 images and horizontally reflecting them.</p><p>Conceptually:</p><pre>Original image<br>      ↓<br>Random crop<br>      ↓<br>Horizontal flip<br>      ↓<br>Additional training examples</pre><p>This greatly increased the effective amount of training data and helped the network generalize instead of memorizing the training images.</p><p>They also modified RGB intensities using PCA-based transformations to approximate changes in illumination and color. This technique alone reduced top-1 error by more than one percentage point.</p><h3>Dropout</h3><p>Another major technique was <strong>dropout</strong>.</p><p>During training, the authors randomly set the outputs of hidden neurons to zero with probability <strong>0.5</strong>.</p><p>Imagine a layer:</p><pre>●  ●  ●  ●  ●  ●</pre><p>During one training step it might effectively become:</p><pre>●  X  ●  X  X  ●</pre><p>On another:</p><pre>X  ●  ●  ●  X  X</pre><p>Because neurons cannot always depend on the same neighboring neurons being present, they are encouraged to learn more robust features.</p><p>The authors applied dropout to the <strong>first two fully connected layers</strong>. Without it, they observed substantial overfitting, although dropout roughly doubled the number of iterations required for convergence.</p><p>This trade-off is important:</p><p><strong>Training becomes slower, but generalization improves.</strong></p><h3>Training the Network</h3><p>The researchers trained AlexNet using <strong>stochastic gradient descent (SGD)</strong>.</p><p>Some important training settings were:</p><ul><li>Batch size: <strong>128</strong></li><li>Momentum: <strong>0.9</strong></li><li>Weight decay: <strong>0.0005</strong></li><li>Initial learning rate: <strong>0.01</strong></li></ul><p>The learning rate was manually divided by 10 whenever validation performance stopped improving.</p><p>The network was trained for roughly <strong>90 passes through the 1.2-million-image training set</strong>.</p><h3>Results — How Well Did AlexNet Perform?</h3><p>This is where the paper became particularly significant.</p><p>On the <strong>ILSVRC-2010 test set</strong>, the CNN achieved:</p><p>ModelTop-1 ErrorTop-5 ErrorSparse Coding47.1%28.2%SIFT + Fisher Vectors45.7%25.7%<strong>CNN37.5%17.0%</strong></p><p>The improvement over the previous approaches was substantial.</p><h3>What does Top-5 error mean?</h3><p>Suppose the real image is a <strong>Leopard</strong>.</p><p>The network predicts:</p><pre>1. Jaguar<br>2. Leopard<br>3. Tiger<br>4. Cheetah<br>5. Lion</pre><p>The top-1 prediction is incorrect because “Jaguar” came first.</p><p>But the top-5 prediction is considered correct because <strong>Leopard appears among the five highest-probability predictions</strong>.</p><p>The paper defines top-5 error as the fraction of images for which the correct label does not appear among the model’s five most probable predictions.</p><h3>The Famous ImageNet 2012 Result</h3><p>The researchers also entered variants of their CNN into the <strong>ILSVRC-2012 competition</strong>.</p><p>Their final combination of seven CNNs achieved a:</p><p><strong>15.3% top-5 test error</strong></p><p>The second-best competition entry reported:</p><p><strong>26.2% top-5 test error</strong></p><p>That difference demonstrated how powerful deep CNNs could be when combined with large datasets and GPU computation.</p><h3>What Did the Network Actually Learn?</h3><p>One of my favorite parts of the paper is its qualitative analysis.</p><p>The first convolutional layer learned filters responding to different orientations, frequencies, and colors.</p><p>Even more interesting is Figure 4 on page 8.</p><p>The researchers examined the <strong>4096-dimensional representation produced by the final hidden layer</strong>. Images producing nearby feature vectors could be considered visually similar from the network’s learned perspective.</p><p>The retrieved images were often semantically related despite having quite different raw pixel arrangements — for example, similar animals appearing in different poses.</p><p>This demonstrates an important idea in deep learning:</p><blockquote><em>A neural network does not only learn the final classification. Its hidden layers learn useful representations of the data.</em></blockquote><p>That same basic concept remains extremely important today in embeddings, transfer learning, image retrieval, and modern foundation models.</p><h3>Conclusion</h3><p>The paper demonstrated that a <strong>large and deep convolutional neural network trained using supervised learning</strong> could achieve record-breaking results on a challenging large-scale image classification problem.</p><p>Several ideas worked together:</p><p><strong>Large-scale data + CNN depth + GPUs + ReLU + pooling + data augmentation + dropout</strong></p><p>No single technique tells the whole story.</p><p>The researchers also found that depth mattered: removing convolutional layers degraded performance. They expected results to continue improving as networks became larger, trained longer, and gained access to greater computational resources.</p><p>Looking back from today’s deep-learning landscape, that observation was remarkably important.</p><h3>Personal Notes — What I Learned From This Paper</h3><p>What impressed me most about this paper is that AlexNet was not simply a new neural-network architecture. It was a combination of <strong>machine-learning ideas and engineering decisions</strong>.</p><p>The authors had several practical problems:</p><p><strong>Training was too slow → use ReLU and GPUs.</strong></p><p><strong>The model was too large for one GPU → split it across two GPUs.</strong></p><p><strong>The network was overfitting → use data augmentation and dropout.</strong></p><p><strong>The dataset contained variable image sizes → resize and crop them into a consistent representation.</strong></p><p>This is an important lesson for me while learning Machine Learning and AI Engineering. Building a successful ML system is not only about understanding mathematical models. We also need to think about <strong>data, computational resources, optimization, generalization, architecture, and implementation</strong>.</p><p>Another point I found interesting is how many concepts from this 2012 paper are still relevant today. ReLU, data augmentation, dropout, GPU acceleration and deep feature representations are now familiar concepts in deep learning.</p><p>At the same time, AlexNet also shows how quickly the field evolves. Some architectural choices from the paper are no longer typical in modern CNNs, while the broader principles it demonstrated became foundational.</p><p>For me, the biggest takeaway is simple:</p><blockquote><strong><em>Deep learning became powerful not because of one breakthrough alone, but because better algorithms, larger datasets and faster computing came together at the right time.</em></strong></blockquote><p>That makes this paper not just an interesting CNN architecture to study, but an important milestone in the history of modern artificial intelligence.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d436f9df0bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Ideas, Stronger Models: 5 Regularization Techniques Every ML Engineer Should Understand]]></title>
            <link>https://medium.com/@karthikmarimuthu2010/simple-ideas-stronger-models-5-regularization-techniques-every-ml-engineer-should-understand-d41b468200bd?source=rss-de2757646283------2</link>
            <guid isPermaLink="false">https://medium.com/p/d41b468200bd</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Karthikmarimuthu]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 16:21:43 GMT</pubDate>
            <atom:updated>2026-09-07T16:21:43.905Z</atom:updated>
            <content:encoded><![CDATA[<h3>Simple Ideas, Stronger Models: 5 Regularization Techniques Every ML Engineer Should Understand</h3><p><strong>L1, L2, Dropout, Data Augmentation, and Early Stopping — explained simply with examples.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HerdZOR08EzcNfOJcdmeoA.png" /></figure><p><em>Different techniques. One common goal: prevent overfitting and build models that perform well on unseen data.</em></p><p>Imagine a student preparing for a mathematics exam.</p><p>One student <strong>memorizes every question and answer</strong> from the practice book. Another student learns the <strong>underlying concepts</strong> and understands how to solve similar problems.</p><p>During practice, the student who memorized everything might score 100%.</p><p>But what happens when the real exam contains questions they have never seen before?</p><p>The student who understood the concepts will probably perform better.</p><p>Machine-learning models can have exactly the same problem.</p><p>A model can become extremely good at remembering its training data but perform poorly when it receives new data.</p><p>This is called <strong>overfitting</strong>.</p><p>Regularization helps us prevent it.</p><p>In this article, let’s understand five important regularization techniques:</p><ul><li>L1 Regularization</li><li>L2 Regularization</li><li>Dropout</li><li>Data Augmentation</li><li>Early Stopping</li></ul><p>Although they work differently, they share one objective:</p><blockquote><strong><em>Don’t just memorize the training data. Learn patterns that generalize to new data.</em></strong></blockquote><h3>First, What Is Overfitting?</h3><p>Suppose we train a model using a collection of data points.</p><p>A simple model might learn the general relationship:</p><p><strong>Data → Pattern → Prediction</strong></p><p>But a highly complex model may start learning:</p><p><strong>Data → Pattern + Noise + Outliers → Prediction</strong></p><p>Imagine drawing a curve through scattered points.</p><p>A smooth curve captures the general trend.</p><p>An extremely complicated curve that bends through almost every individual point might achieve extremely low training error. However, many of those bends may represent random noise rather than useful information.</p><p>We might therefore see:</p><p><strong>Training accuracy: 99%</strong></p><p><strong>Validation accuracy: 82%</strong></p><p>The model performs brilliantly on examples it has already seen but struggles with new ones.</p><p>Regularization tries to reduce this problem.</p><h3>1. L1 Regularization — Encourage Simplicity</h3><p>Suppose our model has these weights:</p><p>[5.2, 0.8, -3.1, 0.05, 2.4]</p><p>L1 regularization adds a penalty based on the <strong>absolute values of the weights</strong>.</p><p>Conceptually:</p><p><strong>Total Loss = Original Loss + λ × Σ|w|</strong></p><p>where:</p><ul><li><strong>w</strong> represents the weights</li><li><strong>λ (lambda)</strong> controls the strength of regularization</li></ul><p>An interesting property of L1 is that it can push some weights <strong>exactly to zero</strong>.</p><p>For example:</p><p><strong>Before L1</strong></p><p>[5.2, 0.8, -3.1, 0.05, 2.4]</p><p><strong>After L1</strong></p><p>[4.1, 0, -2.2, 0, 1.6]</p><p>Some features are effectively removed.</p><p>This is why L1 can create <strong>sparse models</strong>.</p><h3>Simple analogy</h3><p>Imagine packing for a weekend trip.</p><p>Without restrictions, you might pack 20 things.</p><p>Now imagine that the airline charges you for every item.</p><p>Suddenly you start asking:</p><blockquote><em>“Do I actually need this?”</em></blockquote><p>L1 encourages the model to make a similar decision about its weights.</p><h3>Pros</h3><ul><li>Can create sparse models</li><li>Performs implicit feature selection</li><li>Can improve interpretability</li><li>Helps reduce overfitting</li></ul><h3>Cons</h3><ul><li>Too much L1 can remove useful information</li><li>λ needs to be tuned</li><li>Can behave unpredictably when features are strongly correlated</li></ul><h3>Easy way to remember</h3><p><strong>L1 → Some weights become ZERO.</strong></p><h3>2. L2 Regularization — Keep Weights Small</h3><p>L2 has the same overall goal as L1 but uses a different penalty.</p><p>Instead of absolute values, L2 penalizes <strong>squared weights</strong>:</p><p><strong>Total Loss = Original Loss + λ × Σw²</strong></p><p>Suppose our original weights are:</p><p>[5.2, 0.8, -3.1, 0.05, 2.4]</p><p>After L2 regularization, they might become:</p><p>[3.8, 0.6, -2.3, 0.04, 1.8]</p><p>The weights become smaller, but they usually do not become exactly zero.</p><h3>Why does this help?</h3><p>A model that relies on a few extremely large weights can become overly sensitive to its inputs.</p><p>L2 encourages the model to distribute learning more smoothly.</p><h3>Simple analogy</h3><p>Imagine five people carrying a heavy table.</p><p>Without L2, perhaps one person carries most of the weight.</p><p>With L2, we encourage everyone to share the load.</p><h3>Pros</h3><ul><li>Reduces excessively large weights</li><li>Helps control overfitting</li><li>Often produces stable models</li><li>Widely used in neural networks</li></ul><h3>Cons</h3><ul><li>Usually doesn’t perform feature selection</li><li>λ requires tuning</li><li>Too much L2 can cause underfitting</li></ul><h3>Easy way to remember</h3><p><strong>L1 → remove some unnecessary weights</strong></p><p><strong>L2 → make weights smaller</strong></p><h3>3. Dropout — Randomly Turn Off Neurons</h3><p>Dropout takes a completely different approach.</p><p>Imagine a neural-network layer containing five neurons:</p><p><strong>● ● ● ● ●</strong></p><p>During one training step:</p><p><strong>● ✕ ● ✕ ●</strong></p><p>During another:</p><p><strong>✕ ● ● ● ✕</strong></p><p>Some neurons are randomly disabled during training.</p><p>For example:</p><p><strong>Dropout rate = 0.5</strong></p><p>means that each unit has a 50% probability of being dropped during a training step.</p><h3>Why would disabling neurons help?</h3><p>Imagine a group project where one student always does the difficult work.</p><p>Eventually everyone else becomes dependent on that student.</p><p>Now imagine that some students are randomly absent each day.</p><p>Everyone needs to learn how to contribute.</p><p>Dropout encourages neurons to behave similarly.</p><p>The network becomes less dependent on particular combinations of neurons and learns more robust representations.</p><p>During inference, Dropout is normally disabled.</p><h3>Pros</h3><ul><li>Effective regularization for neural networks</li><li>Reduces co-adaptation between neurons</li><li>Can improve generalization</li><li>Easy to implement</li></ul><h3>Cons</h3><ul><li>Can slow convergence</li><li>Dropout rate requires tuning</li><li>Too much Dropout can cause underfitting</li><li>Not equally useful for every neural-network architecture</li></ul><h3>Easy way to remember</h3><p><strong>Dropout → Don’t let neurons depend too much on each other.</strong></p><h3>4. Data Augmentation — Create More Training Examples</h3><p>Suppose we are training a model to recognize cats.</p><p>We have one image of a cat.</p><p>Instead of showing the exact same image repeatedly, we can create variations:</p><p><strong>Original → Flip → Rotate → Crop → Zoom → Brightness change</strong></p><p>Every image still represents:</p><p><strong>CAT</strong></p><p>But the model sees the cat under different conditions.</p><p>This is <strong>Data Augmentation</strong>.</p><h3>Why does this help?</h3><p>Imagine learning what a car looks like.</p><p>If you’ve only ever seen one red car from the front, you might incorrectly believe that every car must be red and viewed from the front.</p><p>But after seeing cars from different angles, distances, colours, and lighting conditions, you learn the more general concept of a <strong>car</strong>.</p><p>Data augmentation encourages models to do the same.</p><p>Common image augmentations include:</p><ul><li>Flipping</li><li>Rotation</li><li>Cropping</li><li>Translation</li><li>Zooming</li><li>Brightness and contrast changes</li><li>Appropriate noise</li></ul><p>Data augmentation can also be applied to audio, text, and time-series data, although the correct transformations depend on the domain.</p><h3>Pros</h3><ul><li>Increases training-data diversity</li><li>Reduces overfitting</li><li>Improves robustness</li><li>Useful when labelled data is limited</li><li>Can improve real-world generalization</li></ul><h3>Cons</h3><ul><li>Increases training computation</li><li>Poor transformations can create unrealistic data</li><li>Transformations must preserve the correct label</li><li>Appropriate augmentation is domain-specific</li></ul><h3>Easy way to remember</h3><p><strong>Data Augmentation → Same answer, more useful variations.</strong></p><h3>5. Early Stopping — Know When to Stop</h3><p>Imagine training a neural network for 100 epochs.</p><p>Initially:</p><p><strong>Training loss ↓</strong></p><p><strong>Validation loss ↓</strong></p><p>Everything looks good.</p><p>But after epoch 40:</p><p><strong>Training loss continues ↓</strong></p><p>while:</p><p><strong>Validation loss starts ↑</strong></p><p>The model is getting better at fitting its training data but worse at handling unseen data.</p><p>It has started to overfit.</p><p>Instead of continuing until epoch 100, we can stop near the point where validation performance was best.</p><p>This is <strong>Early Stopping</strong>.</p><p>For example:</p><p>EpochValidation Loss100.42200.31300.2540<strong>0.22</strong>500.24600.28</p><p>The best validation result occurred around <strong>epoch 40</strong>.</p><p>Continuing training made the model worse on validation data.</p><h3>Patience</h3><p>We normally don’t stop after one bad epoch because validation loss can fluctuate.</p><p>Instead, we can use <strong>patience</strong>.</p><p>For example:</p><p><strong>patience = 5</strong></p><p>means that training can continue for several epochs without sufficient validation improvement before it stops.</p><h3>Pros</h3><ul><li>Simple and effective</li><li>Avoids unnecessary training</li><li>Saves computational resources</li><li>Helps reduce overfitting</li><li>Works well with other regularization techniques</li></ul><h3>Cons</h3><ul><li>Requires validation data</li><li>Validation metrics can fluctuate</li><li>Patience must be chosen appropriately</li><li>Stopping too early can cause underfitting</li></ul><h3>Easy way to remember</h3><p><strong>Early Stopping → Stop when validation performance stops improving.</strong></p><h3>How Do These Techniques Compare?</h3><p>TechniqueWhat It DoesMain Benefit<strong>L1</strong>Pushes some weights toward zeroSparsity / feature selection<strong>L2</strong>Penalizes large squared weightsSmaller, more stable weights<strong>Dropout</strong>Randomly disables units during trainingReduces co-adaptation<strong>Data Augmentation</strong>Creates variations of training examplesMore diverse training data<strong>Early Stopping</strong>Stops when validation performance stops improvingAvoids training too long</p><p>These techniques attack overfitting from different directions.</p><p><strong>L1 and L2</strong> modify the objective function.</p><p><strong>Dropout</strong> modifies the network during training.</p><p><strong>Data Augmentation</strong> modifies the training data.</p><p><strong>Early Stopping</strong> controls how long we train.</p><h3>Can We Use Them Together?</h3><p>Yes.</p><p>For example, an image-classification training pipeline might use:</p><p><strong>Original Images</strong></p><p>↓</p><p><strong>Data Augmentation</strong></p><p>↓</p><p><strong>Neural Network</strong></p><p>↓</p><p><strong>L2 Regularization</strong></p><p>↓</p><p><strong>Dropout</strong></p><p>↓</p><p><strong>Training</strong></p><p>↓</p><p><strong>Monitor Validation Loss</strong></p><p>↓</p><p><strong>Early Stopping</strong></p><p>But more regularization is not always better.</p><p>Too much regularization can cause another problem:</p><p><strong>Underfitting.</strong></p><p>The goal is balance:</p><p><strong>Too little regularization → Overfitting</strong></p><p><strong>Appropriate regularization → Good generalization</strong></p><p><strong>Too much regularization → Underfitting</strong></p><h3>Explain It to a Six-Year-Old</h3><p>If I had to explain these techniques to a six-year-old:</p><p><strong>L1:</strong><br>“Don’t carry toys you don’t really need.”</p><p><strong>L2:</strong><br>“Don’t let one person carry everything.”</p><p><strong>Dropout:</strong><br>“Sometimes one team member sits out so everyone learns how to play.”</p><p><strong>Data Augmentation:</strong><br>“Practice the same thing in lots of slightly different ways.”</p><p><strong>Early Stopping:</strong><br>“Stop practising when more practice starts making you worse.”</p><p>That’s regularization in simple terms.</p><h3>The Bigger Lesson: Generalization Matters</h3><p>A model achieving:</p><p><strong>99.9% training accuracy</strong></p><p>is not automatically a good model.</p><p>The important question is:</p><blockquote><strong><em>How does it perform on data it has never seen before?</em></strong></blockquote><p>That’s <strong>generalization</strong>.</p><p>Regularization encourages models to learn meaningful patterns instead of memorizing every detail of their training data.</p><p><strong>L1:</strong> Remove unnecessary complexity.</p><p><strong>L2:</strong> Keep weights under control.</p><p><strong>Dropout:</strong> Reduce excessive dependency between neurons.</p><p><strong>Data Augmentation:</strong> Expose the model to useful variations.</p><p><strong>Early Stopping:</strong> Stop before overfitting becomes worse.</p><h3>Final Thoughts</h3><p>Regularization is essentially about teaching a model one important lesson:</p><blockquote><strong><em>Learn the pattern, not the noise.</em></strong></blockquote><p>The best model isn’t necessarily the model that performs perfectly on its training data.</p><p>It’s the model that can take what it learned and successfully apply it to <strong>new, unseen situations</strong>.</p><p>That’s the difference between <strong>memorization and understanding</strong>.</p><p>And in machine learning, that difference is called <strong>generalization</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d41b468200bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zigzags to Smooth Learning: 7 Optimization Techniques Every ML Engineer Should Understand]]></title>
            <link>https://medium.com/@karthikmarimuthu2010/from-zigzags-to-smooth-learning-7-optimization-techniques-every-ml-engineer-should-understand-ab9f98116aea?source=rss-de2757646283------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab9f98116aea</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Karthikmarimuthu]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 11:48:15 GMT</pubDate>
            <atom:updated>2026-09-07T11:48:15.171Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Feature Scaling, Batch Normalization, Mini-Batch Gradient Descent, Momentum, RMSProp, Adam, and Learning Rate Decay — explained simply.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABOcp0TdYuB3mLeH0Vb6cw.png" /></figure><p><em>Different techniques. A common goal: smoother optimization, faster learning, and better models.</em></p><p>Training a neural network can be thought of as <strong>finding the bottom of a mountain while walking through fog</strong>.</p><p>The height of the mountain represents the <strong>loss</strong> — how wrong our model currently is. Our objective is to find parameters that make this loss as small as possible.</p><p>Gradient descent gives us the basic strategy:</p><ol><li>Calculate the model’s error.</li><li>Calculate the gradients.</li><li>Move the parameters in a direction that reduces the error.</li><li>Repeat.</li></ol><p>But real optimization is rarely that straightforward. The loss landscape may be steep in one direction and flat in another. Gradients can oscillate, training can become unstable, and our steps can be too large or too small.</p><p>This is where optimization techniques become important.</p><p>Let’s understand seven of them.</p><h3>1. Feature Scaling — Put Features on Comparable Scales</h3><p>Imagine we are building a model to predict house prices using:</p><ul><li>Bedrooms: <strong>1–5</strong></li><li>House area: <strong>50–500 m²</strong></li><li>Annual income: <strong>€20,000–€200,000</strong></li></ul><p>These features have very different numerical scales.</p><p>This can create an elongated optimization landscape and cause gradient descent to zigzag instead of moving efficiently toward the minimum.</p><p>A common solution is <strong>standardization</strong>:</p><p><strong>x_scaled = (x — mean) / standard deviation</strong></p><p>Suppose the average house area is 150 m² and the standard deviation is 50 m².</p><p>For a 200 m² house:</p><p><strong>x_scaled = (200–150) / 50 = 1</strong></p><p>Instead of working with 200, the model works with 1.</p><h3>Why does it help?</h3><p>Without scaling:</p><p><strong>↘ ↙ ↘ ↙ ↘ ↙</strong></p><p>With scaling:</p><p><strong>↓ ↓ ↓ ↓</strong></p><p>Feature scaling makes the optimization landscape easier to navigate.</p><h3>Pros</h3><ul><li>Faster convergence for many gradient-based models</li><li>Better numerical stability</li><li>Prevents differences in feature scale from distorting optimization</li><li>Important for algorithms such as neural networks, SVMs, and k-nearest neighbours</li></ul><h3>Cons</h3><ul><li>Requires preprocessing</li><li>Scaling statistics must be calculated from training data only</li><li>Not necessary for many tree-based algorithms</li></ul><h3>2. Batch Normalization — Normalize Inside the Network</h3><p>Feature scaling normalizes the <strong>input features</strong>.</p><p>But after data passes through neural-network layers, the intermediate activations can also vary substantially.</p><p><strong>Batch Normalization (BatchNorm)</strong> normalizes activations using statistics calculated from a mini-batch.</p><p>Approximately:</p><p><strong>x̂ = (x — batch mean) / √(batch variance + ε)</strong></p><p>It then applies learnable parameters:</p><p><strong>y = γx̂ + β</strong></p><p>where <strong>γ</strong> controls scaling and <strong>β</strong> controls shifting.</p><p>This means the network is not forced to keep every activation at exactly mean 0 and variance 1. It can learn the most useful transformation.</p><h3>Simple analogy</h3><p>Think about a factory production line.</p><p>If every machine receives materials in wildly different conditions, each stage has to constantly adjust.</p><p>BatchNorm makes the inputs to a stage more predictable, which can make training more stable.</p><h3>Pros</h3><ul><li>Often stabilizes neural-network training</li><li>Can allow higher learning rates</li><li>Reduces sensitivity to initialization</li><li>Can provide a mild regularization effect</li></ul><h3>Cons</h3><ul><li>Adds computation and parameters</li><li>Behaves differently during training and inference</li><li>Very small batches can produce unreliable batch statistics</li></ul><h3>3. Mini-Batch Gradient Descent — Learn from Small Groups</h3><p>Suppose our dataset contains <strong>1,000,000 training examples</strong>.</p><p>We could use all of them before updating the model.</p><p>That’s <strong>Batch Gradient Descent</strong>.</p><p>Or we could update after every single example.</p><p>That’s <strong>Stochastic Gradient Descent (SGD)</strong>.</p><p>Mini-batch gradient descent finds a useful middle ground.</p><p>For example:</p><p><strong>1,000,000 samples → batches of 128 → update after each batch</strong></p><p>Instead of waiting for the entire dataset, the model learns from small groups of examples.</p><h3>Why is this useful?</h3><p>Modern GPUs can process many examples in parallel.</p><p>Mini-batches therefore provide a good balance between:</p><p><strong>speed + memory efficiency + reasonably stable gradients</strong></p><h3>Pros</h3><ul><li>Efficient on GPUs and TPUs</li><li>Lower memory requirements than full-batch training</li><li>Frequent model updates</li><li>Standard approach for modern neural networks</li></ul><h3>Cons</h3><ul><li>Batch size becomes another hyperparameter</li><li>Very small batches can produce noisy gradients</li><li>Very large batches require more memory</li></ul><h3>4. Gradient Descent with Momentum — Remember Where You Were Going</h3><p>Imagine rolling a ball down a hill.</p><p>Ordinary gradient descent asks:</p><blockquote><strong><em>Which direction is downhill right now?</em></strong></blockquote><p>Momentum also asks:</p><blockquote><strong><em>Which direction have I been moving recently?</em></strong></blockquote><p>A simplified version is:</p><p><strong>vₜ = βvₜ₋₁ + (1 — β)gₜ</strong></p><p>Then:</p><p><strong>θₜ = θₜ₋₁ — αvₜ</strong></p><p>where:</p><ul><li><strong>gₜ</strong> = current gradient</li><li><strong>vₜ</strong> = accumulated direction</li><li><strong>β</strong> = momentum coefficient</li><li><strong>α</strong> = learning rate</li></ul><p>A common value for β is around <strong>0.9</strong>.</p><p>Suppose gradients consistently point toward the right:</p><p><strong>→ → → → →</strong></p><p>Momentum builds speed in that direction.</p><p>But suppose they oscillate vertically:</p><p><strong>↑ ↓ ↑ ↓ ↑ ↓</strong></p><p>Those opposing movements tend to cancel each other.</p><p>Instead of:</p><p><strong>↗ ↘ ↗ ↘ ↗ ↘</strong></p><p>we can get:</p><p><strong>→ → → → →</strong></p><h3>Pros</h3><ul><li>Reduces oscillation</li><li>Accelerates movement in consistent directions</li><li>Often converges faster than plain gradient descent</li><li>Computationally inexpensive</li></ul><h3>Cons</h3><ul><li>Introduces another hyperparameter</li><li>Too much momentum can cause overshooting</li><li>Still depends strongly on the learning rate</li></ul><h3>5. RMSProp — Adapt the Step Size</h3><p>Momentum considers the <strong>direction</strong> of recent gradients.</p><p>RMSProp focuses on their <strong>magnitude</strong>.</p><p>It maintains an exponentially weighted average of squared gradients:</p><p><strong>sₜ = βsₜ₋₁ + (1 — β)gₜ²</strong></p><p>The parameter update is approximately:</p><p><strong>θₜ = θₜ₋₁ — α × gₜ / √(sₜ + ε)</strong></p><p>Why square the gradients?</p><p>Because squaring removes the sign and measures their magnitude.</p><p>If one parameter repeatedly receives large gradients, RMSProp reduces its effective step size.</p><p>If another receives smaller gradients, its relative update can remain larger.</p><p>Imagine descending through a narrow valley.</p><p>Plain gradient descent might bounce:</p><p><strong>↘ ↙ ↘ ↙ ↘</strong></p><p>RMSProp adapts the effective step sizes and can produce a smoother path toward the minimum.</p><h3>Pros</h3><ul><li>Adaptive learning rates for individual parameters</li><li>Reduces oscillation</li><li>Useful when gradient magnitudes differ substantially</li><li>Can work well for non-stationary objectives</li></ul><h3>Cons</h3><ul><li>Requires more computation and memory than basic SGD</li><li>Introduces additional hyperparameters</li><li>Performance still depends on the problem and initial learning rate</li></ul><h3>6. Adam — Momentum + RMSProp</h3><p>Now let’s combine the previous two ideas.</p><p><strong>Momentum:</strong> remember the direction of recent gradients.</p><p><strong>RMSProp:</strong> adapt updates using recent squared-gradient magnitudes.</p><p><strong>Adam:</strong> combine both.</p><p>Adam stands for <strong>Adaptive Moment Estimation</strong>.</p><p>It maintains two moving averages:</p><p><strong>mₜ = β₁mₜ₋₁ + (1 — β₁)gₜ</strong></p><p>and</p><p><strong>vₜ = β₂vₜ₋₁ + (1 — β₂)gₜ²</strong></p><p>The first estimates the gradient’s first moment, while the second estimates its second raw moment. Adam also performs <strong>bias correction</strong>, especially important during the first training steps.</p><p>A useful mental model is:</p><p><strong>Adam ≈ Momentum + adaptive per-parameter scaling</strong></p><p>Common starting values are:</p><ul><li>Learning rate: <strong>0.001</strong></li><li>β₁: <strong>0.9</strong></li><li>β₂: <strong>0.999</strong></li><li>ε: a very small value for numerical stability</li></ul><h3>Pros</h3><ul><li>Adaptive updates for individual parameters</li><li>Incorporates momentum-like behaviour</li><li>Usually works well with relatively little initial tuning</li><li>Effective with sparse gradients</li><li>Popular default optimizer for many deep-learning tasks</li></ul><h3>Cons</h3><ul><li>Uses more memory than SGD</li><li>More complex than SGD with Momentum</li><li>Not guaranteed to produce the best generalization</li><li>Carefully tuned SGD with Momentum can outperform Adam on some problems</li></ul><p><strong>Adam is a great starting point — not a universal winner.</strong></p><h3>7. Learning Rate Decay — Slow Down Near the Destination</h3><p>The <strong>learning rate</strong> determines how large each optimization step is.</p><p>Imagine again that we’re descending a mountain.</p><p>When we’re far from the bottom, taking large steps can be useful.</p><p><strong>→ → → →</strong></p><p>But near the minimum, those same large steps might repeatedly jump across it.</p><p><strong>← Minimum →</strong></p><p>A solution is to gradually reduce the learning rate during training.</p><p>For example:</p><p><strong>Epoch 1 → 0.01</strong></p><p><strong>Epoch 20 → 0.005</strong></p><p><strong>Epoch 50 → 0.001</strong></p><p><strong>Epoch 100 → 0.0001</strong></p><p>We move quickly at the beginning and become more careful later.</p><p>Common strategies include:</p><ul><li>Step decay</li><li>Exponential decay</li><li>Cosine decay</li><li>Reduce-on-plateau</li><li>Warmup followed by decay</li></ul><h3>Pros</h3><ul><li>Faster progress early in training</li><li>More precise adjustments later</li><li>Can reduce oscillation near a minimum</li><li>Often improves final convergence</li></ul><h3>Cons</h3><ul><li>Introduces scheduling decisions</li><li>Decaying too quickly can stop useful learning</li><li>Decaying too slowly can waste training time</li><li>The ideal schedule depends on the problem</li></ul><h3>How Do These Techniques Work Together?</h3><p>One important point is that these seven techniques are <strong>not necessarily competitors</strong>.</p><p>They solve different problems.</p><p>A neural-network training pipeline might look like:</p><p><strong>Raw Data</strong><br>↓<br><strong>Feature Scaling</strong><br>↓<br><strong>Neural Network + Batch Normalization</strong><br>↓<br><strong>Mini-Batches</strong><br>↓<br><strong>Forward Pass</strong><br>↓<br><strong>Calculate Loss</strong><br>↓<br><strong>Backpropagation</strong><br>↓<br><strong>Adam / RMSProp / SGD + Momentum</strong><br>↓<br><strong>Update Parameters</strong><br>↓<br><strong>Learning Rate Scheduler</strong><br>↓<br><strong>Repeat</strong></p><p>For example, we might train a neural network using:</p><ul><li>Standardized input features</li><li>BatchNorm inside selected layers</li><li>Mini-batches of 64 examples</li><li>Adam optimizer</li><li>Initial learning rate of 0.001</li><li>Learning-rate decay later in training</li></ul><p>Each technique addresses a different part of the optimization process.</p><h3>Quick Comparison</h3><p>TechniqueMain ProblemCore Idea<strong>Feature Scaling</strong>Features have different scalesNormalize input features<strong>Batch Normalization</strong>Deep-network training can be unstableNormalize intermediate activations<strong>Mini-Batch GD</strong>Full datasets are expensive per updateLearn from small batches<strong>Momentum</strong>Gradient descent oscillatesRemember previous direction<strong>RMSProp</strong>Gradient magnitudes differAdapt effective step sizes<strong>Adam</strong>Need momentum + adaptive scalingCombine both ideas<strong>Learning Rate Decay</strong>Large steps become problematic laterReduce learning rate over time</p><h3>An Easy Way to Remember All Seven</h3><p>Imagine you are travelling down a mountain toward a destination.</p><p><strong>Feature Scaling</strong> makes the terrain more balanced.</p><p><strong>Batch Normalization</strong> keeps intermediate conditions inside the network more manageable.</p><p><strong>Mini-Batch Gradient Descent</strong> lets you make frequent decisions using manageable groups of information.</p><p><strong>Momentum</strong> remembers the direction you were already travelling.</p><p><strong>RMSProp</strong> adjusts how aggressively you move based on recent gradient magnitudes.</p><p><strong>Adam</strong> combines directional memory with adaptive step sizing.</p><p><strong>Learning Rate Decay</strong> lets you move quickly when far away and slow down as you approach your destination.</p><h3>Final Thoughts</h3><p>Optimization is not simply about asking:</p><blockquote><strong><em>“Should I use Adam or SGD?”</em></strong></blockquote><p>The more useful question is:</p><blockquote><strong><em>“What optimization problem am I trying to solve?”</em></strong></blockquote><p>Feature scaling improves the geometry of the optimization problem.</p><p>Batch normalization can stabilize internal activations.</p><p>Mini-batches make training computationally practical.</p><p>Momentum reduces unnecessary oscillation.</p><p>RMSProp adapts updates according to recent gradient magnitudes.</p><p>Adam combines momentum-like behaviour with adaptive scaling.</p><p>Learning-rate decay allows the optimizer to move quickly early in training and more carefully later.</p><p>The main idea I take away from these techniques is simple:</p><blockquote><strong><em>Optimization is about controlling how a model learns — how fast it moves, how stable that movement is, and how precisely it approaches a good solution.</em></strong></blockquote><p>Once we understand that, these techniques stop looking like seven unrelated concepts.</p><p>They become seven different tools working toward the same goal:</p><p><strong>faster, smoother, and more effective learning.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab9f98116aea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>