Feature importances

CatBoost provides different types of feature importance calculation:

Feature importance calculation type Implementations
The most important features in the formula - PredictionValuesChange
- LossFunctionChange
- InternalFeatureImportance
The contribution of each feature to the formula ShapValues
The features that work well together - Interaction
- InternalInteraction

Choose the implementation for more details.

Python package

Use one of the following methods:

  • Use the feature_importances_ attribute.

  • Use one of the following methods to calculate the feature importances after model training:

Class Description
CatBoost get_feature_importance
CatBoostClassifier get_feature_importance
CatBoostRegressor get_feature_importance

These methods calculate and return the feature importances.

R package

Use one of the following methods:

  • Use the feature_importancesattribute to get the feature importances.

  • Use one of the following methods to calculate the feature importances after model training:

Method Description
catboost.get_feature_importance Calculate the feature importances (Feature importance and Feature interaction strength).

Command-line version

Use the following command to calculate the feature importances during model training:

Command Command keys Key description
catboost fit --fstr-file The name of the resulting file that contains regular feature importance data (see Feature importance).
Set the required file name for further feature importance analysis.
--fstr-internal-file The name of the resulting file that contains internal feature importance data (see Feature importance).
Set the required file name for further internal feature importance analysis.

Use the following command to calculate the feature importances after model training:

Command Purpose
catboost fstr Calculate feature importances.

Model analysis