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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: treeplot-0.1.16.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for treeplot-0.1.16.tar.gz
Algorithm Hash digest
SHA256 997abe5bc8cd26498f0a6f5602ef4e80fa19a9c8c0b1646bf8b7eb43fa9c0334
MD5 fe5826daab1ffe269c95b47d548f20bc
BLAKE2b-256 49a67ee06f6beda13b6efbc76cd96df96d81a99f8a33855a16e58ff5bcbe77b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treeplot-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for treeplot-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 23de54947f9c500f73fb05537372407f63dce55904760a0cb44b0506a119755f
MD5 cea3a644c805cca7d605ddb8d7f7bfad
BLAKE2b-256 34ee72636c5a2be70a6a18f5c2bd5851f17f773b354ec1db7574fb10088af0f6

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