Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Visualize decision trees in Python

License

NotificationsYou must be signed in to change notification settings

mljar/supertree

Repository files navigation

supertree - Interactive Decision Tree Visualization

supertree is a Python package designed to visualize decision trees in aninteractive 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
fromsklearn.treeimportDecisionTreeClassifierfromsklearn.datasetsimportload_irisfromsupertreeimportSuperTree# <- import supertree :)# Load the iris datasetiris=load_iris()X,y=iris.data,iris.target# Train modelmodel=DecisionTreeClassifier()model.fit(X,y)# Initialize supertreesuper_tree=SuperTree(model,X,y,iris.feature_names,iris.target_names)# show tree in your notebooksuper_tree.show_tree()

Random Forest Regressor Example

Open In Colab
fromsklearn.ensembleimportRandomForestRegressorfromsklearn.datasetsimportload_diabetesfromsupertreeimportSuperTree# <- import supertree :)# Load the diabetes datasetdiabetes=load_diabetes()X=diabetes.datay=diabetes.target# Train modelmodel=RandomForestRegressor(n_estimators=100,max_depth=3,random_state=42)model.fit(X,y)# Initialize supertreesuper_tree=SuperTree(model,X,y)# show tree with index 2 in your notebooksuper_tree.show_tree(2)

There are more code snippets in theexamples 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:

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2026 Movatter.jp