SauceCat / PDPbox

python partial dependence plot toolbox
http://pdpbox.readthedocs.io/en/latest/
MIT License
840 stars 129 forks source link

adds support for categorical features #72

Open oegedijk opened 3 years ago

oegedijk commented 3 years ago

A few simple changes to allow categorical features (such as for example CatBoost uses, but also xgboost and some sklearn models). The catboost_demo.ipynb notebook shows a demonstration. (Can be deleted)

Usespandas.api.types.is_numeric_dtype to detect non-numeric columns, labels the feature_type as 'categorical' in which case the grid values are given by feature_grids = _dataset[feature].unique().tolist().

If the model is able to handle categorical columns, then it will simply give the right prediction, so the rest of the library works as expected.