Skip to main content

Python package treeplot vizualizes a tree based on a randomforest or xgboost model.

Project description

treeplot

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 :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

treeplot-0.1.15.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

treeplot-0.1.15-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file treeplot-0.1.15.tar.gz.

File metadata

  • Download URL: treeplot-0.1.15.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for treeplot-0.1.15.tar.gz
Algorithm Hash digest
SHA256 621ac0da4ee940726b33c8c5aca36df7cde74b5d8aabd5e62b90e5bfd984b654
MD5 cde5f14198c5242c66e4892ea8dc9a8c
BLAKE2b-256 298fb9ab1d150488d2ead8543d2662648cd4f1b32fccf2412ef6350aadc0c488

See more details on using hashes here.

File details

Details for the file treeplot-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: treeplot-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for treeplot-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 5d6df347b011ae90be81d5d7fb0b117d032380fa65b4738d20cb3e42ce0a4647
MD5 becce43e4da2e4244d3ba820684c5c0a
BLAKE2b-256 9c38a1b34f174f5160f8ba1e1d3b4385334ad61400426d676b9d7984e2a09565

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page