interpretml / interpret

Fit interpretable models. Explain blackbox machine learning.
https://interpret.ml/docs
MIT License
6.04k stars 715 forks source link

Interactions setting in multi-class datasets #507

Closed chenxiang3luo closed 3 months ago

chenxiang3luo commented 3 months ago

Hi, I was trying to change the interactions paramenter under a muti-class dataset. However, the results were same when I set the interactions=0 and interactions =10. Also, when I used the show(ebm.explain_global()), there were not interated features. I wander know if interaction is not fit to multi-class datasets? or Do I need to do other things to fix it. By the way, I could use it correctly under binary-class datasets.

paulbkoch commented 3 months ago

Hi @chenxiang3luo -- We currently disable pairs for interactions because of the difficulty of visualizing the resulting EBM. If you don't mind losing some of the global interpretability though, it is possible to re-enable this by commenting out this section:

https://github.com/interpretml/interpret/blob/4b5cef62fe2e6b079210b9396d87b06c548a64e0/python/interpret-core/interpret/glassbox/_ebm/_ebm.py#L951-L961

The other option, if you would prefer not to modify the interpret code, is to use the measure_interactions function. Here's a notebook showing how to detect the interactions manually:

https://interpret.ml/docs/python/examples/custom-interactions.html

chenxiang3luo commented 3 months ago

Ok I got it. Thank you very much!