Let's say I have two categorical features: Movie, Director. I one-hot encode both the Movie and Director features for use in a linear regression model.

The problem is that two or more movies may be directed by the same director. i.e. a particular director's bit may be on for two or more different movies. Would this be a problem? Should I be combining movie and director into one feature?


You could combine these features before using one-hot encoding, and see if the performance is improved. But keep in mind, that it really depends on the problem each time.

Generally, is a good thought to combine these type of features. CatBoost, a very good gradient boosting library, create such combinations and the results are pretty good most of the time. I would give it a go if I were you.

  • $\begingroup$ Thanks, Giannis. But is there an inherent problem to keeping them separate? So aside from potential performance issues, can anything actually go wrong in this scenario? $\endgroup$ – Saul Feb 5 '20 at 12:46
  • $\begingroup$ You are welcome Saul. Well, no there is not inherent problem for keeping them seperate. There are some restrictions of course when the features are highly collinear in linear regression, for more info you can refer here: statisticsbyjim.com/regression/… But if this not the case you are probably ok. $\endgroup$ – Giannis Krilis Feb 5 '20 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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