skillfed

treeinterpreter

Package for interpreting scikit-learn's decision tree and random forest predictions.

treeinterpreter v0.2.3 103.5K downloads/30d#12,801 on PyPI759
Permissive license BSD Abandoned released

What it is and what it does

TreeInterpreter is a small library that breaks down predictions from tree-based models into interpretable components. For each prediction, it computes a bias term and a contribution value for each input feature, so you can see exactly how much each feature pushed the prediction up or down. This is useful when you need to explain individual predictions or debug why a model made a particular decision.

The package has no runtime dependencies and installs as a pure Python wheel. It is no longer maintained, with the last release in 2021-01-10 and no activity since 2023-07-18, so it may not work with newer versions without modification.

Use it for:

  • Explain individual tree predictions to stakeholders by showing feature contributions.
  • Debug model behavior by decomposing predictions and identifying which features dominate decisions.
  • Audit model fairness by examining whether sensitive features have outsized contributions.
  • Validate model logic by checking that prediction = bias + sum(contributions) holds across data.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Decomposes scikit-learn decision tree and random forest predictions into bias and per-feature contribution components, enabling interpretation of how each feature drives individual predictions.

Yes, if you are working with tree models and need local prediction explanations on a stable codebase. The package is simple, dependency-free, and has no known vulnerabilities. However, do not use it if you depend on active maintenance or need compatibility with very recent versions—test thoroughly before deploying to production, as the project is abandoned.

Install

treeinterpreter on PyPI

pip

pip install treeinterpreter

uv

uv add treeinterpreter

poetry

poetry add treeinterpreter

Installing treeinterpreter

Before you install

Low friction installation with no runtime dependencies. However, the package is abandoned—last release was 2021-01-10 and last commit 2023-07-18—so expect no bug fixes or updates.

License in practice

BSD license is permissive, allowing commercial and private use with minimal restrictions; you may use and modify the code freely as long as you retain the license notice.

Quickstart

pip install treeinterpreter

from treeinterpreter import treeinterpreter as ti

rf = RandomForestRegressor()
rf.fit(trainX, trainY)
prediction, bias, contributions = ti.predict(rf, testX)

Requires scikit-learn 0.17 or later; no Python version constraint is documented.

Verify before relying

  • Whether the package remains compatible with scikit-learn 0.17+ across current versions.
  • Python version support beyond the unspecified classifier.
  • Whether the package works with the eight tree model types listed in the description.

Package facts

License BSD (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,042 days since the last release
Last repo commit
First released
Downloads 103,532/month — #12,801 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: treeinterpreter-0.2.3-py2.py3-none-any.whl

Keywords: treeinterpreter

License :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: Python

Tags

scikit-learn model interpretationdecision tree prediction decompositionrandom forest feature contributionexplain tree predictionsmodel prediction attribution
model-interpretability

More Artificial Intelligence packages