predict-idlab / powershap

A power-full Shapley feature selection method.
Other
193 stars 18 forks source link

Support for categorical columns #25

Closed saikiran1201 closed 1 year ago

saikiran1201 commented 1 year ago

By default CatBoost accepts categorical columns. Can we expect support for powershap as well.

JarneVerhaeghe commented 1 year ago

Hi @saikiran1201,

Sorry for the late reply! Powershap supports this already. However, while using Powershap the code deletes the feature names for compatibility, and therefore it will not work to specify the feature names in the _catfeatures argument of CatBoost. A workaround is to use the column index of the categorical column. So suppose your categorical features have column index 4 and column index 6 in your pandas columns, then you can just specify it as follows and it will work:

selector = PowerShap( model = CatBoostClassifier(cat_features=[4,6]), )

I hope this answers your question.