We use one hot encoding with nominal variables so that we don't impose any order relationship. If we have a categorical variable that has three categories: Red, Blue, Green. The one hot encoding of this variable will be : Blue --> [1,0,0], Green --> [0,1,0] and Red --> [0,0,1]. Now, if we convert these binary numbers back to decimal numbers, we will have: Blue --> 4, Green --> 2 and Red --> 1, which has natural ordering relationship , so how one hot encoding doesn't introduce natural ordering relationship ?
1 Answer
$\begingroup$
$\endgroup$
You're confusing binary encoding with one hot encoding (OHE): there's no reason to interpret the array of 3 binary variables [0,1,0] as a single binary number. The 3 values are interpreted by any ML model as 3 different features.
For example if we call these 3 distinct features A, B, C you could see a condition B==1 in the node of a decision tree, leading to two nodes corresponding only to true (b=1) and false (B=0).