dtreeviz
A Python 3 library for sci-kit learn, XGBoost, LightGBM, Spark, and TensorFlow decision tree visualization
What it is and what it does
dtreeviz is a Python visualization library that transforms decision trees from popular machine learning frameworks into clear, interpretable diagrams. It supports scikit-learn, XGBoost, LightGBM, Spark MLlib, and TensorFlow, making it a bridge between model training and human understanding. The library renders trees as visual graphs that show how features split at each node and how predictions flow through the model, inspired by educational design principles.
The package depends on graphviz for rendering, pandas and numpy for data handling, scikit-learn for tree structure access, matplotlib for graphics, and colour for visual styling. It's primarily used by data scientists and ML engineers who need to explain model behavior to stakeholders, debug model decisions, or learn how tree-based models work internally.
Use it for:
- Visualize a trained decision tree to understand which features matter most at each split.
- Generate publication-quality diagrams of trees for model documentation and reports.
- Debug predictions by inspecting the decision paths individual trees take.
- Teach machine learning concepts by showing how decision trees partition feature space visually.
- Interpret model behavior for regulatory or compliance audits by displaying exact decision logic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
dtreeviz renders decision trees from scikit-learn, XGBoost, LightGBM, Spark MLlib, and TensorFlow as interactive visualizations to help understand and interpret how these models make predictions.
Yes, if you work with tree-based models and need to visualize or interpret them. The library is stable, permissively licensed, and has low install friction. The aging maintenance status (no release in 224 days) is a minor concern if you rely on cutting-edge framework versions, but core functionality remains sound for current releases.
Install
dtreeviz on PyPI
pip
pip install dtreevizuv
uv add dtreevizpoetry
poetry add dtreevizInstalling dtreeviz
Before you install
Low friction install with six common data-science dependencies (graphviz, pandas, numpy, scikit-learn, matplotlib, colour). Maintenance status is aging—last release was 224 days ago—but the repository remains active with 3154 stars.
License in practice
MIT license is permissive; you can use, modify, and distribute dtreeviz with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install dtreeviz
from dtreeviz.trees import dtreeviz
viz = dtreeviz(tree_model, X, y, feature_names=feature_names, class_names=class_names)
Requires graphviz system library to be installed separately on your machine for rendering to work.
Verify before relying
- Whether the aging maintenance status (224 days since last release) affects support for newer versions of supported frameworks.
- Performance characteristics when visualizing very large or deeply nested trees.
- Current compatibility with TensorFlow decision forests given the maintenance timeline.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — graphviz, pandas, numpy, scikit-learn, matplotlib, colour |
| Maintenance | aging — 224 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 84,225/month — #14,014 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dtreeviz-2.3.2-py3-none-any.whl
Keywords: machine-learning, data, structures, trees, visualization
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
py_treespy_trees implements behaviour trees in Python,…
permissive · top 15,000 on PyPI
tensorflow-decision-forestsTrains and deploys decision forest models…
permissive · top 15,000 on PyPI
treeinterpreterDecomposes scikit-learn decision tree and…
permissive · top 15,000 on PyPI
ydfYDF trains, evaluates, and interprets decision…
permissive · top 15,000 on PyPI
xgboostXGBoost is a gradient boosting library that…
permissive · top 1,000 on PyPI
lightgbmLightGBM is a gradient boosting framework for…
unclear · top 1,000 on PyPI
treeliteTreelite serializes and exchanges decision tree…
permissive · top 15,000 on PyPI
skope-rulesSkope-rules learns interpretable logical rules…
permissive · top 15,000 on PyPI
ete3ETE3 reconstructs, manipulates, analyzes, and…
copyleft · top 15,000 on PyPI
treescopeTreescope is an interactive HTML pretty-printer…
permissive · top 5,000 on PyPI