skillfed

dtreeviz

A Python 3 library for sci-kit learn, XGBoost, LightGBM, Spark, and TensorFlow decision tree visualization

dtreeviz v2.3.2 84.2K downloads/30d#14,014 on PyPI3,154
Permissive license MIT AGING released

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 dtreeviz

uv

uv add dtreeviz

poetry

poetry add dtreeviz

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT License

Tags

decision tree visualizationtree model interpretermachine learning model visualizationxgboost tree diagramsrandom forest visualizationgradient boosting tree vizmodel interpretation
model-interpretationvisualizationtree-based-ml

More Artificial Intelligence packages