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

Uploaded Source

Built Distribution

treeplot-0.2.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for treeplot-0.2.0.tar.gz
Algorithm Hash digest
SHA256 72ecce5b49809f0b56cc144661dfe2e87e902958b7a4556da9b52b5d8b3c8a59
MD5 30a5a0fdc15b60eb791fae3f28802465
BLAKE2b-256 d5c6a660973c93dc682202b8f4b2c3a9a93a4db61ae73807d13abc0849327eeb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for treeplot-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa715a59f62e49d4f5e6c102a9034608f61e83d9af76e291370d9b2fac0cfd01
MD5 7f7a5ee6511ee0e678e70e7076a673b8
BLAKE2b-256 4ab086f662e9344cf543ef15628ba6c75e5e0f5b7b9b79a17b2e401c809a3573

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