TreeInterpreter
Package for interpreting scikit-learn’s decision tree and random forest predictions. Allows decomposing each prediction into bias and feature contribution components as described in http://blog.datadive.net/interpreting-random-forests/. For a dataset with n features, each prediction on the dataset is decomposed as prediction = bias + feature_1_contribution + ... + feature_n_contribution.
It works on scikit-learn’s
DecisionTreeRegressor
DecisionTreeClassifier
ExtraTreeRegressor
ExtraTreeClassifier
RandomForestRegressor
RandomForestClassifier
ExtraTreesRegressor
ExtraTreesClassifier
Free software: BSD license
Dependencies
scikit-learn 0.17+
Installation
The easiest way to install the package is via pip:
$ pip install treeinterpreter
Usage
from treeinterpreter import treeinterpreter as ti # fit a scikit-learn's regressor model rf = RandomForestRegressor() rf.fit(trainX, trainY) prediction, bias, contributions = ti.predict(rf, testX)
Prediction is the sum of bias and feature contributions:
assert(numpy.allclose(prediction, bias + np.sum(contributions, axis=1))) assert(numpy.allclose(rf.predict(testX), bias + np.sum(contributions, axis=1)))
More usage examples at http://blog.datadive.net/random-forest-interpretation-with-scikit-learn/.
History
0.1.0 (2015-07-22)
First release on PyPI.
Metadata
Release files for treeinterpreter 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| treeinterpreter-0.2.3.tar.gz | 6.2 kB | Without provenance | Details for treeinterpreter-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| treeinterpreter-0.2.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for treeinterpreter-0.2.3-py2.py3-none-any.whl |
Total release size: 12.2 kB
Release files / treeinterpreter-0.2.3.tar.gz
| Download URL | treeinterpreter-0.2.3.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da5c24f802f7d072bc457b6e4b289d5ee41961ce33437e8dc439a2cfd9c6d994
|
|
BLAKE2b-256 checksum How to use checksums |
0c42de8d55dd4567699e55fc1901aaf05eab2bb00138374ad045ba7f53ed4596
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|
Release files / treeinterpreter-0.2.3-py2.py3-none-any.whl
| Download URL | treeinterpreter-0.2.3-py2.py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
48660bbddd4577e28655abf0ffb77eb8b8e57d771e32503be56737103aa457a4
|
|
BLAKE2b-256 checksum How to use checksums |
af19fa8556093f6b8c7374825118e05cf5a99c71262392382c3642ab1fd8a742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|
Security for treeinterpreter 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.