supertree

Visualize decision trees in Python

https://github.com/mljar/supertree

Science Score: 31.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary

Keywords

decision-trees lightgbm random-forest xgboost
Last synced: 6 months ago · JSON representation ·

Repository

Visualize decision trees in Python

Basic Info
Statistics
  • Stars: 499
  • Watchers: 6
  • Forks: 17
  • Open Issues: 3
  • Releases: 10
Topics
decision-trees lightgbm random-forest xgboost
Created over 1 year ago · Last pushed 12 months ago
Metadata Files
Readme License Citation

README.md

supertree - Interactive Decision Tree Visualization

supertree is a Python package designed to visualize decision trees in an interactive and user-friendly way within Jupyter Notebooks, Jupyter Lab, Google Colab, and any other notebooks that support HTML rendering. With this tool, you can not only display decision trees, but also interact with them directly within your notebook environment. Key features include: - ability to zoom and pan through large trees, - collapse and expand selected nodes, - explore the structure of the tree in an intuitive and visually appealing manner.

Examples

Decision Tree classifier on iris data

Open In Colab

```python from sklearn.tree import DecisionTreeClassifier from sklearn.datasets import load_iris from supertree import SuperTree # <- import supertree :)

Load the iris dataset

iris = load_iris() X, y = iris.data, iris.target

Train model

model = DecisionTreeClassifier() model.fit(X, y)

Initialize supertree

supertree = SuperTree(model, X, y, iris.featurenames, iris.target_names)

show tree in your notebook

supertree.showtree() ```

Random Forest Regressor Example

Open In Colab

```python from sklearn.ensemble import RandomForestRegressor from sklearn.datasets import load_diabetes from supertree import SuperTree # <- import supertree :)

Load the diabetes dataset

diabetes = load_diabetes() X = diabetes.data y = diabetes.target

Train model

model = RandomForestRegressor(nestimators=100, maxdepth=3, random_state=42) model.fit(X, y)

Initialize supertree

super_tree = SuperTree(model,X, y)

show tree with index 2 in your notebook

supertree.showtree(2) ```

There are more code snippets in the examples directory.

Instalation

You can install SuperTree package using pip:

pip install supertree

Conda support coming soon.

Supported Libraries

  • scikit-learn (sklearn)
  • LightGBM
  • XGBoost
  • ONNX:

Supported Algorithms

The package is compatible with a wide range of classifiers and regressors from these libraries, specifically:

Scikit-learn

  • DecisionTreeClassifier
  • ExtraTreeClassifier
  • ExtraTreesClassifier
  • RandomForestClassifier
  • GradientBoostingClassifier
  • HistGradientBoostingClassifier
  • DecisionTreeRegressor
  • ExtraTreeRegressor
  • ExtraTreesRegressor
  • RandomForestRegressor
  • GradientBoostingRegressor
  • HistGradientBoostingRegressor

LightGBM

  • LGBMClassifier
  • LGBMRegressor
  • Booster

XGBoost

  • XGBClassifier
  • XGBRFClassifier
  • XGBRegressor
  • XGBRFRegressor
  • Booster

If we do not support the model you want to use, please let us know.

Features

Gif1
See all the details
Gif2
Zoom
Gif3
Fullscreen in Jupyter
Gif4
Depth change
Gif5
Color change
Gif6
Navigate in forest
Gif7
Show specific sample path
Gif8
Save tree to svg
Gif11
Links sample visualization
Gif12
Showing the path to the leaf

Check this features in example directory :)

Articles

Support

If you encounter any issues, find a bug, or have a feature request, we would love to hear from you! Please don't hesitate to reach out to us at supertree/issues. We are committed to improving this package and appreciate any feedback or suggestions you may have.

License

supertree is a commercial software with two licenses available:

  • AGPL-3.0 license
  • Commercial license with support and maintenance included. Pricing website https://mljar.com/supertree/ License supertree-commercial-license.pdf.

Owner

  • Name: MLJAR
  • Login: mljar
  • Kind: organization
  • Email: contact@mljar.com
  • Location: Poland

Outstanding Data Science Tools

Citation (CITATION)

@misc{supertree,
  author    = {Tomasz Marchela and Piotr P\l{}o\'{n}ski},
  year      = {2024},
  publisher = {MLJAR Sp. z o.o.},
  address   = {\L{}apy, Poland},
  title     = {supertree: interactive visualization of decision trees.  Version 0.3.0},
  url       = {https://github.com/mljar/supertree}
}

GitHub Events

Total
  • Create event: 1
  • Release event: 1
  • Issues event: 18
  • Watch event: 114
  • Issue comment event: 26
  • Push event: 9
  • Fork event: 11
Last Year
  • Create event: 1
  • Release event: 1
  • Issues event: 18
  • Watch event: 114
  • Issue comment event: 26
  • Push event: 9
  • Fork event: 11

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 30
  • Total pull requests: 0
  • Average time to close issues: 3 days
  • Average time to close pull requests: N/A
  • Total issue authors: 12
  • Total pull request authors: 0
  • Average comments per issue: 1.3
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 23
  • Pull requests: 0
  • Average time to close issues: 3 days
  • Average time to close pull requests: N/A
  • Issue authors: 10
  • Pull request authors: 0
  • Average comments per issue: 1.35
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pplonski (18)
  • ogencoglu (2)
  • KulikDM (2)
  • jmozmoz (2)
  • P-Y-R-O-B-O-T (1)
  • TheNeeloy (1)
  • msicilia (1)
  • eleanor-clifford (1)
  • juandaherrera (1)
  • SalvatoreRa (1)
  • Kirvyteo (1)
  • Thornam (1)
  • fzyzcjy (1)
  • micha-hro (1)
Pull Request Authors
Top Labels
Issue Labels
bug (3)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 863 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 27
  • Total maintainers: 1
pypi.org: supertree

Visualize decision tree in Python

  • Versions: 27
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 863 Last month
Rankings
Dependent packages count: 10.6%
Average: 35.1%
Dependent repos count: 59.6%
Maintainers (1)
Last synced: about 1 year ago

Dependencies

requirements.txt pypi
  • ipython *
  • numpy *
  • pandas *
setup.py pypi