dtreeviz logo

dtreeviz

parrt/dtreeviz

Python library for decision tree visualization and model interpretation

GraphCanon updated 2w · GitHub synced 2w

3.2k stars338 forksLast push 7mo Jupyter Notebook MIT

Decision brief

dtreeviz is a Python library for enhancing decision tree and machine-learning model understanding through visualizations.

Good fit when

  • When you need detailed and interactive visualization of decision trees from models trained with libraries like scikit-learn, XGBoost, LightGBM, or TensorFlow Decision Forests.
  • For deepening the interpretability of complex model behaviors, especially in projects involving decision-support systems where model transparency is crucial.

Avoid when

  • In scenarios where the primary focus is on model performance benchmarking as opposed to understanding or explaining existing models.
  • If your project workflow does not involve Python, given dtreeviz's reliance on a specific set of Python ML libraries for its visualizations and interpretative functionalities.

Observed Jul 17, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Slowing (212d since push)
As of 2w
Provenance
Not a fork · Personal account
As of 2w
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

git clone https://github.com/parrt/dtreeviz

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

dtreeviz is a Python library that provides functionalities for visualizing decision trees and interpreting machine-learning models.

Capability facts

Languages
jupyter notebook

Source: github.language · Aug 3, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Aug 3, 2026)

Here's a complete example Python file that displays the following tree in a popup window:
Source link

Tags

README

Quick start

See Installation instructions then take a look at the specific notebooks for the supported ML library you're using:

To interopt with these different libraries, dtreeviz uses an adaptor object, obtained from function dtreeviz.model(), to extract model information necessary for visualization. Given such an adaptor object, all of the dtreeviz functionality is available to you using the same programmer interface. The basic dtreeviz usage recipe is:

  1. Import dtreeviz and your decision tree library
  2. Acquire and load data into memory
  3. Train a classifier or regressor model using your decision tree library
  4. Obtain a dtreeviz adaptor model using
    viz_model = dtreeviz.model(your_trained_model,...)
  5. Call dtreeviz functions, such as
    viz_model.view() or viz_model.explain_prediction_path(sample_x)

Example

Here's a complete example Python file that displays the following tree in a popup window:

from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier

import dtreeviz

iris = load_iris()
X = iris.data
y = iris.target

clf = DecisionTreeClassifier(max_depth=4)
clf.fit(X, y)

viz_model = dtreeviz.model(clf,
                           X_train=X, y_train=y,
                           feature_names=iris.feature_names,
                           target_name='iris',
                           class_names=iris.target_names)

v = viz_model.view()     # render as SVG into internal object 
v.show()                 # pop up window
v.save("/tmp/iris.svg")  # optionally save as svg

In a notebook, you can render inline without calling show(). Just call view():

viz_model.view()       # in notebook, displays inline

Installation

Install anaconda3 on your system, if not already done.

You might verify that you do not have conda-installed graphviz-related packages installed because dtreeviz needs the pip versions; you can remove them from conda space by doing:

conda uninstall python-graphviz
conda uninstall graphviz

To install (Python >=3.6 only), do this (from

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.