XGBoost: When categorical type is supplied, DMatrix parameter `enable_categorical` must be set to `True`

Viewed 541

I have a dataframe data whose columns are exclusively made by NUMERICAL variable (integers and floats) and a pandas series labels whose elements are strings (either "Exercise" or "Rest) corresponding to the labels of the rows of data. I want to train an XGBoost classifier, but when I use the call:

dtrain = xgb.DMatrix(data, label=labels)

I get the error "When categorical type is supplied, DMatrix parameter enable_categorical must be set to True" and then the error message prints a list of all the column names of data (which, I repeat, contain only numerical variables). To me it seems like the names of the columns are interpreted as categorical variables. How can I fix this? Thanks :)

0 Answers
Related