Posts

Showing posts from September, 2023

Demystifying Data Encoding: A Guide to Label Encoding and One-Hot Encoding

Image
What is Data Encoding ? Encoding means translating data into a format that computers can use.  There are two main types: 1. Label Encoding: Imagine you have a list of sizes: Small, Medium, Large. Label Encoding gives them numbers: 0, 1, 2. It's like creating a list where each item has a number assigned. 2. One-Hot Encoding: Now, think of colors: Red, Green, Blue. One-Hot Encoding makes boxes: Red, Green, Blue. If something is Red, the Red box gets a checkmark (1); the others get Xs (0s). It's like creating checkboxes for each option.   Both are used to convert categorical data into a numerical format that machine learning algorithms can understand Here I try to explain in briefly.  1. Label Encoding: Description : Label Encoding assigns a unique integer (label) to each category or class within a categorical feature. It converts categorical data into ordinal data, which implies an order among the categories. Label Encoding is suitable for ordinal categorical variables whe...