2
$\begingroup$

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?

$\endgroup$

1 Answer 1

1
$\begingroup$

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.

$\endgroup$
2
  • $\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, 2020 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$ Feb 5, 2020 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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