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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: treeplot-0.1.17.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.17.tar.gz
Algorithm Hash digest
SHA256 55917426413168a89ed0d22f8b0ec78f9fe728728ce07db29a6a79b8cc29d0ee
MD5 7d88002be76b4a92c84fe2d59f7a600a
BLAKE2b-256 388b249fce718359f3e46744a614ca2148053cfc876ec0d083a728eff2158706

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treeplot-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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.17-py3-none-any.whl
Algorithm Hash digest
SHA256 6ea3f9e555ab7c5aeb27f3a26f02d0987a130c0804407d4db1f585f9eaa7d951
MD5 5936879ccd819b06160c6ecedd55120c
BLAKE2b-256 e161ec508400d29937c698d38589cc7bcab48fcbb5a6255f81ee865dc08b530c

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