I would like to use cross validation with catboost
. Since I do not just want to use catboost
but also sampling I am using a pipeline and hence cannot use catboost's
own cross validation (which works if I just use catboost
and not a pipeline). So I want to use sklearn's
cross validation, which works fine if I use just numerical variables but as soon as I also include the categorical variables (cat_features
) and use catboost's
encoding, cross_validate
doesn't work anymore. Even if I don't use a pipeline but just catboost
alone I get a KeyError: 0
message with cross_validate
. But I don't understand why.
This is part of my code that doesn't work:
from sklearn.model_selection import cross_validate
model = cb.CatBoostClassifier(**params, cat_features=cat_features)
cv_score = cross_validate(model, X_train, y_train, scoring='roc_auc', cv=5, return_train_score=True)
cat_features
strings/column names, or integers/column indices? $\endgroup$cross_validate
cannot really encode the categorical features while fitting the data. It's probably a problem of sklearn'scross_validate
as everything works perfectly fine when doing the same thing but using model.fit. $\endgroup$