awsm-research / PyExplainer

PyExplainer: A Local Rule-Based Model-Agnostic Technique (Explainable AI)
MIT License
29 stars 9 forks source link

return local model #3

Closed oathaha closed 3 years ago

oathaha commented 3 years ago

I think it would be beneficial for user if local model of explain() function is included in returned dictionary.

The current code looks like this

rule_obj = {'synthetic_data': synthetic_instances,
                    'synthetic_predictions': synthetic_predictions,
                    'X_explain': X_explain,
                    'y_explain': y_explain,
                    'indep': self.indep,
                    'dep': self.dep,
                    'top_k_positive_rules': top_k_positive_rules,
                    'top_k_negative_rules': top_k_negative_rules}

but I think it should looks like this

rule_obj = {'synthetic_data': synthetic_instances,
                    'synthetic_predictions': synthetic_predictions,
                    'X_explain': X_explain,
                    'y_explain': y_explain,
                    'indep': self.indep,
                    'dep': self.dep,
                    'local_model': local_rulefit_model,
                    'top_k_positive_rules': top_k_positive_rules,
                    'top_k_negative_rules': top_k_negative_rules}
MichaelFu1998-create commented 3 years ago

Hi, it sounds great, could you provide the potential use case as an example so that I can understand your idea more clearly.

oathaha commented 3 years ago

Here is my idea local_model = rule_obj ['local_model'] # get local model from rule_obj

other code for experiment

In my opinion, some researchers would like to save local model for later use (like for evaluation). So it will be useful for them if they can obtain local model.

MichaelFu1998-create commented 3 years ago

Agree. Will update the code to implement this. Thanks!