Learn R Programming

⚠️There's a newer version (0.1.3) of this package.Take me there.

tree.interpreter

An R re-implementation of the treeinterpreter package on PyPI. Each prediction can be decomposed as 'prediction = bias + feature_1_contribution + ... + feature_n_contribution'. This decomposition is then used to calculate the Mean Decrease Impurity (MDI) and Mean Decrease Impurity using out-of-bag samples (MDI-oob) feature importance measures based on the work of Li et al. (2019) arXiv:1906.10845.

Installation

To install the CRAN version, run

install.packages('tree.interpreter')

To install the latest development version, run

devtools::install_github('nalzok/tree.interpreter')

macOS users might want to follow the set up instructions by The Coatless Professor to minimize operational headaches and maximize computational performance.

Usage

For example, you can calculate the state-of-the-art MDI-oob feature importance measure for ranger. See vignette('MDI', package='tree.interpreter') for more information.

library(ranger)
library(tree.interpreter)

set.seed(42L)
rfobj <- ranger(mpg ~ ., mtcars, keep.inbag = TRUE)
tidy.RF <- tidyRF(rfobj, mtcars[, -1], mtcars[, 1])
mtcars.MDIoob <- MDIoob(tidy.RF, mtcars[, -1], mtcars[, 1])
mtcars.MDIoob

References

This package companies the paper A Debiased MDI Feature Importance Measure for Random Forests.

Copy Link

Version

Install

install.packages('tree.interpreter')

Monthly Downloads

307

Version

0.1.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Qingyao Sun

Last Published

February 5th, 2020

Functions in tree.interpreter (0.1.1)

trainsetBiasTree

Trainset Bias
MDITree

Mean Decrease in Impurity
featureContribTree

Feature Contribution
MDIoobTree

Debiased Mean Decrease in Impurity
tidyRF

Tidy Random Forest
tree.interpreter

Random Forest Prediction Decomposition and Feature Importance Measure