Difference between One-hot Encoding and Dummy Encoding | One Hot Encoding | Dummy Encoding

Опубликовано: 05 Октябрь 2024
на канале: technologyCult
7,175
104

#dummyencoding #onehotencoding #machinelearning #technologycult
Python for Machine Learning - Session # 96

Topic to be coverred - One-Hot Encoding V/S Dummy Encoding

Table of content
0:00 Introduction
01:00 What is One-hot Encoding and Dummy Encoding
02:56 How to implement One-hot Encoding
03:38 How to implement Dummy Encoding
03:54 drop_first parameter in Dummy Encoding
04:31 How to delete the specfic column
04:54 How to prefix the column
05:28 How to apply Dummy Encoding on more than one column
06:16 How to apply get_dummies on multiple column and have a different prefix based on the column name
06:46 How to to apply get_dummies on multiple column and drop one column from each categorical variable

Link for One-hot Encoding -    • Python for Machine Learning - Part 17...  

Link for Label Encoding -    • Python for Machine Learning | Label E...  

Code Starts Here
============
import pandas as pd

df = pd.read_csv('dataset.csv')
df.drop('Id',axis=1,inplace=True)

1. How to implement one-hot encoding
df_one_hot = pd.get_dummies(df['week_day'])

2. How to implement Dummy Encoding
df_dummy_encoding = pd.get_dummies(df['week_day'],drop_first=True)

3. If you want to delete any specfic column then
df_dummy_encoding_myselection = df_one_hot.drop('Sunday',axis=1)

4. If you want to prefix the column
df_dummy_variable_prefix = pd.get_dummies(df['week_day'], prefix='day_')

5. If we want to apply get_dummies on multiple column
df_dummy_encoding_multiple_column = pd.get_dummies(df[['week_day','gender']])

6. If we want to apply get_dummies on multiple column and have a different prefix based on the column name
df_dummy_diff_prefix = pd.get_dummies(df[['week_day','gender']],prefix=['day_','Gend_'])

7. If we want to apply get_dummies on multiple column and drop one column from each categorical variable
df_drop_firt_multiple_column = pd.get_dummies(df[['week_day','gender']],drop_first=True)


All the playlist of this youtube channel
========================================

1. Data Preprocessing in Machine Learning
   • Data Preprocessing in Machine Learnin...  

2. Confusion Matrix in Machine Learning, ML, AI
   • Confusion Matrix in Machine Learning,...  

3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz
   • Anaconda | Python Installation | Spyd...  

4. Cross Validation, Sampling, train test split in Machine Learning
   • Cross Validation | Sampling | train t...  

5. Drop and Delete Operations in Python Pandas
   • Drop and Delete Operations in Python ...  

6. Matrices and Vectors with python
   • Matrices and Vectors with python  

7. Detect Outliers in Machine Learning
   • Detect Outliers in Machine Learning  

8. TimeSeries preprocessing in Machine Learning
   • TimeSeries preprocessing in Machine L...  

9. Handling Missing Values in Machine Learning
   • Handling Missing Values in Machine Le...  

10. Dummy Encoding Encoding in Machine Learning
   • Label Encoding, One hot Encoding, Dum...  

11. Data Visualisation with Python, Seaborn, Matplotlib
   • Data Visualisation with Python, Matpl...  

12. Feature Scaling in Machine Learning
   • Feature Scaling in Machine Learning  

13. Python 3 basics for Beginner
   • Python | Python 3 Basics | Python for...  

14. Statistics with Python
   • Statistics with Python  

15. Data Preprocessing in Machine Learning
   • Data Preprocessing in Machine Learnin...  

16. Sklearn Scikit Learn Machine Learning
   • Sklearn Scikit Learn Machine Learning  

17. Linear Regression, Supervised Machine Learning
   • Linear Regression | Supervised Machin...