Skip to main content

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

Project description

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

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.18.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

treeplot-0.1.18-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: treeplot-0.1.18.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for treeplot-0.1.18.tar.gz
Algorithm Hash digest
SHA256 98ce47913aee0223323235af6b15e59902dbd9b411ae4b9a935d6750375d6661
MD5 f56d80ebdd224c85b73137a3dc959d0a
BLAKE2b-256 911e4ee5e43d7d0b4af9a6350869b99427165fa09d41730129e6292ff200c5b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treeplot-0.1.18-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for treeplot-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 28812b7703ff9eb0ce810713f992b7c41d0cc082a531df440b0ce2683a7e5869
MD5 f3abf064ac764c8c5f0c746556bd3769
BLAKE2b-256 f3819089165d915e725cded2853c52ed72537154c25315bce151300f5baece9d

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