<?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 Syed Ammar on Medium]]></title>
        <description><![CDATA[Stories by Syed Ammar on Medium]]></description>
        <link>https://medium.com/@Syed_Ammar?source=rss-e320b0ec11fd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uX5fxHyIHSEjvI2n31AabA.jpeg</url>
            <title>Stories by Syed Ammar on Medium</title>
            <link>https://medium.com/@Syed_Ammar?source=rss-e320b0ec11fd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 02:01:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Syed_Ammar/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[Mixed Variable Handling:]]></title>
            <link>https://medium.com/@Syed_Ammar/handle-different-types-of-data-for-encoding-84ca8b0e0f74?source=rss-e320b0ec11fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/84ca8b0e0f74</guid>
            <dc:creator><![CDATA[Syed Ammar]]></dc:creator>
            <pubDate>Thu, 23 Feb 2023 01:04:08 GMT</pubDate>
            <atom:updated>2023-03-09T05:08:46.334Z</atom:updated>
            <content:encoded><![CDATA[<p>We all know that Machine learning cannot understand string type of data, it only understands numerical type of data.so in order to make it under stand the string type of data we need to convert it into numerical type of data.</p><p>Note: This article doesn’t focus on encoding of singular variable typed of data, rather its main focus is on <strong>mixed variable</strong> typed data. but before getting into multi variable typed data we will understand the types of data that is used in our day-to-day life for encoding and also understand encoding.</p><p>What is mixed variable typed data?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*MKbi8swZIOWI5-1eub6Blg.png" /></figure><p>Hold on let us first understand singular variable typed of data first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*rUQ-y_mQQ8kMb16Vzv9VoA.png" /></figure><p><strong>Encoding:</strong></p><p>In machine learning, encoding refers to the process of converting categorical or textual data into a numerical format that can be used by machine learning algorithms for analysis and modelling. This is necessary because most machine learning algorithms can only work with numerical data. Also said Encoding is a part of Feature Engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*73hMRfofEh5dMMptxL5d2w.png" /></figure><p><strong>Categorical Encoding:</strong></p><p>1. Categorical data refers to data that consists of a limited number of categories or levels, such as colors, gender, and country names.it may further be categorized as Nominal and Ordinal.</p><p>1.1 Nominal data: Nominal data refers to data that does not have any inherent order or ranking. Examples of nominal data include colours, gender, and country names. To encode nominal data, we can use a technique called one-hot encoding. In one-hot encoding, we create a binary vector for each category in the nominal variable, where each vector has a 1 in the position corresponding to the category and 0s in all other positions.</p><p>1.2 Ordinal data: Ordinal data refers to categorical data where the categories have a natural ordering or ranking. Examples of ordinal data include ratings, education levels, and income brackets. To encode ordinal data, we can use a technique called ordinal encoding. In ordinal encoding, we assign a unique numerical value to each category in the ordinal variable based on their order.</p><p>2. Numerical data: Numerical data refers to continuous or discrete numeric values. Examples of numerical data include age, height, and temperature. To encode numerical data, we can use a technique called normalization. In normalization, we rescale the values of the numerical variable to a common scale to avoid differences in magnitude affecting the results of the analysis. We can use methods such as Min-Max scaling, Z-score scaling, or Decimal scaling for normalization.</p><p>3. Text data: Text data refers to textual information such as documents, sentences, and paragraphs. To encode text data, we can use techniques such as bag-of-words, TF-IDF (term frequency-inverse document frequency), and word embeddings. Bag-of-words is a simple technique that counts the frequency of words in the text, while TF-IDF assigns weights to words based on their frequency and importance. Word embeddings use neural networks to represent words as high-dimensional vectors.</p><p>4. Date and time data: Date and time data refer to information about dates, times, and durations. To encode date and time data, we can use techniques such as date-partitioning, timestamp encoding, and duration encoding. Date-partitioning splits the date and time information into separate variables such as year, month, day, and time. Timestamp encoding assigns a unique numerical value to each point in time, while duration encoding encodes the duration between two points in time as a numerical value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*XYL1Lsp3efUmptkd8JbPCg.png" /></figure><p>Answering to your question mixed variable is a type of variable which is combined with a string or a numerical with comma separated</p><p>Let us consider an example to understand more in depth:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*DobhdsiHcOmrfWcv34mTbA.png" /><figcaption>Dataset</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*dpBWbRy_nuBvSunH3zBqXw.png" /><figcaption>Value Count for Mixed variable</figcaption></figure><p>we can see that café is mixed with wide space, ‘casual Dining’ and ‘Quick Bites’ hence it becomes very difficult to convert it into numerical as per the category type. The best way to separate he variables by making the separated variables as a new column and then encoding it.Let us create a script that will separate out the variable and create dummies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*nnSoSNSoFb9-MIF_ciJM_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*lzLkfJFd3n4AjFGioSYNAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*fx1aSBnyrVPuQsQ32o7ODQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*fZ2YZuiFvUkLMVqGTb6CRg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*B7frj0mqCsEH_YKDgJlssA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*MRcNo4QnowSq1DSs-PpAxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*62b5hhS3RZ9DmH0vBj3D0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*FWS3OPQC_E_xsIcbd8X0ww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*v7dcGiAaY_mRe9ZqdweC0g.png" /></figure><p>References:</p><ol><li>Feature Encoding Techniques — Machine Learning</li></ol><p><a href="https://www.geeksforgeeks.org/feature-encoding-techniques-machine-learning/">Feature Encoding Techniques - Machine Learning - GeeksforGeeks</a></p><p>2.All about Categorical Variable Encoding</p><p><a href="https://towardsdatascience.com/all-about-categorical-variable-encoding-305f3361fd02">All about Categorical Variable Encoding</a></p><p>3.Data Science in 5 Minutes: What is One Hot Encoding?</p><p><a href="https://www.educative.io/blog/one-hot-encoding">https://www.educative.io/blog/one-hot-encoding</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84ca8b0e0f74" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>