Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

treeinterpreter

> 编程语言
Open source

=============================== TreeInterpreter =============================== Package for interpreting scikit-learn's decision tree and r…

759 stars0 likes0 views
WebsiteGitHub

About

=============================== TreeInterpreter =============================== Package for interpreting scikit-learn's decision tree and r…

=============================== 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/.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言