Skip to content

❗ This is a read-only mirror of the CRAN R package repository. tree.interpreter — Random Forest Prediction Decomposition and Feature Importance Measure. Homepage: https://github.com/nalzok/tree.interpreter Report bugs for this package: https://github.com/nalzok/tree.interpreter/issues

License

Notifications You must be signed in to change notification settings

cran/tree.interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tree.interpreter

Travis build status AppVeyor build status Codecov test coverage

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.

About

❗ This is a read-only mirror of the CRAN R package repository. tree.interpreter — Random Forest Prediction Decomposition and Feature Importance Measure. Homepage: https://github.com/nalzok/tree.interpreter Report bugs for this package: https://github.com/nalzok/tree.interpreter/issues

Resources

License

Stars

Watchers

Forks

Packages

No packages published