I am excited to learn that CatBoost can handle categorical features by itself. One of my features, Department ID, is categorical. However, it looks like numeric, since the values are like 1001, 1002, ..., 1218. Those numbers are just IDs of the departments. It by no means has numeric or ordinal meanings. How do I tell CatBoost to treat it as categorical (nominal), not numeric?



1 Answer 1


When you are training your Catboost classifier, you can pass the list of cat features like this in python :

CatboostClassifier has a parameter called Cat_Features which takes list of names and treat them as categorical variables

from catboost import CatBoostClassifier

clf = CatBoostClassifier(

clf.fit(X_train, y_train, 
        cat_features=['Name of your categorical variables'], ## This 
        eval_set=(X_val, y_val), 
  • $\begingroup$ Will it extract from Pandas dtypes automatically like LightGBM? $\endgroup$
    – Royi
    Commented Mar 25 at 9:50
  • $\begingroup$ should name be comma-seporated, or it should be an array of strings? $\endgroup$ Commented Jun 5 at 11:18

Your Answer

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

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