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 Donate

  • treeplot is Python package

Contents

Installation

  • Install treeplot from PyPI (recommended). treeplot is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • It is distributed under the MIT license.

Quick Start

pip install treeplot
  • Alternatively, install treeplot from the GitHub source:
git clone https://github.com/erdogant/treeplot.git
cd treeplot
python setup.py install

Import treeplot package

import treeplot

Example RandomForest:

# Load example dataset
X,y = treeplot.import_example()

# Learn model
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(n_estimators=100, max_depth=2, random_state=0).fit(X, y)

# Make plot
ax = treeplot.plot(model)

# or alternatively if you have more parameters to specify:
ax = treeplot.randomforest(model, export='pdf')

Example XGboost:

# Load example dataset
X,y = treeplot.import_example()

# Learn model
from xgboost import XGBClassifier
model = XGBClassifier(n_estimators=100, max_depth=2, random_state=0).fit(X, y)

# Make plot
ax = treeplot.plot(model)

# or alternatively if you have more parameters to specify:
ax = treeplot.xgboost(model, plottype='vertical')

Maintainers

Contribute

  • Contributions are welcome.

Licence

See LICENSE for details.

Donation

  • This work is created and maintained in my free time. Contributions of any kind are very appreciated. Sponsering is also possible.

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.2.tar.gz (28.4 MB view details)

Uploaded Source

Built Distribution

treeplot-0.1.2-py3-none-any.whl (28.4 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: treeplot-0.1.2.tar.gz
  • Upload date:
  • Size: 28.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.10

File hashes

Hashes for treeplot-0.1.2.tar.gz
Algorithm Hash digest
SHA256 26ea78a1f388ccf24ebdda8db8ac54454499af1526ca7d8eb4e5d427110f7e78
MD5 c589683d3802689f1a08fbc029959d79
BLAKE2b-256 4d482de718542433f22d434b899cf88aa3770ed005f34bf04d0201601b207d93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treeplot-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 28.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.10

File hashes

Hashes for treeplot-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c6a845b1f046778a64b9cf3d7fedceaf8f42f8523f566f97a6b83ba090c1ed4
MD5 c7e5470fea2e21334b32fd05fec5c2d1
BLAKE2b-256 9d4b208b031fc543771a0f7c64876eb6ecfaa8f601e6e52754c45ce2eb34a2c1

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