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

how to visualize rules for *Rule*-methods where there is no method ".vizualize()" #119

Open avraam-inside opened 2 years ago

avraam-inside commented 2 years ago

Hi!

There are methods such as: SkopeRulesClassifier BoostedRulesClassifier BayesianRuleSetClassifier OptimalRuleListClassifier BayesianRuleListClassifier GreedyRuleListClassifier FIGS Classifier FIGSRegressor etc

Which sort of return a list of rules, but which don't have a convenient method."vizualize()" as for RuleFitClassifier, RuleFitRegressor.

How can I get a list of rules received as a Data Frame for them?

I was trying to get a clear output set through running this example:

https://csinva.io/imodels/rule_set/skope_rules.html

and on your own dataset: 1) Dataset: data.csv 2) Code: scope_rules_1_myself.txt (please, change .txt ext to .ipynb)

Unfortunately, the result is a bit unreadable: image

csinva commented 2 years ago

Hello 👋, thanks for your interest in this package!

Thanks for this comment, will work on getting a clear and consistent visualization for the models some time this week!

csinva commented 2 years ago

I've started adding support for different models simply in the __str__ function. So if you have a model m (e.g. m=FIGSClassifier), you can call str(m) or print(m) to visualize it.

csinva commented 2 years ago

The demo notebook now shows examples of how to visualize most of the models.