1.

What is the difference between one hot encoding and label encoding? Explain.

Answer»

USING one hot encoding, the dimensionality (i.e. FEATURES) in a dataset get increased because it creates a new variable for each level present in categorical variables. For example: let’s say we have a variable ‘color’. The variable has 3 levels NAMELY Red, Blue, and Green. One hot encoding ‘color’ variable will generate three new variables as Color.Red, Color.Blue and Color.Green containing 0 and 1 value. In label encoding, the levels of categorical variables get ENCODED as 0 and 1, so no new variable is created. Label encoding is majorly used for binary variables.



Discussion

No Comment Found

Related InterviewSolutions