<?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 Shrutika kapade on Medium]]></title>
        <description><![CDATA[Stories by Shrutika kapade on Medium]]></description>
        <link>https://medium.com/@shrutikakkapade21?source=rss-32e70e970d3d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*a829p8_UyQb300DvFF8DDA.jpeg</url>
            <title>Stories by Shrutika kapade on Medium</title>
            <link>https://medium.com/@shrutikakkapade21?source=rss-32e70e970d3d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 02:44:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shrutikakkapade21/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[The Mathematical Foundations of Machine Learning: A Deep Dive into the Language Behind Algorithms]]></title>
            <link>https://medium.com/@shrutikakkapade21/the-hidden-language-of-machines-a-journey-through-math-vectors-and-distances-46a1a0d6ebe1?source=rss-32e70e970d3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/46a1a0d6ebe1</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[vector]]></category>
            <category><![CDATA[mathematical-notation]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[distance-matrix]]></category>
            <dc:creator><![CDATA[Shrutika kapade]]></dc:creator>
            <pubDate>Wed, 27 Aug 2025 14:23:07 GMT</pubDate>
            <atom:updated>2025-08-28T07:27:49.063Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine two friends, Asha and Ravi, walking through a bustling market.</p><ul><li>Asha notices patterns in the crowd — “Most of the kids are around the toy shop.”</li><li>Ravi, more analytical, starts scribbling numbers: <em>heights, weights, ages</em> of people passing by.</li></ul><p>Later, Ravi says,</p><blockquote><em>“If I put all this in a table, I could </em><strong><em>predict</em></strong><em> where people are likely to go next.”</em></blockquote><p>What Asha saw intuitively, Ravi tried to capture mathematically.<br>That’s exactly what <strong>Machine Learning does</strong>: it translates human intuition into numbers, equations, and algorithms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*o2qrawkW79d-WkkvsJ2bng.jpeg" /></figure><p>But here’s the catch:<br>Before machines can “learn,” they need a way to <strong>represent</strong> people, objects, or behaviors. That’s where <strong>mathematics</strong> comes in — turning messy real-world data into clean mathematical structures like <strong>vectors, matrices, and distances</strong>.</p><p>In this blog, we’ll uncover the <strong>hidden language machines speak</strong>:</p><ul><li>How a simple <strong>DataFrame</strong> becomes a <strong>matrix</strong></li><li>How <strong>vector algebra</strong> helps models “understand” data</li><li>How <strong>distance metrics</strong> let machines measure similarity, just like humans do</li></ul><p>By the end, you’ll see why math isn’t a barrier to machine learning — it’s the bridge that makes it possible.</p><h4>From DataFrame to Mathematical Notation</h4><p>In machine learning, a dataset is often organized as a <strong>DataFrame</strong> consisting of rows and columns. While this tabular format is convenient for humans to interpret, algorithms require a <strong>mathematical representation</strong> to process the data efficiently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*EbvZAvMZJXbbkB6_Upw6gw.png" /></figure><ul><li>The <strong>input features</strong> (Height, Weight) can be grouped into a vector xi.</li><li>The <strong>target/output</strong> (Gender) is denoted as yi.</li></ul><p>So, mathematically, each row is written as a pair:</p><p><strong>(x1,y1),(x2,y2),……………,(xn,yn)</strong></p><p>Here,</p><ul><li>xi​ = input features (independent variables)</li><li>yi = output or target (dependent variable)</li><li>n = number of rows (data points).</li></ul><h4>Regression Representation</h4><p>For <strong>regression problems</strong>, the goal is to predict a <strong>continuous value</strong> (like prices, temperature, or salary).</p><p>Mathematically, we write:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*lujI8tNlV-JJ1ev6bepF3g.png" /></figure><ul><li>xi is a feature vector of dimension d−1.</li><li>yi is a real number.</li></ul><p>Example: Predicting house price from size, location, and number of rooms.</p><h4>Classification Representation</h4><p>For <strong>classification problems</strong>, the goal is to assign each input to a <strong>category or class</strong>.</p><p>For binary classification, we can represent the dataset as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*OyeFkf5-a1PkDiv7bn5wgg.png" /></figure><ul><li>xi is again the feature vector.</li><li>yi is a class label, either −1 or +1.</li></ul><p>Example: Email classification</p><ul><li>+1: spam</li><li>−1: not spam</li></ul><p>This mathematical representation bridges the gap between raw tabular data (DataFrames) and the formal notation required for machine learning. The key distinction lies in the nature of the output variable y: continuous values in regression versus categorical labels in classification.</p><h4>How a Simple DataFrame Becomes a Matrix</h4><p>While a DataFrame is excellent for human readability (with rows and columns labeled nicely), machine learning algorithms do not “see” data the same way. They require a <strong>mathematical structure</strong> — most commonly a <strong>matrix</strong> — to perform computations like dot products, gradient updates, or distance calculations.</p><p><strong>Why do we convert to a matrix:</strong></p><ul><li>A <strong>matrix</strong> allows algorithms to efficiently apply <strong>linear algebra operations</strong> that form the backbone of ML (e.g., matrix multiplication in neural networks, eigen decomposition in PCA).</li><li>Each row of the DataFrame becomes an <strong>input vector (xi​)</strong>, and all rows stacked together form a <strong>data matrix (X)</strong>.</li><li>The output column(s) form a separate <strong>vector (y)</strong>, which pairs with the inputs.</li></ul><h4>From DataFrame to Matrix: Step-by-Step</h4><h4>Step 1: Start with a DataFrame</h4><p>A DataFrame is a tabular structure with <strong>rows (observations)</strong> and <strong>columns (features)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*-soVW7gPulHxMLF8H-wVSw.png" /></figure><h4>Step 2: Think of Each Column as a Vector</h4><p>Each column can be represented as a <strong>column vector</strong> by default in mathematics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*Yyc8qI9gO9tYGREzaffhKw.png" /></figure><h4>Step 3: Convert Row into a Row Vector</h4><p>Instead of looking at columns separately, we combine features <strong>horizontally</strong> for each observation.<br> Each row becomes a <strong>row vector</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*Jp9fnuna9BBYc7N-TKidZw.png" /></figure><h4>Step 4: Stack Row Vectors into a Matrix</h4><p>When we stack all row vectors together, we get a <strong>matrix</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*xs_BoMzeVu4fJ8BBToYpPQ.png" /></figure><h4>Step 5: Why This Matters in ML</h4><ul><li>Machine Learning algorithms (regression, classification, clustering, etc.) <strong>operate on matrices</strong>.</li><li>Linear algebra operations (dot products, norms, matrix multiplications) <strong>extract patterns</strong> from this structure.</li><li>Converting DataFrames → matrices is what makes it possible for algorithms to “see” relationships between data points.</li></ul><h4>How Vector Algebra Helps Models “Understand” Data</h4><p>Once data is represented as vectors (rows of numbers), the next challenge is:<br> <strong>How does a machine actually “work” with these numbers?</strong><br> That’s where <strong>vector algebra</strong> comes in.</p><p>Think of vectors as arrows in space:</p><ul><li>Each data point (like a person’s height, weight, and age) becomes a vector in a multi-dimensional space.</li><li>Vector algebra gives us the tools to move, compare, and transform these arrows — just like we manipulate numbers in arithmetic.</li></ul><h4>Key Operations in Vector Algebra for ML</h4><p><strong>Vector Addition &amp; Subtraction</strong></p><ul><li>Let’s combine or compare data points.</li><li>Example: The difference vector between two customers’ spending habits shows how similar/different they are.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*sCv3dViThklTNk1gjWAhCQ.png" /></figure><p><strong>Scalar Multiplication</strong></p><ul><li>Scales a vector up or down.</li><li>Useful in normalization, where we rescale values so they don’t dominate the model.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*PrFMnH_KjU_nb2snvJZNig.png" /></figure><p><strong>Dot Product (Similarity Check)</strong></p><ul><li>Measures how similar two vectors are.</li><li>Central to algorithms like <strong>cosine similarity</strong> and <strong>linear regression</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*gisBRPhft-lCBwHBv9v6Zw.png" /></figure><p>If the dot product is large → vectors (data points) are pointing in the same direction → they’re similar.</p><p><strong>Norm (Vector Length)</strong></p><ul><li>Gives the “magnitude” of a data point.</li><li>Important for calculating distances (Euclidean, Manhattan, etc.).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*N8B1lXScmECsUqF2iGsDxQ.png" /></figure><p>By now, we’ve seen how raw data stored in a <strong>DataFrame</strong> transforms into <strong>matrices and vectors</strong>, making it readable for machine learning algorithms. Whether it’s <strong>regression</strong> (predicting continuous outcomes) or <strong>classification</strong> (predicting categories), this mathematical representation provides the structured foundation every model needs.</p><p>But representing data is only one part of the story.<br> The next critical step is understanding <strong>how similar or different data points are</strong> — a concept at the heart of clustering, KNN, and recommendation systems.</p><p>If you’d like to dive deeper into this, I’ve covered it in detail in my blog:<br> 📖 <em>[Mastering Distance Metrics in Machine Learning: 7 You Must Know to Build Smarter Models] :</em></p><p><a href="https://medium.com/@shrutikakkapade21/mastering-distance-metrics-in-machine-learning-7-you-must-know-to-build-smarter-models-315bd790012e">Mastering Distance Metrics in Machine Learning: 7 You Must Know to Build Smarter Models</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46a1a0d6ebe1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“From Raw to Remarkable: Optimizing Image Preprocessing for Machine Learning”]]></title>
            <link>https://medium.com/@shrutikakkapade21/from-raw-to-remarkable-optimizing-image-preprocessing-for-machine-learning-bcafad5bb14a?source=rss-32e70e970d3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcafad5bb14a</guid>
            <category><![CDATA[image-preprocessing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Shrutika kapade]]></dc:creator>
            <pubDate>Sat, 16 Aug 2025 17:48:26 GMT</pubDate>
            <atom:updated>2025-08-17T12:13:12.900Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“Imagine you’re handed a high-resolution wildlife photograph captured by a drone. The image is stunning — lush greenery, a river winding through, and somewhere in the corner, a rare animal you need to detect. You feed the image straight into your machine learning model, expecting magic… but the results are disappointing. The model misclassifies the animal, struggles with lighting, and even mistakes shadows for other objects. The problem isn’t the algorithm — it’s the data.<br> Just like a chef needs clean, properly prepared ingredients before cooking, machine learning models need well-preprocessed images before they can truly perform. That’s where image preprocessing steps in — the quiet hero behind accurate, efficient, and robust computer vision systems.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6TH_Zc-4J7euruNIxs8dZA.png" /><figcaption>Image Preprocessing Workflow in Machine Learning</figcaption></figure><p><strong>As the diagram shows, a raw image must go through several preprocessing steps before it can be effectively used by a machine learning model. Let’s break down what image preprocessing really means and why it’s crucial in the ML workflow.</strong></p><h3>Understanding Image Preprocessing</h3><h4>What is Image Preprocessing?</h4><p>Image preprocessing is the process of transforming raw images into a clean, standardized, and model-ready form, so algorithms can extract meaningful patterns without getting distracted by irrelevant noise.</p><h4>Why is Image Preprocessing Crucial in Machine Learning?</h4><p>A well-trained model is only as good as the data it’s given. Preprocessing ensures that:</p><ul><li><strong>Standardization:</strong> All images have the same size, aspect ratio, and resolution.</li><li><strong>Focus on Features:</strong> Important details are preserved while irrelevant noise is removed.</li><li><strong>Faster Training:</strong> Reduces the amount of unnecessary data, speeding up computations.</li><li><strong>Better Accuracy:</strong> Models can learn more effectively from clean, consistent data.</li></ul><h4>Example: Back to the Wildlife Story</h4><p>In our wildlife detection case:</p><ul><li>The drone’s raw image might be <strong>too large</strong> for the model to handle.</li><li>Different lighting conditions could <strong>confuse</strong> the model.</li><li>Unnecessary background elements (trees, rocks) might distract from the <strong>actual animal</strong>.</li></ul><p>By resizing the image, normalizing brightness, and filtering noise, we ensure the model sees <strong>just what it needs to see</strong> — improving classification accuracy and reducing false detections.</p><h4>Image Datatypes in Machine Learning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*xLjB7CFgCj_hM_9Rg6pL8w.png" /></figure><ol><li><strong>File Format (Storage Level)</strong></li></ol><ul><li>Images are usually stored as files in formats like <strong>JPG, PNG, BMP, and TIFF</strong>.</li><li>At this stage, they are compressed or encoded for storage efficiency.</li></ul><p><strong>2. Array Representation (Processing Level)</strong></p><ul><li>Once loaded into Python using libraries like <strong>OpenCV</strong> or <strong>Pillow</strong>, an image becomes a <strong>NumPy array</strong>.</li><li>Each pixel is represented as a numerical value.</li><li><strong>Grayscale Image</strong> → 2D array (height × width) where each value is intensity (0–255).</li><li><strong>Color Image (RGB/BGR)</strong> → 3D array (height × width × 3 channels).</li></ul><p><strong>3. Pixel Value Datatypes</strong></p><ul><li><strong>uint8 (Unsigned 8-bit Integer)</strong> → Most common; pixel values range from 0 to 255.</li><li><strong>float32 / float64</strong> → Used after normalization or advanced processing; values range from 0.0 to 1.0 or -1.0 to 1.0.</li></ul><blockquote>“Now that we understand how images are represented as arrays in machine learning, let’s look at another important aspect: <strong>bit depth</strong> — the number of bits used to represent the color of a single pixel. Bit depth determines the range of colors or shades an image can store, which directly impacts how we preprocess and use it in ML models.”</blockquote><h4>Types of Digital Images by Bit Depth</h4><p>The <strong>bit depth</strong> of an image defines how much information each pixel can store , which in turn affects <strong>color range, file size, and processing requirements</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dySy8-tkihjEtU57ADup9g.png" /></figure><p>Understanding the type and bit depth of your images helps in making the right preprocessing decisions. For example, converting a 24-bit RGB photo into 8-bit grayscale reduces file size and speeds up training, but may cause loss of important color-based features if the task depends on them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K1-vwitR91ORy0NJI1pCQg.png" /></figure><h4>Why This Matters in Machine Learning &amp; Computer Vision</h4><p>The way images are represented has a <strong>direct impact on model accuracy, computational efficiency, and storage requirements</strong>. Choosing the right representation ensures better performance for the task at hand:</p><ul><li><strong>Monochrome (1-bit):</strong> Ultra-lightweight representation, ideal for tasks focused on <strong>shapes, edges, or binary classification</strong>. Fastest to process but carries minimal detail.</li><li><strong>Grayscale (8-bit):</strong> Strips away color while preserving <strong>textures, edges, and structural patterns</strong>. Reduces noise and computation, making it widely used in classical CV tasks.</li><li><strong>8-bit Color (Indexed):</strong> Efficiently represents images with limited color diversity. Useful in <strong>compression and memory-sensitive applications</strong> where color still plays a role.</li><li><strong>24-bit Color (RGB):</strong> Captures the <strong>full richness of visual information (16.7M colors)</strong>, making it the preferred choice for <strong>deep learning and high-accuracy computer vision models</strong>.</li></ul><blockquote>“Bit depth tells us how much color information a <strong>pixel </strong>can store — but it doesn’t define how that color is represented. That’s where <strong>color spaces</strong> come in, organizing this information in ways that make image processing and ML tasks more effective.”</blockquote><h3>Understanding Color Spaces in Image Processing</h3><h4>What are Color Spaces?</h4><p>A <strong>color space</strong> defines a specific way of representing colors using numerical values, enabling computers to process and analyze visual information effectively. Different color spaces are designed to highlight particular aspects of color, brightness, or contrast, making them suitable for specific image processing or machine learning tasks.</p><h4>The 3 most used color spaces are:</h4><ol><li><strong>RGB (Red, Green, Blue)</strong>:</li></ol><ul><li>The RGB color space represents images using three color channels: <strong>Red</strong>, <strong>Green</strong>, and <strong>Blue</strong>. Each pixel is a combination of these three values, typically ranging from 0 to 255 in 8-bit images.</li><li>Most commonly used in digital cameras, monitors, and computer vision models, RGB is employed because it aligns with how electronic displays generate color.</li></ul><p><strong>2. CMYK (Cyan, Magenta, Yellow, Key/Black):</strong></p><ul><li>CMYK is a subtractive color model used primarily for <strong>printing</strong>. Instead of adding light to produce color (as in RGB), it removes brightness from white paper by applying colored inks: <strong>Cyan</strong>, <strong>Magenta</strong>, <strong>Yellow</strong>, and <strong>Black</strong> (Key).</li><li>It is used for printing due to the large color variation.</li></ul><p><strong>3. HSV (Hue, Saturation, Value): </strong>HSV represents colors in terms of:</p><ul><li><strong>Hue:</strong> The actual color type (angle on a color wheel, e.g., red, green, blue).</li><li><strong>Saturation:</strong> The intensity or purity of the color.</li><li><strong>Value:</strong> The brightness of the color.</li><li>This is considered best for editing purposes because it separates out lightness variations from the hue and saturation variations</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*eLAbcbvNfLz0fRKeshMEtg.png" /></figure><h3>Contrast, Clarity, and Sharpness: The Visual Pillars of Image Quality</h3><p>After exploring how colors are represented through different <strong>color spaces (RGB, CMYK, HSV)</strong>, it’s time to focus on the qualities that directly impact how an image looks to both humans and machines. These qualities — <strong>contrast, clarity, and sharpness</strong> — may sound alike, but each plays a unique role in image processing and machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*9y8z16hblKJj7PLpyCdKkw.png" /></figure><h4>Basic Ideation Behind Core Computer Vision Tasks</h4><p>Image preprocessing is not the end goal — it’s the <strong>foundation</strong> that powers the bigger tasks in computer vision. Once images are cleaned, resized, and enhanced, they can be used for more advanced applications like recognition, detection, and segmentation. Let’s break down the key concepts in simple terms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ta0MF06_h_QWES3JBWSnWw.png" /></figure><h3>Case Study: Power of Image Preprocessing in Action</h3><p>Think of a Marvel superhero poster. To us, the characters are instantly recognizable — Iron Man’s red-gold armor, Hulk’s green skin, or Captain America’s shield. But for a machine learning model, the raw poster is chaotic:</p><ul><li>Too many <strong>colors and details</strong> competing for attention,</li><li>Image <strong>sizes and scales</strong> vary,</li><li>Backgrounds add <strong>noise</strong> that the model doesn’t care about.</li></ul><p>Without preprocessing, the model struggles to “see the hero.”</p><p>Just like superheroes prepare before battle, images also need <strong>preprocessing</strong> before entering a machine learning pipeline.</p><p><strong>Here’s how we transformed a Marvel image step by step:</strong></p><h4>Import &amp; Inspect the Raw Image</h4><pre># import required libraries <br>from PIL import Image, ImageEnhance, ImageOps, ImageDraw, ImageFont, ImageFilter<br>import numpy as np<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br><br>from matplotlib import image</pre><p><strong>Why we import [ from matplotlib import image ] :</strong></p><ul><li>matplotlib.image is a submodule of Matplotlib that provides functions to read and write images (mostly as NumPy arrays).</li><li>It’s different from PIL (Pillow) — while PIL is mainly for image processing, matplotlib.image is more about loading images into arrays for analysis or plotting.</li></ul><pre>#Task 1: Open { Fundo Heróis gibi.jpeg } Print its format, size, and mode.<br><br>from PIL import Image <br># Load the image<br>img = Image.open(&quot;Fundo Heróis gibi.jpeg&quot;)<br><br># Inspect properties<br>print(&quot;Size of image:&quot;,img.size) # Resolution → Geometry<br>print(&quot;Mode of image:&quot;,img.mode) # Pixel representation (RGB, Grayscale, etc.)<br>print(&quot;Format of image:&quot;,img.format) # Storage format (JPEG, PNG, etc.)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*lMJVmivY2J8uBaeIqKBMmQ.png" /></figure><h4>Import Image – Core Image Object :</h4><p>Handles opening, saving, and basic operations.</p><pre>#Task 2: Show the image inline in your notebook output.<br>plt.imshow(img)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*31hZyvxypiXMMf4SUxHpDw.png" /></figure><pre>#Task 3: Convert the image to grayscale.<br>from PIL import ImageEnhance <br>plt.figure(figsize =(12,12))<br><br># vibrance enhancer<br>color_enhancer = ImageEnhance.Color(img)<br><br>plt.subplot(1,2,1)<br>plt.title(&quot;Original Image&quot;)<br>plt.imshow(img)<br><br>plt.subplot(1,2,2)<br>plt.title(&quot;Gray Enhanced Image&quot;)<br>plt.imshow(color_enhancer.enhance(0))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*4aw1SZAZHRLy7Ap3HW_U3w.png" /></figure><h4>Import ImageEnhance – Image Adjustments</h4><p>Used to enhance properties like brightness, color, contrast, and sharpness.</p><p><strong>Enhancement Classes:</strong></p><ul><li>ImageEnhance.Color(img) → Adjust color.</li><li>ImageEnhance.Contrast(img) → Adjust contrast.</li><li>ImageEnhance.Brightness(img) → Adjust brightness.</li><li>ImageEnhance.Sharpness(img) → Adjust sharpness.</li></ul><pre>#Task 4: Resize the image to 200 × 200 pixels and display it.<br><br>resized_img = img.resize((200,200))<br><br>resized_img.save(&quot;resized_img_marvel_200.png&quot;)<br>print(&quot;Original_image_size:&quot;,img.size)<br>print(&quot;resized_image_size:&quot; ,resized_img.size)<br><br>plt.figure(figsize = (12,12))<br><br>plt.subplot(1,2,1)<br>plt.title(&quot;Original Image&quot;)<br>plt.imshow(img)<br><br>plt.subplot(1,2,2)<br>plt.title(&quot;Resized Image in 200x200 pixels&quot;)<br>plt.imshow(resized_img)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*6QPI2uSnVK-c5SFj-AZZsg.png" /></figure><pre># Task 5: Draw a red rectangle around Spider-Man. What changes when the size or position is adjusted?<br><br>from PIL import ImageDraw<br><br>img_copy = img.copy() # Work on a copy so the original isn&#39;t changed<br><br>red_rectangle = ImageDraw.Draw(img_copy) # Create a drawing object<br><br># Define the coordinates for the rectangle<br>xy = [(240,20) , (490,280)]<br><br># Draw a filled red rectangle<br>red_rectangle.rectangle(xy, outline= &quot;RED&quot;, fill= None, width = 2)<br><br>img_copy.save(&quot;Spiderman_captured.jpg&quot;)<br><br>img_copy.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*0jeGF9EqI0G8jXUyu9XsLg.png" /></figure><h4>Import ImageDraw – Drawing on Images</h4><p>Used to draw shapes, lines, and text.</p><p><strong>Key Methods:</strong></p><ul><li>draw.text((x,y), &quot;Hello&quot;, font=font, fill=color) → Write text.</li><li>draw.line(coords, fill, width) → Draw line.</li><li>draw.rectangle(coords, fill, outline) → Rectangle.</li><li>draw.ellipse(coords, fill, outline) → Circle/ellipse.</li></ul><pre># Task 6: Crop Spider-Man from the image and display only the cropped part.<br><br>Spiderman_imgg_cropped = img.crop((240,20,490,280))<br>plt.imshow(Spiderman_imgg_cropped )</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*C_4IhYhNTzPz5hX4zR4mBg.png" /></figure><pre>#Task 7: Rotate the image by 45 degrees and show the result.<br><br>img_rotated = img.rotate(45)<br>plt.imshow(img_rotated)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*zm1CwowJFwnW1whSChmDWQ.png" /></figure><p>Image preprocessing is more than just a technical step — it is the <strong>foundation of every successful computer vision project</strong>. By carefully transforming raw data into a cleaner, more structured form, we ensure that downstream tasks like recognition, detection, and segmentation can perform at their best.</p><p>In this case study, we explored <strong>7 practical steps</strong> that demonstrate how preprocessing techniques directly impact the quality of image analysis. These steps not only prepare images for machine learning pipelines but also highlight the importance of thoughtful data preparation in real-world applications.</p><p>If you’d like to dive deeper and explore the <strong>complete step-by-step code</strong>, you can check out my GitHub repository:</p><p><a href="https://github.com/shrutikakapade/Image-Preprocessing-with-Python-PIL-Matplotlib-.git">GitHub - shrutikakapade/Image-Preprocessing-with-Python-PIL-Matplotlib-: Beginner-friendly guide to image preprocessing with Python&#39;s PIL (Pillow) and Matplotlib. Covers core techniques like resizing, cropping, grayscale, brightness/contrast/sharpness tuning, and color enhancement - a practical foundation for computer vision learners.</a></p><p>📌 <strong>Takeaway</strong>: A well-preprocessed image is the key to unlocking accurate, reliable, and efficient computer vision models.</p><p>💡 Let’s connect and grow together!<br> 👉 Follow me on <a href="http://www.linkedin.com/in/shrutikakapade">LinkedIn</a> for more projects, insights, and learning resources.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcafad5bb14a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Decoding Language for Machines: A Complete Guide to NLP and Text Preprocessing”]]></title>
            <link>https://medium.com/@shrutikakkapade21/decoding-language-for-machines-a-complete-guide-to-nlp-and-text-preprocessing-41a13aaecb0d?source=rss-32e70e970d3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/41a13aaecb0d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ml-pipeline]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Shrutika kapade]]></dc:creator>
            <pubDate>Wed, 13 Aug 2025 11:15:13 GMT</pubDate>
            <atom:updated>2025-08-14T09:12:06.409Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine this — You just landed in a new country for a vacation. At the airport, you need to book a taxi, but the driver doesn’t speak your language. You pull out your phone, open Google Translate, and within seconds, your words are converted into the driver’s native language. He smiles, nods, and takes you exactly where you need to go.</p><p>Now think about it — in that moment, your phone didn’t just “translate words.” It understood the meaning of your sentence, recognized the context, and presented it in a way that made sense to another human being.</p><p>That’s <strong>Natural Language Processing (NLP)</strong> in action — the tech that makes machines understand and communicate in human language. And here’s the fun part: you’ve probably used NLP already today without even realizing it — whether it was <strong>asking Alexa to play music, letting Gmail filter out spam, or reading subtitles on Netflix</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*NKy2qdKoWCtFEKEVgU5-xA.jpeg" /></figure><h3>Introduction: Understanding NLP in the Modern World</h3><h4>What is NLP?</h4><ul><li><strong>Definition:</strong> A branch of Artificial Intelligence that enables computers to understand, interpret, and generate human language.</li><li><strong>Simplified meaning:</strong> The technology that allows machines to “listen” and “respond” in both speech and text form.</li></ul><h4>Why do we need NLP?</h4><ul><li>Human language is <strong>complex</strong>, with slang, abbreviations, emotions, and cultural differences.</li><li>Computers are <strong>great with numbers</strong> but struggle with the ambiguity and variety in words.</li><li>NLP <strong>bridges the gap</strong> by converting unstructured text into structured, analyzable data.</li><li>Enables machines to <strong>draw insights</strong> and make intelligent decisions from human communication.</li></ul><h4>What is the use of NLP?</h4><ul><li><strong>Everyday tools:</strong> Chatbots, virtual assistants (Alexa, Siri, Google Assistant), and language translation apps.</li><li><strong>Business:</strong> Improves customer service and analyzes feedback.</li><li><strong>Healthcare:</strong> Processes patient records and medical research.</li><li><strong>Finance:</strong> Detects fraud and analyzes market trends.</li><li><strong>Security:</strong> Identifies threats and suspicious communication in real time.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_VU2vZL6fUpVkAoOhuRwg.png" /><figcaption>Real-Life Examples of NLP in Action</figcaption></figure><p><strong>From NLP to Text Preprocessing</strong><br>Before an NLP model can understand language, the text must be prepared. Raw data is often messy — full of typos, symbols, and inconsistencies. <strong>Text preprocessing</strong> is the process of cleaning and transforming the data into a structured form that machines can interpret. It’s the foundation of every successful NLP project, ensuring better accuracy, efficiency, and insights.</p><h4>Text Preprocessing Pipeline (Step-by-Step)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*aik2vCaXhyo8L8rFiy2MaA.png" /><figcaption>Text Preprocessing Pipeline (Step-by-Step)</figcaption></figure><h4>1) Lowercasing</h4><p><strong>Goal:</strong> Normalize word forms.<br><strong>Example:</strong> &quot;NLP is FUN!&quot; → &quot;nlp is fun!&quot;<br><strong>Tip:</strong> It is usually safe to apply first.</p><h4>2) Remove Punctuation &amp; Special Characters</h4><p><strong>Goal:</strong> Reduce noise.<br><strong>Example:</strong> &quot;Hello!!! Are you #1?&quot; → &quot;Hello Are you 1&quot;<br><strong>Tip:</strong> Keep punctuation if it carries meaning (e.g., emojis, hashtags in social posts).</p><h4>3) Tokenization</h4><p><strong>Goal:</strong> Split text into units (words/subwords).<br><strong>Example:</strong> &quot;nlp makes machines understand language.&quot; → [&quot;nlp&quot;,&quot;makes&quot;,&quot;machines&quot;,&quot;understand&quot;,&quot;language&quot;]<br><strong>Tip:</strong> For morphologically rich languages, consider subword tokenizers (BPE/WordPiece).</p><h4>4) Remove Stopwords</h4><p><strong>Goal:</strong> Drop very common words that add little signal.<br> <strong>Example:</strong> [&quot;this&quot;,&quot;is&quot;,&quot;an&quot;,&quot;nlp&quot;,&quot;example&quot;] → [&quot;nlp&quot;,&quot;example&quot;]<br> <strong>Tip:</strong> Customize the stopword list per task/domain.</p><h4>5) Stemming</h4><p><strong>Goal:</strong> Trim words to crude roots.<br><strong>Example:</strong> [&quot;running&quot;,&quot;runs&quot;,&quot;easily&quot;] → [&quot;run&quot;,&quot;run&quot;,&quot;easili&quot;]<br><strong>Trade-off:</strong> Fast but can distort words.</p><h4>6) Lemmatization</h4><p><strong>Goal:</strong> Map to dictionary/base form using POS rules.<br><strong>Example:</strong> [&quot;running&quot;,&quot;ate&quot;,&quot;better&quot;] → [&quot;run&quot;,&quot;eat&quot;,&quot;good&quot;]<br><strong>Trade-off:</strong> Slower than stemming but cleaner.</p><h4>7) Handle Numbers</h4><p><strong>Goal:</strong> Remove or normalize numbers.<br><strong>Options:</strong></p><ul><li>Remove: &quot;I have 2 cats&quot; → &quot;I have cats&quot;</li><li>Mask: &quot;I have 2 cats&quot; → &quot;I have &lt;NUM&gt; cats&quot;<br> <strong>Tip:</strong> For finance/metrics, keep or bucket them.</li></ul><h4>8) Emojis &amp; Special Symbols</h4><p><strong>Goal:</strong> Preserve or translate sentiment/context.<br> <strong>Example:</strong> &quot;This product 😍&quot; → &quot;This product :smiling_face_with_heart_eyes&quot; or &quot;love_face&quot;<br> <strong>Tip:</strong> In sentiment tasks, don’t drop emojis.</p><h4>9) Spelling Correction</h4><p><strong>Goal:</strong> Fix typos to unify vocabulary.<br> <strong>Example:</strong> &quot;I liek nlp&quot; → &quot;I like nlp&quot;<br> <strong>Caution:</strong> May “over-correct” named entities/brand names—use selectively.</p><h4>10) Negation Handling</h4><p><strong>Goal:</strong> Keep “not” from flipping meaning.<br> <strong>Options:</strong></p><ul><li>Join tokens: &quot;not good&quot; → &quot;not_good&quot;</li><li>Negation scope: mark words until the next punctuation.<br> <strong>Result:</strong> Preserves sentiment polarity.</li></ul><h4>Vectorization (Feature Extraction)</h4><p>Computers can’t understand words directly — they work with numbers. <strong>Vectorization</strong> is the process of converting text into numerical representations (vectors) that a machine learning model can process.</p><p><strong>Before we dive into techniques, let’s clarify three key terms:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*PCOy2ZMZvK0lIm95O-5i_w.png" /></figure><ul><li><strong>Corpus</strong> → A collection of documents (e.g., all product reviews on Amazon).</li><li><strong>Document</strong> → A single piece of text within the corpus (e.g., one customer review).</li><li><strong>Terms (or Tokens)</strong> → The individual words or tokens in a document (e.g., <em>“great,” “product,” “quality”</em>).</li></ul><p><strong>There are different ways to do this:</strong></p><h4>1. Bag of Words (BoW)</h4><p>The <strong>Bag of Words</strong> model is one of the simplest ways to convert text into numbers for NLP tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*I1p2HjjH-HW1OnM17J6AFQ.png" /></figure><p><strong>Step 1 (fit process):</strong> Learn the vocabulary (i.e, Unique Words = “Feature Vectors”) from the entire corpus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*IOFEPUFCC95jlF_IWTM1Vw.png" /></figure><p><strong>Step 2 (Transform): </strong>Count the number of times each feature has appeared and create a “ Document Term Matrix”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zP1aPsvSxdMS8zuOVHP7_g.png" /></figure><h4>Understanding Word Frequencies in the Document-Term Matrix (DTM)</h4><p>In the <strong>Bag of Words</strong> model, each document is converted into a numerical vector, where each position represents a unique word from the corpus (vocabulary) and the value at that position shows <strong>how many times</strong> the word appears in that document.</p><p><strong>“It was the best &amp; best &amp; best of times and times”</strong></p><p><strong>Vocabulary (unique words):</strong><br> [it, was, the, best, of, times, and]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BGVng8jJUaDGCkj2jxJrCw.png" /><figcaption><strong>Word counts in this sentence</strong></figcaption></figure><h4><strong>Advantages:</strong></h4><ul><li>Simple and easy to implement.</li><li>Works well for small datasets and basic text classification.</li><li>Computationally inexpensive compared to advanced techniques.</li></ul><h4><strong>Disadvantages:</strong></h4><ul><li>Ignores word meaning and order (no context).</li><li>Can create very large, sparse matrices.</li><li>Treats all words equally, even common but less informative ones.</li></ul><h4>2. TF-IDF (Term Frequency–Inverse Document Frequency)</h4><ul><li>TF-IDF is used to measure how important a word is in a document compared to the whole collection of documents (<strong>corpus</strong>).</li><li>It reduces the weight of very common words (like “the”, “is”) and increases the weight of words that are unique or rare.</li><li>Formula :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*a_GYmHw6Zy0FRhMaPJUjQQ.png" /></figure><h4>How it works :</h4><ul><li><strong>High TF-IDF score</strong> → Word appears frequently in a document but rarely in others → High importance.</li><li><strong>Low TF-IDF score</strong> → Word appears in many documents → Less important.</li></ul><h4><strong>Example :</strong></h4><p>Suppose in a corpus of 100 documents:</p><ul><li>Word “data” appears <strong>5 times</strong> in one document (with 100 total words).</li><li>Appears in <strong>10 documents</strong> overall.</li></ul><p>TF = 5 / 100 = <strong>0.05</strong><br> IDF = log(100 / 10) = log(10) ≈ <strong>1</strong><br> TF-IDF = 0.05 × 1 = <strong>0.05</strong> (moderate importance)</p><h4><strong>Advantages:</strong></h4><ul><li>Reduces weight of common words, focusing on more informative terms.</li><li>Often improves accuracy compared to BoW in text classification.</li><li>Still relatively simple and efficient to compute.</li></ul><h4><strong>Disadvantages:</strong></h4><ul><li>Still ignores word order and semantic meaning.</li><li>Can perform poorly on very short texts.</li><li>Sensitive to vocabulary changes — new words require recomputing weights.</li></ul><h3>NLP ML Pipeline: Turning Text into Intelligence</h3><p>An NLP ML pipeline is the complete journey from <strong>raw text</strong> to <strong>AI-powered insights</strong>. It combines <strong>data preprocessing</strong>, <strong>feature extraction</strong>, and <strong>machine learning</strong> into one structured process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*C0IdgyXbhPcMsSJzTvKWzg.png" /></figure><p><strong>Quick Notes</strong></p><ul><li><strong>Corpus</strong> → Collection of text documents used for NLP.</li><li><strong>Document</strong> → A single piece of text within a corpus.</li><li><strong>Tokenization</strong> → Splitting text into words/tokens.</li><li><strong>Stopwords</strong> → Common words (e.g., “the”, “is”) often removed to reduce noise.</li><li><strong>Stemming</strong> → Reducing words to their root form (e.g., “running” → “run”).</li><li><strong>Lemmatization</strong> → Similar to stemming but uses vocabulary &amp; grammar (e.g., “better” → “good”).</li><li><strong>BoW</strong> → Represents text as word frequency counts, ignoring order.</li><li><strong>TF-IDF</strong> → Weighs words based on their importance across documents.</li></ul><p>Text preprocessing is the backbone of NLP, turning messy, unstructured text into clean, machine-readable data. Techniques like <strong>BoW</strong> and <strong>TF-IDF</strong> are powerful starting points, but the journey doesn’t stop there — modern NLP leverages embeddings and deep learning to truly understand language. Mastering preprocessing is your first step toward building intelligent, language-powered applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41a13aaecb0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Data Preprocessing: A Practical Guide to Clean and Transform Data for Machine Learning]]></title>
            <link>https://medium.com/@shrutikakkapade21/mastering-data-preprocessing-a-practical-guide-to-clean-and-transform-data-for-machine-learning-74d151dd523e?source=rss-32e70e970d3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/74d151dd523e</guid>
            <category><![CDATA[data-preprocessing]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-transformation]]></category>
            <dc:creator><![CDATA[Shrutika kapade]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 19:02:44 GMT</pubDate>
            <atom:updated>2025-08-06T19:02:44.337Z</atom:updated>
            <content:encoded><![CDATA[<p>Effective machine learning starts with high-quality data. This blog provides a comprehensive and practical guide to data preprocessing, covering essential steps such as handling missing values, encoding categorical variables, scaling features, and applying data transformations.</p><p>Whether you’re working with numerical or categorical data, this guide will help you build a solid foundation by preparing your dataset for accurate and reliable model performance.</p><h4>What is a Data Preprocessor?</h4><p>Think of a <strong>data preprocessor</strong> like a personal trainer for your dataset — it gets your raw data into shape before the real workout (machine learning) begins.</p><h4>Why Data Preprocessing Is Important</h4><p>In real-world projects, raw data is often <strong>messy and unorganized</strong>. Here’s why preprocessing is necessary:</p><ul><li>Data may contain <strong>missing values</strong>, <strong>inconsistencies</strong>, or <strong>irrelevant information</strong></li><li>It can have <strong>mixed data types</strong> (like numbers and text in the same column)</li><li>Feeding such data directly into a machine learning model can lead to <strong>poor results</strong> or even <strong>model failure</strong></li></ul><p>That’s where <strong>data preprocessing</strong> comes in. It helps by:</p><ul><li>Making the data <strong>clean, consistent, and structured</strong></li><li>Preparing data in a way that <strong>models can understand and learn from</strong></li><li>Creating a strong foundation for building <strong>accurate and reliable machine learning models.</strong></li></ul><h4>Why Preprocessing is Essential for Machine Learning Models</h4><p>Machine learning algorithms are mathematical models — they require clean, consistent, and properly formatted input to perform optimally. Without preprocessing, you risk:</p><ul><li><strong>Biased predictions</strong> due to missing or skewed data.</li><li><strong>Inaccurate results</strong> from unscaled or misencoded features.</li><li><strong>raining failures</strong> caused by incompatible data types.</li><li><strong>Poor generalization</strong> due to data leakage or noisy inputs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*CwfFjy3IiNQnseRYAumwVg.png" /></figure><h4>Proper preprocessing helps:</h4><ul><li>Improve model performance</li><li>Reduce training time</li><li>Prevent overfitting and underfitting</li><li>Ensure reproducibility and interpretability</li></ul><p><strong>In short, preprocessing turns raw data into a form that allows algorithms to learn meaningful patterns efficiently and reliably.</strong></p><h4>Step-by-Step Data Preprocessing Pipeline</h4><p>To build robust machine learning models, data must go through a structured preprocessing pipeline. In this section, we’ll explore each step — <strong>from data collection to final preparation</strong> — clearly and practically.</p><p>Each stage plays a vital role in transforming raw data into a clean, consistent, and model-ready format, ensuring better performance and reliability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkqtY82pa6FS0TLORkijYg.png" /><figcaption>Preprocessing Pipeline (Structured Data)</figcaption></figure><h4>A data preprocessor typically includes two major steps:</h4><p>Data Preprocessing = (Data Cleaning + Data Transformation)</p><h4><strong>Data Cleaning</strong></h4><p>Cleans the raw dataset to remove noise, errors, and inconsistencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wh_RbwI0gvucAa7p-nJwLQ.png" /></figure><ul><li><strong>Data Transformation</strong> — Converts the cleaned data into a format that models can understand (like encoding categories or scaling features).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*R7RPGstTIwwp-FsZ1_MKrw.png" /></figure><p>Now, we will focus on two key areas of structured data transformation: numerical and categorical data. You’ll learn how to scale, encode, and prepare these features for machine learning models.</p><blockquote>In future posts, we’ll explore <strong>text</strong> and <strong>image data transformation</strong> to cover unstructured data used in NLP and computer vision tasks.</blockquote><h4>Numerical Data Transformation</h4><p>Numerical data transformation involves modifying numeric features to improve consistency, reduce skewness, and help machine learning models learn more effectively.</p><p><strong>Common techniques include:</strong></p><ul><li><strong>Scaling:</strong> Standardization or normalization is used to bring all features to a similar range, especially important for distance-based algorithms.</li><li><strong>Log or Box-Cox Transformation:</strong> Helps reduce skewness and normalize distributions.</li><li><strong>Binning:</strong> Converts continuous values into discrete categories when needed.</li><li><strong>Polynomial Features:</strong> Generates new features to capture non-linear relationships.</li></ul><p>These transformations make numerical data more uniform, interpretable, and suitable for a wide range of machine learning algorithms.</p><p>Let’s explore the two most widely used techniques:</p><h4><strong>Feature Scaling:</strong></h4><p>Feature scaling is a crucial transformation technique used to bring numerical features onto a consistent scale. This helps machine learning algorithms treat all features equally, especially those sensitive to magnitude differences.</p><ul><li><strong>Standardization</strong> (Z-score scaling) transforms values to have a mean of 0 and a standard deviation of 1.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c_0mFXJmUl1Aof5JFOPYfg.png" /><figcaption>Mathematical Expression for Standardization</figcaption></figure><h4>The Formula:</h4><ul><li><strong>x</strong> = original data point</li><li><strong>μ</strong> = mean of the feature</li><li><strong>σ</strong> = standard deviation of the feature</li><li><strong>z</strong> = standardized value (Z-score)</li></ul><p>This formula subtracts the mean from each value and divides the result by the standard deviation, shifting the distribution to center it at <strong>0</strong> and scaling it to have a standard deviation of <strong>1</strong>.</p><h4>Graph Explanation:</h4><p>In the graph:</p><ul><li>The curve represents the <strong>standardized distribution of data</strong>.</li><li>The center (peak) is at <strong>μ = 0</strong>, indicating the mean.</li><li>The spread is determined by <strong>σ = 1</strong>, meaning most data points lie within ±1, ±2, and ±3 standard deviations.</li></ul><p>This ensures all features contribute <strong>equally</strong> to distance-based algorithms like <strong>KNN</strong>, <strong>SVM</strong>, and <strong>Logistic Regression</strong>.</p><ul><li><strong>Normalization</strong> (Min-Max scaling) resizes values to a fixed range, usually between 0 and 1.<br>These methods are essential for algorithms sensitive to feature scale, such as KNN or gradient descent-based models.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*UhsVqx5vkEB-UAz7tfAPUw.png" /></figure><h4>The Formula:</h4><ul><li><strong>X</strong> = original value</li><li><strong>X_min</strong> = minimum value of the feature</li><li><strong>X_max</strong> = maximum value of the feature</li><li><strong>X_new</strong> = normalized value (scaled between 0 and 1)</li></ul><h4>What This Formula Does:</h4><ul><li>It <strong>subtracts the minimum</strong> value from the data point (shifts the minimum to 0),</li><li>Then <strong>divides by the range</strong> (maximum — minimum), so the maximum becomes 1.</li><li>The resulting values are compressed into a consistent <strong>scale of 0 to 1</strong>.</li></ul><h4>Difference between Normalization and Standardization</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*49y3agKbFANq7XHARQzSzw.png" /></figure><h4>Categorical Data Transformation</h4><p>Categorical features — like colors, labels, or types — need to be <strong>converted into numerical values</strong> before being used in most machine learning models. This process is called <strong>categorical data transformation</strong>, and it ensures that algorithms can interpret and learn from these features.</p><p>Let’s explore the two most widely used techniques:</p><h4><strong>One-Hot Encoding</strong></h4><p>One-Hot Encoding creates <strong>separate binary columns</strong> for each category, assigning a 1 where the category is present and 0 elsewhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*zks2b8xYQRfxNMLrTR06Hg.png" /></figure><ul><li>A binary vector of 0s and 1s represents each category.</li><li>Each category gets its own binary feature, and only one of them is “hot” (set to 1) at a time, indicating the presence of that category.</li><li>Number of features = Number of unique categorical labels</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*L7QNX6xZ00Kf_aKqFEH_UQ.png" /></figure><ul><li>Dummy Encoding is an optimized version of One-Hot Encoding where <strong>one dummy variable (column) is intentionally dropped</strong> after encoding.</li><li>Prevents <strong>multicollinearity</strong> by removing redundancy in features , critical in regression and linear models.</li><li>Because all columns together add up to 1, one can be inferred from the others. Keeping all leads to <strong>linearly dependent features</strong>.</li><li>Ideal for <strong>nominal categorical variables</strong> where no ordinal relationship exists (e.g., “Red”, “Blue”, “Green”).</li></ul><p><strong>Reduces Curse of Dimensionality:<br>By dropping one redundant column per feature, Dummy Encoding helps reduce feature explosion, which in turn mitigates the curse of dimensionality — a situation where high-dimensional data leads to sparse and less meaningful patterns.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*iDkgvFTPRe6raF-mnf2q9w.png" /></figure><ul><li>Alter the row with all zeros to -1.</li><li>This ensures that the resulting binary features represent not only the presence or absence of specific categories but also the contrast between the reference category and the absence of any category.</li></ul><h4>Label Encoding</h4><p>Label Encoding transforms categorical values into <strong>integer labels</strong>, assigning a unique number to each category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*slFBMnczxHCiaHntXLPAIg.png" /></figure><ul><li>Assign each category a unique label.</li><li>Label encoding introduces an inherent ordering between categories, which may not be the case.</li><li>Number of features = 1.</li></ul><p>Data transformation is more than just a technical step — it’s a <strong>critical bridge between raw data and reliable machine learning</strong>. From scaling numerical features to encoding categorical variables, every transformation decision can directly impact your model’s accuracy and performance.</p><p>In this blog, we explored the foundational transformation techniques for <strong>structured data</strong>, covering:</p><ul><li>🔢 <strong>Numerical Data Transformation</strong> — like standardization, normalization, and binning</li><li>🔠 <strong>Categorical Data Transformation</strong> — including label, one-hot, and dummy encoding</li></ul><p>These methods not only help <strong>standardize and simplify</strong> the data but also ensure that machine learning algorithms can interpret it <strong>correctly and efficiently</strong>.</p><blockquote><em>In our </em><strong><em>upcoming blog</em></strong><em>, we’ll dive into </em><strong><em>Text and Image Data Transformation</em></strong><em> — exploring how unstructured data is preprocessed and converted into meaningful features for NLP and Computer Vision models.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74d151dd523e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Distance Metrics in Machine Learning: 7 You Must Know to Build Smarter Models]]></title>
            <link>https://medium.com/@shrutikakkapade21/mastering-distance-metrics-in-machine-learning-7-you-must-know-to-build-smarter-models-315bd790012e?source=rss-32e70e970d3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/315bd790012e</guid>
            <category><![CDATA[distance-matrix]]></category>
            <category><![CDATA[vector]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[aritificial-intelligence]]></category>
            <dc:creator><![CDATA[Shrutika kapade]]></dc:creator>
            <pubDate>Sun, 03 Aug 2025 12:19:35 GMT</pubDate>
            <atom:updated>2025-08-28T07:38:05.489Z</atom:updated>
            <content:encoded><![CDATA[<p>In Machine Learning, measuring <strong>distance or similarity</strong> between data points is at the heart of many algorithms, especially in clustering, classification, and recommendation systems.</p><p>But here’s the twist: not all distances are the same.</p><p>In my earlier blog,</p><p><a href="https://medium.com/@shrutikakkapade21/the-hidden-language-of-machines-a-journey-through-math-vectors-and-distances-46a1a0d6ebe1">The Mathematical Foundations of Machine Learning: A Deep Dive into the Language Behind Algorithms</a></p><p>I unpacked how raw data transforms into vectors and matrices, giving algorithms a common mathematical language. Building on that foundation, this article takes the next step:</p><p>exploring <strong>7 essential distance metrics</strong> you must know, explained in the simplest way with practical examples and use cases. These metrics are the tools that allow machines to compare, measure, and ultimately make smarter decisions.</p><h4>What Are Distance Metrics?</h4><p>A <strong>distance metric</strong> is a method used to <strong>measure the distance</strong> between two data points. The right distance metric enables the model to make more accurate predictions, identify similarities, or categorize data effectively.</p><p>Different types of data — like numbers, text, categories, or sets — require different types of distance metrics.</p><h4>1. Euclidean Distance</h4><ul><li>The Euclidean distance is used to calculate the distance between two points in space. For example, we might want to calculate<br>The distance between these two points is in a two-dimensional space.</li><li>This <strong>metric is based on the </strong><a href="https://www.geeksforgeeks.org/maths/pythagoras-theorem/"><strong>Pythagorean theorem</strong></a> and is widely utilized in various fields such as machine learning, data analysis, computer vision, and more.</li><li>Euclidean distance used for Continuous numerical data (L2 norm).</li><li>It measures the <strong>Shortest straight-line</strong> distance.</li></ul><p><strong>Euclidean Distance Formula:</strong></p><p>Consider two points (x1, y1) and (x2, y2) in a 2-dimensional space; the Euclidean Distance between them is given by using the formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*8CroxLqxTRjGx0SgPWdqOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uQaNFPSsH6gVpKYaaCLPqA.png" /></figure><ul><li><strong>Applications: </strong>K-Means clustering, Image comparison, K-Nearest Neighbors.</li></ul><blockquote>Note: Use Euclidean when you’re working with numerical data and scale isn’t an issue.</blockquote><h4>2. Minkowski Distance</h4><ul><li>Minkowski Distance is a <strong>general formula</strong> used to calculate the distance between two points in an <strong>n-dimensional space</strong>.</li><li>It’s a <strong>flexible distance metric</strong> that includes several popular distances as special cases by changing the value of p.</li><li>Minkowski acts like a <strong>parent formula</strong> for:</li><li><strong>Manhattan Distance</strong> → when p = 1</li><li><strong>Euclidean Distance</strong> → when p = 2</li><li><strong>Chebyshev Distance</strong> → when p → ∞</li></ul><p><strong>Minkowski Distance Formula:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*XvWMqicsFB3v6VjbLY3hRA.png" /></figure><ul><li>Use when you want <strong>control over the distance calculation</strong> based on how you want to weigh larger or smaller differences.</li><li>Ideal when tuning models like <strong>KNN</strong> or <strong>Clustering</strong> where distance impacts performance.</li></ul><h4>3. Manhattan Distance (L1 Norm)</h4><ul><li>Manhattan Distance, also known as <strong>L1 Norm</strong>, <strong>Taxicab Distance</strong>, or <strong>City Block Distance</strong>, is a distance metric that calculates the total absolute difference between the coordinates of two data points.</li><li>It represents the path taken along a grid-like layout, similar to how a taxi would drive through city blocks — moving only horizontally or vertically.</li></ul><p><strong>Manhattan Distance Formula:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*RRDDNlEAUGtLcQwJMPkYXg.png" /></figure><p>where, n- number of variables, <strong><em>xi</em></strong> and <strong><em>yi</em></strong> are the variables of vectors x and y respectively, in the two dimensional vector space. i.e. <strong><em>x = (x1,x2,x3,…)</em></strong> and <strong><em>y = (y1,y2,y3,…)</em></strong>.</p><p>Now the distance <strong><em>d</em></strong> will be calculated as-</p><p><strong><em>(x1 — y1)</em></strong> + <strong><em>(x2 — y2) </em></strong>+ <strong><em>(x3 — y3)</em></strong> + … +<strong><em> (xn — yn)</em></strong>.</p><p>If you try to visualize the distance calculation, it will look something like as below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*GUvkmQ7BY_G62RrlYhEn5w.png" /></figure><p>This formula sums the absolute differences across each corresponding dimension. Unlike Euclidean Distance, which measures the straight-line (shortest) distance, Manhattan Distance follows a right-angled path between coordinates.</p><ul><li><strong>Applications: </strong>K-Nearest Neighbors, Lasso Regression (L1 Regularization).</li></ul><blockquote><strong>Note: </strong>Think of this like walking city blocks — only straight paths, no diagonals.</blockquote><h4>4. Hamming Distance</h4><ul><li><strong>Hamming Distance</strong> is used for comparing <strong>binary vectors</strong> (containing only 0s and 1s) or equal-length strings.</li><li>It measures the <strong>number of positions</strong> at which the corresponding elements <strong>differ</strong> between two vectors.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*8PItnuZkTMGB2sgdNO1k0A.png" /></figure><ul><li>The Hamming Distance between two binary vectors <strong>P1</strong> and <strong>P2</strong> is <strong>3</strong>, because the elements at <strong>positions 2, 4, and 5</strong> differ.</li><li><strong>Applications: </strong>Error detection in data transmission and comparing DNA or text sequences</li></ul><blockquote>Note: Use Hamming Distance when your data is in binary or string format.</blockquote><h4>5. Chebyshev Distance</h4><ul><li>Chebyshev Distance is a metric used to calculate the distance between two points in a space where movement can occur in any direction, including diagonally.</li><li>It is defined as the maximum absolute difference between the corresponding coordinates of two points.</li><li>This distance is especially useful in <strong>grid-based systems</strong> like chessboards or pathfinding in games where diagonal movement is allowed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*gyDZoPbrJIP7L9KsxLgyxA.png" /></figure><p>Suppose you have two points:</p><ul><li>A= (x1,x2,…,xn)(<em>x</em>1​,<em>x</em>2​,…,<em>xn</em>​)</li><li>B= (y1,y2,…,xn)(<em>y</em>1​,<em>y</em>2​,…,<em>xn</em>​)</li></ul><h4>Step 1: Calculate the absolute difference for each coordinate</h4><p>For every dimension, I compute the absolute value of the difference between <em>xi</em>​ and <em>yi</em>​ ​: ∣<em>xi</em>​−<em>yi</em>​∣</p><h4>Step 2: Find the maximum difference</h4><p>Out of all these absolute differences, determine the largest one:​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/151/1*qOmt8w_VHOPigntTEds-NA.png" /></figure><h4>Step 3: Interpret the result</h4><p>The Chebyshev distance is this maximum value. It tells you the minimum number of moves needed if you can move along any axis or diagonally in one step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e5sCYaaL6eBRdk17Qe-wnA.png" /></figure><ul><li><strong>Applications: </strong>Chess (King’s move), Warehouse robotics, 2D grid-based pathfinding.</li></ul><blockquote>Note: Use Chebyshev when you’re only concerned with the biggest difference in any one direction.</blockquote><h4>6. Mahalanobis Distance</h4><ul><li><strong>Mahalanobis Distance</strong> measures the distance between a <strong>point</strong> and a <strong>distribution</strong>, not just another point. Unlike Euclidean distance, it <strong>accounts for the correlation between variables</strong> and the <strong>data’s variance structure</strong>.</li><li>It is best for Data with correlated features or different scales.</li></ul><h4><strong>Example:</strong></h4><p><strong>Let’s add two data points to this plot and calculate how far away these are from the centroid.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*_3HUE5OEDby35chCg9TTQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*PacGLCaxkUgf_SysbDpG7A.png" /></figure><ul><li>we see that the Euclidean distance between the centroid and data point 1 is 2.76, and the Euclidean distance between the centroid and data point 2 is also 2.76.</li><li>Based on the Euclidean distance, we can conclude that the two data points have exactly the same distance to the centroid.</li><li>However, if we put an ellipse around the data, we see that data point 1 is much closer to the ellipse than data point 2. Data point 2 does not seem to be part of the cloud of data points around the centroid.</li></ul><p><strong>general formula for the Mahalanobis distance:</strong></p><ul><li>where x is a vector of the coordinates of the data point.</li><li><strong>μ </strong>is the mean vector, or centroid.</li><li>S to the power of minus one is the inverse of the covariance matrix.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*fAbpZ62hYUcG7dIjjJ7FKA.png" /></figure><ul><li>If we were to calculate the Mahalanobis distance between data point 1 and the centroid, we would get a distance of 2.26, whereas the Mahalanobis Distance between the centroid and data point 2 is 6.45.</li><li>The reason why the distances are so different is because the Mahalanobis distance takes into account the correlation in the data.</li><li><strong>Applications: </strong>Outlier detection, Multivariate classification, Fraud detection.</li></ul><blockquote>Note: Use Mahalanobis when your data features are <strong>not independent or have different units</strong>.</blockquote><h4>7. Jaccard Distance</h4><ul><li><strong>Jaccard Distance</strong> measures how <strong>dissimilar</strong> two sets are. It is commonly used with <strong>binary, categorical, or set-based data</strong>.</li><li>It focuses on the proportion of <strong>non-overlapping elements</strong> to the <strong>total unique elements</strong>.</li><li><strong>Jaccard Distance</strong> = “How different are these two sets?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*s5B7fEJ6gyS0As9D_1Jo2w.png" /><figcaption>Jaccard Distance Formula</figcaption></figure><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CZO_GhNa-c6LmzyJwx3Tug.png" /></figure><ul><li><strong>Applications: </strong>Text similarity, Recommendation systems, Binary classification.</li></ul><blockquote>Note: Use Jaccard when comparing sets or features that represent presence/absence.</blockquote><p>Understanding distance metrics is <strong>crucial</strong> in machine learning, especially when it comes to tasks like clustering, classification, recommendation systems, and anomaly detection. Each metric — whether it’s Euclidean, Manhattan, Mahalanobis, or Jaccard — offers unique insights based on the <strong>nature of your data</strong>.</p><p>Choosing the <strong>right distance metric</strong> can significantly improve your model’s performance and accuracy. So, take the time to explore and experiment with them — because in the world of machine learning, <strong>distance truly matters</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=315bd790012e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Decoding the ML Pipeline: A Practical Framework for Building Smarter Models”]]></title>
            <link>https://medium.com/@shrutikakkapade21/decoding-the-ml-pipeline-a-practical-framework-for-building-smarter-models-25da38de1f88?source=rss-32e70e970d3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/25da38de1f88</guid>
            <category><![CDATA[ai-model]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-pipelines]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Shrutika kapade]]></dc:creator>
            <pubDate>Sat, 26 Jul 2025 12:44:40 GMT</pubDate>
            <atom:updated>2025-08-06T13:37:44.624Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srYwdZa8zN-W16egfmREzA.png" /></figure><p><strong>Ever wondered how a machine learning model comes to life — from a raw, messy dataset to making smart predictions?</strong><br>It’s not magic. It’s a structured process called the <strong>Machine Learning Pipeline</strong> — and it’s the secret behind every high-performing ML solution.</p><p>Whether you’re a student, an aspiring data scientist, or just getting your hands dirty with ML, understanding this pipeline is <strong>the foundation</strong> of building smarter, more reliable models.<br>In this blog, we’ll walk through each critical step — <strong>from loading data to evaluating model performance</strong> — with simple explanations and practical tips, so you can go from <em>confused</em> to <em>confident</em> in your ML journey.</p><h4><strong>Why the ML Pipeline is Important</strong></h4><ul><li><strong>Provides a clear structure</strong> — Keeps the process organized and easy to follow.</li><li><strong>Ensures accurate evaluation</strong> — Separates training and testing to avoid biased results.</li><li><strong>Improves model performance</strong> — Proper preprocessing leads to better predictions.</li><li><strong>Makes work repeatable</strong> — You can reuse the same steps on new data.</li><li><strong>Prevents data leakage</strong> — Keeps test data hidden from the model during training.</li><li><strong>Supports automation</strong> — Helps in scaling and deploying models easily.</li><li><strong>Follows industry standards</strong> — Matches professional workflows like CRISP-DM.</li></ul><h3>Before We Start: Understanding the CRISP-DM Framework</h3><p>Before diving into the machine learning pipeline, it’s essential to understand the <strong>bigger picture</strong> of how real-world data science projects are structured.</p><p>One of the most popular and widely used approaches is the <strong>CRISP-DM</strong> framework — short for <strong>Cross-Industry Standard Process for Data Mining</strong>. It provides a <strong>step-by-step guide</strong> to solving business problems using data, ensuring your work is focused, strategic, and outcome-driven.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-2Ql_jIFT1WAEsH95w1Iw.png" /></figure><h4>Why CRISP-DM Matters</h4><ul><li>Provides <strong>clarity and structure</strong> to the ML workflow</li><li>Keeps the project <strong>aligned with business goals</strong></li><li>Helps <strong>avoid jumping straight into code</strong> without understanding the problem</li><li>Makes your workflow <strong>repeatable and scalable</strong></li></ul><p><strong>Let’s decode the process step by step.</strong></p><h4><strong>Step 1: Load the Data</strong></h4><p>The first step is to bring your data into your Python environment.<br>We usually use <strong>Pandas</strong> to load and explore the data.</p><h4>Step 2: Data Preprocessing</h4><p>It is the essential step of <strong>cleaning and transforming </strong>raw data into a usable format for machine learning models. Models can’t learn from messy or inconsistent data, so preprocessing helps make the data understandable, structured, and meaningful.</p><p><strong>Apply the right transformation based on the data type:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mp899k2bcYSBV55B2eBvcQ.png" /></figure><h4>2.1 Identify Target and Features</h4><ul><li>Separate your dataset into:</li><li><strong>X (input features)</strong> — independent variables</li><li><strong>y (target variable)</strong> — the output to be predicted</li></ul><h4>2.2 <strong>Split into Training and Test Sets</strong></h4><ul><li>Use train_test_split() to divide data into training and testing subsets</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*ir29d7WNP2bL7jVwro36PA.png" /></figure><h4>1. Why Do We Split the Data?</h4><p>Machine learning models need to be trained on data — but if we evaluate the model on the same data it was trained on, we risk <strong>overestimating its performance</strong>.<br> To avoid this, we <strong>split the dataset into two separate parts</strong>:</p><ul><li>One for <strong>training the model</strong></li><li>One for <strong>testing its accuracy</strong> on new, unseen data</li></ul><p>This practice allows us to check if the model has <strong>truly learned patterns</strong> or if it’s simply memorizing the training data — a problem known as <strong>overfitting</strong>.</p><h4>2. What is the Training Set?</h4><p>The <strong>training set</strong> is the portion of the dataset used to <strong>train the machine learning model</strong>.<br>In this stage, the model learns to map the relationship between the input features (X) and the target variable (y). The more diverse and clean the training data, the better the model learns.</p><h4>3. What is the Test Set?</h4><p>The <strong>test set</strong> is a separate subset of the data that the model <strong>has never seen before</strong>. After training is complete, the model is evaluated on this test set to assess its real-world performance.</p><h4>Typical Data Splitting Ratio:</h4><ul><li><strong>80% Training / 20% Testing</strong></li><li>Or <strong>70% / 30%</strong>, depending on dataset size and use case</li></ul><h4><strong>3. Model Building</strong></h4><p><strong>What Does “Model Building” Mean?</strong></p><p>Model building involves selecting a <strong>machine learning algorithm</strong> (like Logistic Regression, Decision Tree, SVM, etc.) and training it on your <strong>training data</strong>. During this phase, the model tries to <strong>find relationships</strong> between input features (X) and the target variable (y).</p><h4>How Does It Work?</h4><h4><strong>1. Algorithm Selection</strong>:</h4><p><strong>Choose a suitable model based on the task:</strong></p><ul><li><strong>Classification</strong> (e.g., Predicting spam emails)</li><li><strong>Regression</strong> (e.g., Predicting house prices)</li></ul><h4><strong>2. Model Training</strong>:</h4><p>Use the fit() function to train the model on your training data.</p><h4><strong>3. Learned Parameters</strong>:</h4><p>During training, the model <strong>adjusts internal parameters</strong> (like weights in linear models) to minimize error and make better predictions.</p><p><strong>Note: Model building is about selecting, training, and preparing the right algorithm that can best understand your data and make intelligent predictions. The success of your ML pipeline largely depends on how well this step is executed.</strong></p><h4>4. Use the trained model to predict on unseen data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*dCy3PhImPakR3sHJ4FBeJA.png" /></figure><ul><li>Use the trained model to predict outcomes on <strong>unseen test data</strong></li></ul><h4>5. Evaluate Model Performance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJ88TGL0gXiw6xJrGdqJ8A.png" /></figure><ul><li><strong>Make Predictions</strong><br> The trained machine learning model is used to predict outputs (labels) for the test or unseen data.</li><li><strong>Compare Predictions with Actual Values</strong><br> These predictions are then compared with the ground truth (actual values from the dataset) to see how accurate or correct the model is.</li><li><strong>Select Evaluation Metric</strong><br> Depending on the type of problem (classification or regression), you select an appropriate evaluation metric:</li><li><strong>Classification</strong>: Accuracy, Precision, Recall, F1 Score, ROC-AUC</li><li><strong>Regression</strong>: MAE, MSE, RMSE, R² Score</li><li><strong>Calculate Performance Measure</strong><br> Finally, you calculate the selected metric to quantify your model’s performance and understand how well it generalizes to new data.</li></ul><p>It’s polished, complete, and leaves the reader with a sense of structure and purpose — perfect for your audience and tone.<br> <em>“Stay tuned for the next blog on Data Preprocessing ”</em>?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25da38de1f88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning Fundamentals: A Clear, Practical Introduction for Modern Learners]]></title>
            <link>https://medium.com/@shrutikakkapade21/machine-learning-fundamentals-a-clear-practical-introduction-for-modern-learners-a758f7cf2f79?source=rss-32e70e970d3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a758f7cf2f79</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science-basics]]></category>
            <category><![CDATA[ml-for-beginners]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Shrutika kapade]]></dc:creator>
            <pubDate>Wed, 23 Jul 2025 19:54:21 GMT</pubDate>
            <atom:updated>2025-07-23T19:54:21.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*qeOaXLZoyX01QJIPSjJ6Yw.jpeg" /></figure><h4><strong>What Is Artificial Intelligence (AI)?</strong></h4><p>Artificial Intelligence, or <strong>AI</strong>, is a broad field of computer science focused on building systems that can perform tasks that typically require human intelligence. These tasks include problem-solving, decision-making, understanding language, recognizing patterns, and learning from experience.</p><h4>Key Characteristics of AI<strong>:</strong></h4><ul><li><strong>Autonomy</strong>: Ability to operate without human input</li><li><strong>Adaptability</strong>: Can improve performance over time</li><li><strong>Perception</strong>: Can interpret input from the world (e.g., images, sound, language)</li><li><strong>Reasoning</strong>: Can draw conclusions or make decisions based on data</li></ul><h4><strong>Subfields of AI:</strong></h4><p>Artificial Intelligence (AI) is a broad domain that aims to build machines capable of simulating human intelligence. Within AI, there are specialized subfields, each focusing on specific aspects of intelligent behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*qUlGOriRCglqS5qbj1_HUQ.png" /></figure><h4>Toward General AI — Mimicking Human Intelligence:</h4><ul><li><strong>Vision:</strong> Face Detection &amp; Recognition, Object Detection, ORC(Optical Character Recognition).</li><li><strong>Speech:</strong> Text to speech, Speech to text, Speaker Identification.</li><li><strong>Natural Language Processing (Language Translator): </strong>Spam Ham Detection, sentiment analysis (ex, rating of houses), Conversation, language Translation.</li><li><strong>Note: A human being can perform all of the above tasks, and human intelligence is often referred to as general natural intelligence.</strong></li><li>Machines can only do specific tasks, and we are trying to make progress towards <strong>GAI(General Artificial Intelligence or GenAI)</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TyKeFnR80LSAZMZk1sVOdg.png" /></figure><h3>What Is Machine Learning?</h3><p>Machine Learning (ML) is a <strong>subset of AI</strong> that enables computers to learn patterns from data and make predictions or decisions without being explicitly programmed.</p><h4><strong>Why Machine Learning?</strong></h4><ul><li>If we want to speak with the machine, then we need to train the machine as well. So, how am I going to train the machine? That is why Machine Learning comes into the picture.</li><li>After the machine has learned, I can use it to make predictions for various problem statements — these may include classification, regression, or even different types of unsupervised learning tasks.</li></ul><h4>How do we make a machine or software intelligent?</h4><p>Just as humans learn to drive a car through training and experience, machines learn by being trained on data using advanced algorithms — the underlying mechanisms that power the model.</p><h4>How Does Machine Learning Work?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tg6r62W2lN4yWkJykb2dbA.png" /></figure><h4>Types of Machine Learning:</h4><h4><strong>1. Supervised Machine Learning</strong></h4><ul><li>Learns from labeled data</li><li>Common tasks: <strong>classification</strong> and <strong>regression</strong></li><li>Example: Email spam detection, housing price prediction</li></ul><h4>2. Unsupervised Machine Learning</h4><ul><li>Learns from unlabeled data</li><li>Common tasks: <strong>clustering</strong>, <strong>dimensionality reduction</strong></li><li>Example: Customer segmentation</li></ul><h4><strong>3. Reinforcement </strong>Machine Learning</h4><ul><li>Learns through interaction with an environment</li><li>Uses rewards and penalties to optimize behavior</li><li>Example: Game-playing agents, robotics</li></ul><h4>Machine Learning Algorithms:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rlNUk2VtwlDk6AcJlkkkWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3d0aQwzG975ryNo2KmbvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6T6SpYaOpaD-x6wcoz2f3w.png" /></figure><p><strong>Supervised learning</strong> is used when labeled data is available to make predictions (e.g., spam detection, price prediction), <strong>unsupervised learning</strong> is used to find patterns or groupings in unlabeled data (e.g., customer segmentation), and <strong>reinforcement learning</strong> is used to train agents that learn by interacting with an environment to maximize rewards (e.g., game-playing bots, robotics).</p><h4><strong>Types of Learning Approaches in Machine Learning</strong></h4><ol><li><strong>Distance-Based Approach</strong></li></ol><ul><li>Groups data based on how similar or close data points are</li><li><em>Example:</em> K-Nearest Neighbors (KNN)</li></ul><p><strong>2. Boundary-Based Approach</strong></p><ul><li>Finds the best boundary to separate different classes</li><li><em>Example:</em> Support Vector Machines (SVM)</li></ul><p><strong>3. Rule-Based Approach</strong></p><ul><li>Learns if-then decision rules from data</li><li><em>Example:</em> Decision Trees</li></ul><p><strong>4. Probability-Based Approach</strong></p><ul><li>Uses statistical probabilities to make predictions</li><li><em>Example:</em> Naive Bayes</li></ul><p><strong>5. Ensemble Methods</strong></p><ul><li>Combines multiple models to improve accuracy and reduce overfitting</li><li><em>Examples:</em> Random Forest, Gradient Boosting</li></ul><p><strong>6. Deep Learning Approach</strong></p><ul><li>Uses multi-layered neural networks to learn complex patterns automatically</li><li><em>Examples:</em> Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs)</li></ul><h4>Evaluation Metrics in Machine Learning</h4><p>Evaluation metrics show how well a machine learning model is performing — whether it’s making accurate predictions, minimizing errors, or handling different classes correctly.</p><h4>For <strong>Regression</strong>:</h4><ul><li><strong>Mean Absolute Error (MAE)</strong>: Average size of errors</li><li><strong>Mean Squared Error (MSE)</strong>: Penalizes larger errors</li><li><strong>Root Mean Squared Error (RMSE)</strong>: Square root of MSE</li><li><strong>R² Score</strong>: Explains variance in the target variable</li></ul><h4>For <strong>Classification</strong>:</h4><ul><li><strong>Accuracy</strong>: Overall % of correct predictions</li><li><strong>Precision</strong>: Proportion of true positives among predicted positives</li><li><strong>Recall</strong>: Proportion of true positives identified from actual positives</li><li><strong>F1 Score</strong>: Harmonic mean of precision and recall</li><li><strong>Confusion Matrix</strong>: Breakdown of true/false positives and negatives</li></ul><p><strong>Note: Choosing the right metric depends on your business goals and model use case.</strong></p><h4>How to Choose the Right Metric?</h4><ol><li><strong>What type of problem am I solving?</strong> (classification or regression)</li><li><strong>What matters most to my use case? </strong>Fewer false alarms (high precision), Catching every true case (high recall), Minimizing error size (low RMSE)</li><li><strong>Do I care about class imbalance? </strong>If yes, accuracy alone is not reliable — use F1 or ROC-AUC.</li></ol><h3>From Expert Systems to Data-Driven Intelligence</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*klUVcy84hgt60rd9oIGDvw.jpeg" /></figure><p>Earlier forms of AI, known as <strong>expert systems</strong>, relied on manually coded rules and logic built by specialists. While effective in narrow applications, these systems struggled to scale or adapt.</p><p>Modern machine learning has replaced static rules with models that <strong>learn from data</strong> — making them more flexible, efficient, and capable of handling real-world complexity.</p><h3><strong>How to Choose the Best Machine Learning Model?</strong></h3><p>Selecting the right machine learning model isn’t just about trying random algorithms. It requires a <strong>structured approach</strong> that involves evaluating performance, preparing the data, and following a reliable process. Here’s how to do it effectively:</p><h4><strong>1. Evaluation Parameters to Compare Models:</strong></h4><p>The first step in choosing the best model is to <strong>measure how well each model performs</strong> using the right evaluation metrics. These metrics will vary depending on your task:</p><ul><li>For <strong>classification problems</strong>: use metrics like Accuracy, Precision, Recall, F1 Score, etc.</li><li>For <strong>regression problems</strong>: use metrics like MAE, MSE, RMSE, or R² Score.</li></ul><p><strong>Note : The best model is the one that consistently performs well on the metrics that matter most to your use case.</strong></p><h4>2. Follow a Model Building Pipeline:</h4><p>A <strong>pipeline</strong> is a standard step-by-step process that helps you build models efficiently and consistently.<br>It ensures you’re not starting from scratch every time and can adapt quickly to different problem statements and datasets.</p><h4>Typical model pipeline steps:</h4><ol><li>Define the problem</li><li>Understand and explore the data</li><li>Preprocess the data</li><li>Train multiple models</li><li>Evaluate each model</li><li>Select the best-performing one</li><li>Fine-tune and optimize</li></ol><p><strong>Note: A pipeline helps you stay organized and scalable — whether you’re working on one dataset or hundreds.</strong></p><h4>3. Prioritize Data Preprocessing:</h4><p>Before feeding any data into the pipeline, it must be <strong>clean, consistent, and properly formatted</strong>.</p><ul><li><strong>Data Cleaning</strong>: Removing missing values, duplicates, outliers</li><li><strong>Data Transformation</strong>: Normalization, encoding categorical values, feature scaling</li><li><strong>Feature Engineering</strong>: Creating new meaningful features from raw data</li></ul><p><strong>Note: Clean data = Better model performance. Garbage in, garbage out.</strong></p><h3>Understanding the Difference: AI vs ML vs DL</h3><h4><strong>Artificial Intelligence (AI)</strong></h4><p>AI is the <strong>broadest concept</strong>. It refers to the development of computer systems that can perform tasks that normally require human intelligence — such as reasoning, problem-solving, decision-making, understanding language, and even creativity. AI includes everything from simple rule-based systems to advanced learning models. In short, <strong>AI is the overall goal</strong>: making machines act smart.</p><h4><strong>Machine Learning (ML)</strong></h4><p>Machine Learning is a <strong>subset of AI</strong>. Instead of relying on manually programmed rules, ML systems learn patterns from data. They improve their performance as they are exposed to more data over time. ML is used in many everyday applications like spam filters, recommendation engines, and fraud detection. While AI is the overall concept, ML is <strong>how we currently achieve AI in most real-world systems</strong>.</p><h4>Deep Learning (DL)</h4><p>Deep Learning is a <strong>subset of Machine Learning</strong>. It uses complex neural networks with many layers — inspired by how the human brain works. DL is especially powerful for processing large amounts of unstructured data like images, text, and speech. It eliminates the need for manual feature extraction because it can <strong>automatically learn patterns and features from raw data</strong>. Applications of DL include facial recognition, voice assistants, autonomous driving, and language models like ChatGPT.</p><h4>In Summary</h4><ul><li><strong>AI</strong> is the big picture — the science of making machines think and act intelligently.</li><li><strong>ML</strong> is a key method within AI — enabling machines to learn from data without being explicitly programmed.</li><li><strong>DL</strong> is a specialized technique within ML — using deep neural networks to handle complex problems with high accuracy.</li></ul><p>AI ⊃ ML ⊃ DL</p><h3><strong>Top 5 Real-World Impacts of AI, ML &amp; DL</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5ScXseDKnlQcCz9z7zQ0w.png" /></figure><h3>Conclusion: Building the Right Foundation</h3><p>Machine learning is not just a technical skill — it’s a mindset rooted in problem-solving, data interpretation, and continuous learning. By understanding these core concepts:</p><ul><li>The difference between AI, ML, and deep learning</li><li>How data and algorithms interact</li><li>What types of learning methods exist</li><li>How model performance is measured</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a758f7cf2f79" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>