I am working on a binary classification task where one of the input variables takes values in {A, B, C}. A lot of classifiers only take numerical attributes as inputs so I was wondering what the best way to do this is. If I just map them to integers like A:1, B:2, C:3, I am worried that this would mean that A is more similar to B and less similar to C (because |1-2|=1 and |1-3|=2) but that is not necessarily true. So won't this method introduce some sort of bias?
1 Answer
$\begingroup$
$\endgroup$
The use of dummy coding (aka indicator variables) is probably your best bet. As you've mentioned, converting categorical variables to numerical ones not only assumes they have a clear ordering 1 (A) < 2 (B) < 3 (C), but also for many tasks that the "change" between A and B and B and C are equal, and half that of the change between A and C.