One-hot vs Dummy Encoding in Machine Learning

Learn the differences between One-hot and Dummy encoding techniques for machine learning models. πŸ”

One-hot vs Dummy Encoding in Machine Learning
technologyCult
7.4K views β€’ Aug 2, 2019
One-hot vs Dummy Encoding in Machine Learning

About this video

#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 - https://www.youtube.com/watch?v=Z1iPj4hamRg

Link for Label Encoding - https://www.youtube.com/watch?v=hJ2sKPj5Xn4

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
https://www.youtube.com/playlist?list=PLE-8p-CwnFPuOjFcbnXLFvSQaHFK3ymUW

2. Confusion Matrix in Machine Learning, ML, AI
https://www.youtube.com/playlist?list=PLE-8p-CwnFPvXzvsEcgb0IZtNsw_0vUzr

3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz
https://www.youtube.com/playlist?list=PLE-8p-CwnFPsBCsWwz_BvbZZHIVQ6wSZK

4. Cross Validation, Sampling, train test split in Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPsHtol5WXHhq_B3kQPggHH2

5. Drop and Delete Operations in Python Pandas
https://www.youtube.com/playlist?list=PLE-8p-CwnFPtvqVVK7QVFsMvDvp2YgCnR

6. Matrices and Vectors with python
https://www.youtube.com/playlist?list=PLE-8p-CwnFPsndwnZnL7nXW5mIrdRmgdg

7. Detect Outliers in Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPvyCX35yES5D9W7vThiUzwk

8. TimeSeries preprocessing in Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPv10bru3719xzDNIgbO6hXA

9. Handling Missing Values in Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPvOec0LZ40Bt8OQcbLFa236

10. Dummy Encoding Encoding in Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPvu7YriqMZsL9UDbqUUk90x

11. Data Visualisation with Python, Seaborn, Matplotlib
https://www.youtube.com/playlist?list=PLE-8p-CwnFPuYBYsmbfMjROOCzKjCwyMH

12. Feature Scaling in Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPtwpVV3FwzwYZYR5hT3i52G

13. Python 3 basics for Beginner
https://www.youtube.com/playlist?list=PLE-8p-CwnFPu-jseUMtc4i47jQZN4PNbf

14. Statistics with Python
https://www.youtube.com/playlist?list=PLE-8p-CwnFPta0COlxS6E5u14m5ouzbRU

15. Data Preprocessing in Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPuOjFcbnXLFvSQaHFK3ymUW

16. Sklearn Scikit Learn Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPtAGb29r8F7up9ilZUXt3l1

17. Linear Regression, Supervised Machine Learning
https://www.youtube.com/playlist?list=PLE-8p-CwnFPslDi6sfFbFK4KXcVlLwaOM

Tags and Topics

Browse our collection to discover more content in these categories.

Video Information

Views

7.4K

Likes

103

Duration

8:01

Published

Aug 2, 2019

User Reviews

4.5
(1)
Rate:

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.