sato9hara / defragTrees

Python code for tree ensemble interpretation
MIT License
83 stars 22 forks source link

defragTrees

Python code for tree ensemble interpretation proposed in the following paper.

Requirements

To use defragTrees:

To run example codes in example directory:

To replicate paper results in paper directory:

Usage

Prepare data:

Import the class:

from defragTrees import DefragModel

Fit the simplified model:

Kmax = 10 # uppder-bound number of rules to be fitted
mdl = DefragModel(modeltype='regression') # change to 'classification' if necessary.
mdl.fit(X, y, splitter, Kmax)
#mdl.fit(X, y, splitter, Kmax, fittype='EM') # use this when one wants exactly Kmax rules to be fitted

Check the learned rules:

print(mdl)

For further deitals, see defragTrees.py. In IPython, one can check:

import defragTrees
defragTrees?

Examples

Simple Examples

See example directory.

Replicating Paper Results

See paper directory.