Skip to main content

treeplot - Plot tree based machine learning models.

Python PyPI Version License Downloads Downloads BuyMeCoffee Sphinx

  • treeplot is Python package to easily plot the tree derived from models such as decisiontrees, randomforest and xgboost. Developing explainable machine learning models is becoming more important in many domains. The most popular and classical explainable models are still tree based. Think of decision trees or random forest. The tree that is learned can be visualized and then explained. However, it can be a challange to simply plot the tree. Think of configuration issues with dot files, path locations to graphviz, differences across operating systems, differences across editors such as jupyter notebook, colab, spyder etc. This frustration led to this library, an easy way to plot the decision trees 🌲. It works for Random-forest, decission trees, xgboost and gradient boosting models. Under the hood it makes many checks, downloads graphviz, sets the path and then plots the tree.

Functions in treeplot

Treeplot can plot the tree for Random-forest, decission trees, xgboost and gradient boosting models:

  • .plot : Generic function to plot the tree of any of the four models with default settings
  • .randomforest : Plot the randomforest model. Parameters can be specified.
  • .xgboost : Plot the xgboost model. Parameters can be specified.
  • .import_example('iris') : Import example dataset

⭐️ Star this repo if you like it ⭐️

Install treeplot from PyPI

pip install treeplot

Import treeplot package

import treeplot as tree

Documentation pages

On the documentation pages you can find detailed information about the working of the treeplot with examples.


Examples



Maintainers

Contribute

  • Contributions are welcome.
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

Release files for treeplot 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for treeplot 0.2.0
File Size Uploaded
treeplot-0.2.0.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for treeplot 0.2.0
File Interpreter ABI Platform
treeplot-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / treeplot-0.2.0.tar.gz

Download URL treeplot-0.2.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
72ecce5b49809f0b56cc144661dfe2e87e902958b7a4556da9b52b5d8b3c8a59
BLAKE2b-256 checksum
How to use checksums
d5c6a660973c93dc682202b8f4b2c3a9a93a4db61ae73807d13abc0849327eeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / treeplot-0.2.0-py3-none-any.whl

Download URL treeplot-0.2.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa715a59f62e49d4f5e6c102a9034608f61e83d9af76e291370d9b2fac0cfd01
BLAKE2b-256 checksum
How to use checksums
4ab086f662e9344cf543ef15628ba6c75e5e0f5b7b9b79a17b2e401c809a3573
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page