{"data":{"slug":"parrt-dtreeviz","name":"dtreeviz","tagline":"Python library for decision tree visualization and model interpretation","github_url":"https://github.com/parrt/dtreeviz","owner":"parrt","repo":"dtreeviz","owner_avatar_url":"https://avatars.githubusercontent.com/u/178777?v=4","primary_language":"Jupyter Notebook","stars":3157,"forks":337,"topics":["data-science","decision-trees","machine-learning","model-interpretation","python","random-forest","scikit-learn","visualization","xgboost"],"archived":false,"github_pushed_at":"2026-01-02T18:39:55+00:00","maintenance_label":"Slowing","stars_delta_30d":2,"url":"https://www.graphcanon.com/tools/parrt-dtreeviz","markdown_url":"https://www.graphcanon.com/tools/parrt-dtreeviz.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/parrt-dtreeviz","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=parrt-dtreeviz","description":"A python library for decision tree visualization and model interpretation.","homepage_url":null,"license":"MIT","open_issues":75,"watchers":44,"ai_summary":"dtreeviz is a Python library that provides functionalities for visualizing decision trees and interpreting machine-learning models.","readme_excerpt":"## Quick start\n\nSee [Installation instructions](README.md#Installation) then take a look at the specific [notebooks](https://github.com/parrt/dtreeviz/tree/master/notebooks) for the supported ML library you're using:\n\n* [sklearn-based examples](notebooks/dtreeviz_sklearn_visualisations.ipynb) ([colab](https://colab.research.google.com/github/parrt/dtreeviz/blob/master/notebooks/dtreeviz_sklearn_visualisations.ipynb))\n* [LightGBM-based examples](notebooks/dtreeviz_lightgbm_visualisations.ipynb) ([colab](https://colab.research.google.com/github/parrt/dtreeviz/blob/master/notebooks/dtreeviz_lightgbm_visualisations.ipynb))\n* [Spark-based examples](notebooks/dtreeviz_spark_visualisations.ipynb) ([colab](https://colab.research.google.com/github/parrt/dtreeviz/blob/master/notebooks/dtreeviz_spark_visualisations.ipynb))\n* [TensorFlow-based examples](notebooks/dtreeviz_tensorflow_visualisations.ipynb) ([colab](https://colab.research.google.com/github/parrt/dtreeviz/blob/master/notebooks/dtreeviz_tensorflow_visualisations.ipynb)) Also see blog at tensorflow.org [Visualizing TensorFlow Decision Forest Trees with dtreeviz](https://www.tensorflow.org/decision_forests/tutorials/dtreeviz_colab)\n* [XGBoost-based examples](notebooks/dtreeviz_xgboost_visualisations.ipynb) ([colab](https://colab.research.google.com/github/parrt/dtreeviz/blob/master/notebooks/dtreeviz_xgboost_visualisations.ipynb))\n* [Classifier decision boundaries for any scikit-learn model.ipynb](https://github.com/parrt/dtreeviz/tree/master/notebooks/classifier-decision-boundaries.ipynb) ([colab](https://colab.research.google.com/github/parrt/dtreeviz/blob/master/notebooks/classifier-decision-boundaries.ipynb))\n* [Changing colors notebook](notebooks/colors.ipynb) ([colab](https://colab.research.google.com/github/parrt/dtreeviz/blob/master/notebooks/colors.ipynb))\n* [AI-powered tree analysis (sklearn)](notebooks/dtreeviz_sklearn_AI_visualisations.ipynb) - Interactive chat and explanations using LLMs\n\nTo 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:\n\n1. Import dtreeviz and your decision tree library\n2. Acquire and load data into memory\n3. Train a classifier or regressor model using your decision tree library\n4. Obtain a dtreeviz adaptor model using<br>`viz_model = dtreeviz.model(your_trained_model,...)`\n5. Call dtreeviz functions, such as<br>`viz_model.view()` or `viz_model.explain_prediction_path(sample_x)`\n\n**Example**\n\nHere's a complete example Python file that displays the following tree in a popup window:\n\n<img src=\"testing/samples/iris-TD-4.svg\" width=\"200\">\n\n```python\nfrom sklearn.datasets import load_iris\nfrom sklearn.tree import DecisionTreeClassifier\n\nimport dtreeviz\n\niris = load_iris()\nX = iris.data\ny = iris.target\n\nclf = DecisionTreeClassifier(max_depth=4)\nclf.fit(X, y)\n\nviz_model = dtreeviz.model(clf,\n                           X_train=X, y_train=y,\n                           feature_names=iris.feature_names,\n                           target_name='iris',\n                           class_names=iris.target_names)\n\nv = viz_model.view()     # render as SVG into internal object \nv.show()                 # pop up window\nv.save(\"/tmp/iris.svg\")  # optionally save as svg\n```\n\nIn a notebook, you can render inline without calling `show()`. Just call `view()`:\n\n```python\nviz_model.view()       # in notebook, displays inline\n```\n\n---\n\n## Installation\n\nInstall anaconda3 on your system, if not already done.\n\nYou 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:\n\n```bash\nconda uninstall python-graphviz\nconda uninstall graphviz\n```\n\nTo install (Python >=3.6 only), do this (from","github_created_at":"2018-08-13T21:45:15+00:00","created_at":"2026-07-11T23:26:41.638053+00:00","updated_at":"2026-09-27T06:00:54.83925+00:00","categories":[{"slug":"evaluation-observability","name":"Evaluation & Observability","url":"https://www.graphcanon.com/categories/evaluation-observability","markdown_url":"https://www.graphcanon.com/categories/evaluation-observability.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/evaluation-observability"},{"slug":"model-training","name":"Model Training","url":"https://www.graphcanon.com/categories/model-training","markdown_url":"https://www.graphcanon.com/categories/model-training.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/model-training"}],"tags":[{"slug":"decision-trees","name":"decision-trees"},{"slug":"machine-learning","name":"machine-learning"},{"slug":"model-interpretation","name":"model-interpretation"},{"slug":"random-forest","name":"random-forest"},{"slug":"scikit-learn","name":"scikit-learn"},{"slug":"visualization","name":"visualization"},{"slug":"xgboost","name":"xgboost"}],"trust":{"provenance":{"is_fork":false,"github_id":144636984,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-09-27T06:00:54.145Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":267,"last_release_at":"2025-12-27T18:59:56Z","stars_delta_30d":2,"open_issues_delta_30d":0},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T23:26:43.592Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-09-27T06:00:54.581Z"},"languages":{"value":["jupyter notebook"],"source":"github.language","observed_at":"2026-09-27T06:00:54.581Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-09-27T06:00:54.581Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["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.","If you require tool support for classroom teaching and learning purposes regarding decision trees","When working with notebooks and colab environments to quickly prototype and visualize decision paths using both traditional and AI-powered chat explanations."],"when_not_to_use":["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.","For real-time prediction path visualization in production environments due to the overhead associated with generating detailed visual representations."],"source":"enrich:decision_facts","observed_at":"2026-07-17T03:11:35.858Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"dtreeviz is a Python library for enhancing decision tree and machine-learning model understanding through visualizations."}]}}