2
$\begingroup$

This question already has an answer here:

I have a machine learning problem where the dependent variable is binomial (Yes/No) and some of the independent variables are categorical (with more than 100 levels). I'm not sure whether dummy coding these categorical variables and then passing them to the machine learning model is a optimal solution.

Is there a way to deal with this problem?

$\endgroup$

marked as duplicate by kjetil b halvorsen, John, Sean Easter, gung - Reinstate Monica, Peter Flom - Reinstate Monica Apr 24 '17 at 19:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1
$\begingroup$

How to deal with the categorical variables with too many levels will depend on data.

If we have HUGE amount of data (say 1 billion data points), a categorical variable that has $100$ different levels may not be a problem. Since it is very likely that we have sufficient "training examples" on each level.

However, the aforementioned example is less likely happen in real data. In most real world data, the data has "80-20" rules, which means few levels will be very often, and most levels will not have sufficient data in. Then you may consider to combine them into "Other" category.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.