I have a data set with all categorical predictors. They are 14 in number. If I do one-hot encoding, I would be getting more than 35 new features, which I think is not right due to the curse of dimensionality. The samples are just about 8k. Please, can someone tell me how to go about encoding these features? Thank you in advance.

  • $\begingroup$ It should be fine, you can use OHE, you probably should try tree-based models (if you are solving a supervised setting). $\endgroup$ Commented Nov 25, 2022 at 21:41
  • $\begingroup$ ok. thank you for helping me to allay my fears. I was thinking with more features I would get a poor result. $\endgroup$
    – emekadavid
    Commented Nov 26, 2022 at 6:08
  • $\begingroup$ You never safe from that:) But I would not say that encoding itself is likely to be the root of the problem. OHE is a solid option, you could also try to use numerical encoding (e.g., red, blue, black,... -> 1,2,3...), xgboost recently introduced autoomatic handling xgboost.readthedocs.io/en/stable/tutorials/categorical.html $\endgroup$ Commented Nov 26, 2022 at 23:21


Your Answer

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

Browse other questions tagged or ask your own question.