I have two features in my dataset I'm using to help predict a binary outcome. Based on my features, I'm trying to figure out which I need to drop a dummy to avoid the dummy trap.
First feature is a string of "tags". There are 239 unique tags, which are seen in the dataset as comma separated sets of 1 to 9 tags.
- What I did here was split them by the delimiter into a vector of 1s or 0s using MultiLabelBinarizer(). So these will be represented as a vector of length 239 of 1s and 0s.
Second feature is country codes, eg. (US, MX, FR, etc.). There are 26 unique country codes.
- These are represented as a single country for each row of the dataset. I plan on one hot encoding these as well to 0s or 1s.
I'm fairly sure I don't need to drop anything for the first feature. It's so sparse, that I can't imagine it requiring that.
Where I'm stuck though is about the country code, I can't understand if I need to drop one column or if I can just keep them all.
If I don't drop, in the end I will have 26 + 239 columns of ones and zeros, mostly zeros. If I do drop one, I will have 25 + 239 of ones and zeros.