Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andosa/treeinterpreter
https://github.com/andosa/treeinterpreter
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/andosa/treeinterpreter
- Owner: andosa
- License: bsd-3-clause
- Created: 2015-08-02T20:26:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T10:50:27.000Z (over 1 year ago)
- Last Synced: 2024-11-07T10:18:57.915Z (3 months ago)
- Language: Python
- Size: 27.3 KB
- Stars: 745
- Watchers: 25
- Forks: 140
- Open Issues: 26
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- License: LICENSE
Awesome Lists containing this project
- awesome-production-machine-learning - 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/. (Explaining Black Box Models and Datasets)
- Awesome-AIML-Data-Ops - 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/. (Explaining Black Box Models and Datasets)
- awesome-production-machine-learning - 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 [here](http://blog.datadive.net/interpreting-random-forests). (Explainability and Fairness)
- Awesome-explainable-AI - https://github.com/andosa/treeinterpreter - learn, ![](https://img.shields.io/github/stars/andosa/treeinterpreter?style=social) (Python Libraries(sort in alphabeta order) / Evaluation methods)
- awesome-python-machine-learning-resources - GitHub - 82% open · ⏱️ 28.02.2021): (模型的可解释性)
README
===============================
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
* ExtraTreesClassifierFree 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/.