/dtextract

Instant local interpretations of blackbox machine learning models

Primary LanguagePythonApache License 2.0Apache-2.0

Decision Tree Extraction (DTExtract)

DTExtract is a tool for extracting model explanations in the form of decision trees. More precisely, given

  • blackbox access to a model (i.e., for a given input, produce the corresponding output),
  • a sampling distribution over the input space,

then DTExtract constructs a decision tree approximating that model.

IMPORTANT NOTE

The work on instant local interpretations of blackbox models is under dev-tree-interpreter branch, not in master branch. Please refer there, to see the code and experiments on instant local interpretations of blackbox models. Samples of the work that are available in the experiments section in that branch: Contributions Prediction Decomposition

Table of Contents

  1. Prerequisites
  2. Setting Up DTExtract
  3. Using DTExtract

Prerequisites

DTExtract has been tested using Python 3.7. DTExtract depends on numpy, scipy, scikit-learn, and pandas.

Setting Up DTExtract

Run setup.sh to set up the datasets used in the examples that come with DTExtract.

Using DTExtract

See python/dtextract/examples/iris.py for an example using a dataset from the UCI machine learning repository with the goal of classifying Iris flowers. The dataset is located at data/iris.zip (download link). To run this example, run

$ cd python
$ python -m dtextract.examples.iris

Similarly, see python/dtextract/examples/diabetes.py for an example using a diabetes readmissions dataset. The dataset is located at data/dataset_diabetes.zip (download link). To run this example, run

$ cd python
$ python -m dtextract.examples.diabetes

Finally, see python/dtextract/examples/wine.py for an example using a dataset from the UCI machine learning repository with the goal of classifying wines. The dataset is located at data/wine.zip (download link). To run this example, run

$ cd python
$ python -m dtextract.examples.wine