This task will involve adding a new DecisionTreeExplainer class of objects, with one algorithm implementation.
DecisionTreeExplainer objects explain by 1) decomposing arbitrary models into decision trees and 2) visualizing the decision rules associated with a prediction.
Tasks For Completion
The DecisionTreeExplainer class should follow the same pattern as the existing GlobalFeatureImportance and LocalFeatureContribution classes. This will include the following tasks:
[x] Create a new dte directory under pyreal/explainers/
[x] Create a new dte/base.py file, which defines the abstract class DecisionTreeExplainerBase(Explainer, ABC). This class should define fit and produce functions, which will include any code common to all DecisionTreeExplainer objects. They may either be abstract (if no such common code exists) or call an abstract helper function. See gfi and lfc for examples.
[x] Create a new dte/decision_tree_explainer.py file that defines a class called DecisionTreeExplainer(DecisionTreeExplainerBase). This class will generate a decision tree explanation with its produce function by offloading computation to an implementation class. The implementation class is chosen by a choose_algorithm function, which currently will always return surrogate_tree
[x] dte/decision_tree_explainer will also have a dte function that allows users to get a DecisionTreeExplainer without creating an object, by internally creating, fitting, and calling produce on a DecisionTreeExplainer
[x] Create a new dte/surrogate_decision_tree.py that defines a SurrogateDecisionTree(DecisionTreeExplainerBase) class. The produce function on this class should return a decision tree model, trained on the outputs of the original model on a training set.
This task description is still in progress
Task Summary
This task will involve adding a new
DecisionTreeExplainer
class of objects, with one algorithm implementation.DecisionTreeExplainer
objects explain by 1) decomposing arbitrary models into decision trees and 2) visualizing the decision rules associated with a prediction.Tasks For Completion
The
DecisionTreeExplainer
class should follow the same pattern as the existingGlobalFeatureImportance
andLocalFeatureContribution
classes. This will include the following tasks:dte
directory underpyreal/explainers/
dte/base.py
file, which defines the abstract classDecisionTreeExplainerBase(Explainer, ABC)
. This class should definefit
andproduce
functions, which will include any code common to allDecisionTreeExplainer
objects. They may either beabstract
(if no such common code exists) or call anabstract
helper function. Seegfi
andlfc
for examples.dte/decision_tree_explainer.py
file that defines a class calledDecisionTreeExplainer(DecisionTreeExplainerBase)
. This class will generate a decision tree explanation with itsproduce
function by offloading computation to an implementation class. The implementation class is chosen by achoose_algorithm
function, which currently will always returnsurrogate_tree
dte/decision_tree_explainer
will also have adte
function that allows users to get aDecisionTreeExplainer
without creating an object, by internally creating, fitting, and calling produce on aDecisionTreeExplainer
dte/surrogate_decision_tree.py
that defines aSurrogateDecisionTree(DecisionTreeExplainerBase)
class. The produce function on this class should return a decision tree model, trained on the outputs of the original model on a training set.