So I was running a Catboost model using Python, which was pretty simple, basically:
from catboost import CatBoostClassifier, Pool, cv
catboost_model = CatBoostClassifier(
cat_features=["categorical_variable_1", "categorical_variable_2"],
loss_function="Logloss",
eval_metric="AUC",
iterations=200,
)
So I wanted to get the feature importance. With XGBoost Classifier, I could prepare a dataframe with the feature importance doing something like:
importances = xgb_model.get_fscore()
feat_list = []
date = datetime.today()
for feature, importance in importances.items():
dummy_list.append([date, feature, importance])
feat_df = pd.DataFrame(feat_list, columns=['date', 'feature', 'importance'])
Now, I wanted to do the same thing with CatBoost features. I started by doing:
catboost_model.get_feature_importance(
Pool(X_train, y_train, cat_features=["categorical_variable_1", "categorical_variable_2"]))
But I don't know how to move on from this (which should be very simple, but I'm lost). Can anyone give me a hand?