csinva / imodels

Interpretable ML package 🔍 for concise, transparent, and accurate predictive modeling (sklearn-compatible).
https://csinva.io/imodels
MIT License
1.35k stars 120 forks source link

Added support for regressors to [extract_sklearn_tree_from_figs]. #148

Closed holoubekm closed 1 year ago

holoubekm commented 1 year ago

I noticed that the function extract_sklearn_tree_from_figs does not support regressor targets - trees with a single class.

There was a bug / typo in the code. And shape of value_sklearns for classifiers is (N, 2), while for regressors it should be (N, 1).

These two things prevented ShadowSKDTree from working properly.

Result: shadow_dtree.is_classifier() now correctly returns False for regressors. And it is possible to plot regressors using ShadowSKDTree.plot()

csinva commented 1 year ago

Thanks for the fix! Greatly appreciated :)