<?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 Hoai Le on Medium]]></title>
        <description><![CDATA[Stories by Hoai Le on Medium]]></description>
        <link>https://medium.com/@phuong.ls2802?source=rss-11cc840c8950------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aOdYp5StUDvQzIhq</url>
            <title>Stories by Hoai Le on Medium</title>
            <link>https://medium.com/@phuong.ls2802?source=rss-11cc840c8950------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 23:33:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@phuong.ls2802/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[Learning diary, March 12nd 2025]]></title>
            <link>https://medium.com/@phuong.ls2802/learning-diary-march-12nd-2025-0bcc49f3ea58?source=rss-11cc840c8950------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bcc49f3ea58</guid>
            <category><![CDATA[feature-engineering]]></category>
            <dc:creator><![CDATA[Hoai Le]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 05:45:25 GMT</pubDate>
            <atom:updated>2025-03-13T05:45:25.275Z</atom:updated>
            <content:encoded><![CDATA[<p>One-hot encoding: color,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KO5no-P7UMv9ea31wuuGOA.png" /></figure><p>Today, I am gonna learn about the transformation for categorical data.</p><p>From what I just have seen we seem to have three methods for three types of categorical data.</p><ol><li>One hot encoder: for the data that does not have hierarchical orders.</li><li>Label encoder: for the data that have hierarachical meaning. For example: education_level: primary school, secondary school, high school, college.</li><li>Binary encoding:</li></ol><p>There are also two types of encoding to deal with high cardinality, categorical They are:</p><ul><li>Frequency-based encoding: One-Hot Encoding vs. Frequency Encoding</li><li>One-hot encoding represents categorical variables with binary vectors (1 if present, 0 otherwise).</li><li>Frequency-based encoding replaces categorical values with their respective occurrence counts.</li><li>Example:</li><li>Categories: [&quot;apple&quot;, &quot;banana&quot;, &quot;apple&quot;, &quot;orange&quot;, &quot;banana&quot;, &quot;banana&quot;] Frequency Encoding: apple -&gt; 2 banana -&gt; 3 orange -&gt; 1</li><li>Top-K encoding with ‘Other’ category</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bcc49f3ea58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Diary — March 10, 2025]]></title>
            <link>https://medium.com/@phuong.ls2802/learning-diary-march-10-2025-a8efbcf416c9?source=rss-11cc840c8950------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8efbcf416c9</guid>
            <category><![CDATA[feature-engineering]]></category>
            <dc:creator><![CDATA[Hoai Le]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 22:13:31 GMT</pubDate>
            <atom:updated>2025-03-11T22:13:31.751Z</atom:updated>
            <content:encoded><![CDATA[<h3>Learning Diary — March 10, 2025</h3><h3>Feature Engineering: A Deep Dive</h3><h3>Understanding Feature Handling</h3><p>Feature engineering plays a crucial role in building robust machine learning models. Today, I explored various techniques to clean, transform, and optimize features for better predictive performance.</p><p><strong>Key areas covered:</strong></p><ul><li>Handling missing values</li><li>Detecting and addressing outliers</li><li>Feature transformation: scaling and mathematical transformations</li><li>Advanced feature transformations</li><li>Encoding categorical features</li><li>Handling high-cardinality features</li><li>Temporal and aggregate features</li><li>Managing imbalanced datasets</li><li>Feature selection techniques</li></ul><h3>Key Questions to Consider</h3><p>When working with a dataset, here are some fundamental questions to ask:</p><ol><li><strong>How should we handle missing values?</strong></li></ol><ul><li>Should we remove them, or replace them based on specific conditions (e.g., median imputation)?</li><li>What are the best practices for different data types?</li></ul><p><strong>2. What should we do about outliers?</strong></p><ul><li>Should we remove them? If so, how?</li><li>How does the Interquartile Range (IQR) method help detect and handle outliers?</li></ul><p><strong>3. Do we need to scale numerical features?</strong></p><ul><li>Once missing values and outliers are addressed, should features be standardized or normalized?</li></ul><ol><li><strong>How should we handle categorical data?</strong></li></ol><ul><li>What encoding methods should we use? (I recall two primary approaches.)</li></ul><h3>Deep Dive into Feature Handling</h3><h4>1. Handling Missing Values</h4><p>Deciding whether to remove or impute missing values depends on the context:</p><ul><li><strong>Remove missing values</strong> if they occur randomly and in small numbers.</li><li><strong>Impute missing values</strong> when they contain meaningful information. Common methods include:</li><li><strong>Mean/Median/Mode</strong>:</li><li><em>Median</em> is often preferred for skewed data.</li><li><em>Mode</em> works well for categorical variables.</li></ul><h4>2. Handling Outliers</h4><p>Outliers can distort statistical analysis and machine learning models. They can be:</p><ul><li><strong>Removed</strong> if they are errors and do not contribute meaningful insights.</li><li><strong>Capped or transformed</strong> if they hold valuable information but skew the distribution.</li></ul><p>A common technique for detecting outliers is the <strong>Interquartile Range (IQR) method</strong>:</p><ul><li>Calculate IQR = Q3 — Q1</li><li>Define lower and upper bounds:</li><li><em>Lower Bound</em> = Q1–1.5 × IQR</li><li><em>Upper Bound</em> = Q3 + 1.5 × IQR</li><li>Any data points outside this range are considered outliers.</li></ul><h4>3. Scaling Numerical Features</h4><p>After handling missing values and outliers, scaling ensures numerical features are on the same scale, which is crucial for models like k-NN, SVM, and gradient descent-based algorithms.</p><p><strong>Common scaling methods:</strong></p><ul><li><strong>Standardization</strong>: Converts data to a normal distribution with mean = 0 and standard deviation = 1.</li><li><strong>Min-Max Scaling (Normalization)</strong>: Scales values between a fixed range (e.g., 0 to 1).</li></ul><h4>4. Encoding Categorical Data</h4><p>Categorical features must be converted into numerical representations for machine learning models. Two common approaches are:</p><ul><li><strong>One-Hot Encoding</strong>: Creates binary columns for each category (best for nominal data without order).</li><li><strong>Label Encoding</strong>: Assigns numerical labels to categories (best for ordinal data with an inherent order).</li></ul><h3>Final Thoughts</h3><p>Feature engineering is an iterative process that significantly impacts model performance. Understanding how to handle missing values, outliers, scaling, and categorical features lays a strong foundation for building better predictive models.</p><p>What other feature engineering techniques should I explore next? Let’s see🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8efbcf416c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>