A decision tree, while performing recursive binary splitting, selects an independent variable (say $X_j$) and a threshold (say $t$) such that the predictor space is split into regions {$X|X_j < t$} and {$X|X_j >= t$}, and which leads to greatest reduction in cost function.
Now let us suppose that we have a variable with categorical
values in {$X$}. Suppose we have label-encoded it and its values are in the range 0 to 9 (10 categories).
- If DT splits a node with the above algorithm and treat those 10 values are true numeric values, will it not lead to wrong/misinterpreted splits?
- Should it rather perform the split based on
==
and!=
for this variable? But then, how will the algorithm know that it is a categorical feature? - Also, will one-hot encoded values make more sense in this case?