ML icon indicating copy to clipboard operation
ML copied to clipboard

xgboost with categorical variables?

Open saksham219 opened this issue 6 years ago • 2 comments

Variables such as month, Weekday, Hour are all categorical variables. Why haven't you one-hot-encoded them before feeding into the xgboost classifier?

saksham219 avatar Mar 12 '18 12:03 saksham219

Label encoding also works fine for tree based models similar to one hot encoding.

SudalaiRajkumar avatar Mar 12 '18 13:03 SudalaiRajkumar

Thank you so much for replying. I understand what you are saying. I just have a doubt that in the code where you are building the xgboost model you did not label encode, or one-hot-encode them before feeding them into the model. So a month like January has value 0 and December has value 12 which does not make any sense because month is not a quantity.

saksham219 avatar Mar 14 '18 15:03 saksham219