This paper implements the menthod described in paper Global Model Interpretation via Recursive Partitioning. The implementation is based on the project Python-Regression-Tree-Forest. Please cite both works properly if you are using them in your work.
You should prepare the input data as the example dm_txt.csv
and df_txt.csv
in this repo.
dm_txt.csv
contains the classification labels. Column pid_visit
is the ID of each prediction instance. Column lbl_visit
is the label of each prediction instance.
df_txt.csv
contains the local contributions of input variables for each prediction instance. Column ctb_contrb
is the local contributions. Column pid_contrb
is the ID of each prediction instance. Column var
is the names of input variables. The example contributions are generated by a random forest classifier from a small subset of the 20 Newsgroups Dataset.
git clone git@github.com:west-gates/GIRP.git
cd GIRP
virtualenv venv --python=python2.7
source venv/bin/activate
pip install -r requirements.txt
python run.py
The steps above will generate an interpretation tree selected_tree.jpg
. The example ran for a few minutes on a late 2013 Macbook Pro 13 to get the result. It could be substanitally longer on larger dataset.