{"data":{"slug":"parrt-dtreeviz","name":"dtreeviz","tagline":"A 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":3156,"forks":339,"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","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":null,"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-07-11T23:26:53.362974+00:00","categories":[{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"},{"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":"data-science","name":"data-science"},{"slug":"decision-trees","name":"decision-trees"},{"slug":"machine-learning","name":"machine-learning"},{"slug":"model-interpretation","name":"model-interpretation"},{"slug":"python","name":"python"},{"slug":"random-forest","name":"random-forest"},{"slug":"scikit-learn","name":"scikit-learn"},{"slug":"visualization","name":"visualization"}],"trust":{"provenance":{"is_fork":false,"github_id":144636984,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-07-11T23:26:43.129Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":190,"last_release_at":"2025-12-27T18:59:56Z"},"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-07-11T23:26:42.914Z"},"languages":{"value":["jupyter notebook"],"source":"github.language","observed_at":"2026-07-11T23:26:42.914Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-07-11T23:26:42.914Z"}}}}