One Hot Encoding

Sir one help- If in one data column we have 121 unique categorical entries. So can we apply one hot encoding on it. Is it the right logic.

You should see the top categories and select those top categories for one hot encoding

For categorical variables where no such ordinal relationship exists, the label encoding is not enough.

In fact, using label encoding and allowing the model to assume a natural ordering between categories may result in poor performance or unexpected results .

In this case, a one-hot encoding can be applied to the integer representation. This is where the label encoded variable is removed and a new binary variable is added for each unique integer value.

In the “colour” variable example, there are 3 categories(red, green , blue) and therefore 3 binary variables are needed. A “1” value is placed in the binary variable for the colour and “0” values for the other colours.

For example:

red , green , blue

1, 0, 0

0, 1, 0

0, 0, 1