Radial visualization helpers for scikit-learn decision trees
Project description
radtree
radtree visualizes scikit-learn decision tree predictions as a radial graph. It is designed for quick exploratory inspection of class boundaries and prediction consistency on a sampled evaluation set.
Status
This project is maintained for exploratory decision-tree visualization workflows.
Core public APIs (plot_radial, quick_fitted_tree, and package imports) are kept stable for notebook and script usage.
Installation
Local editable install (recommended for development)
python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
PyPI install (when published)
pip install radtree
If a PyPI release is not available yet, use editable install or GitHub source install.
Quickstart (<30 seconds)
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
import radtree
random_state = 42
X, y = datasets.load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.4, random_state=random_state
)
clf = DecisionTreeClassifier(random_state=random_state)
clf.fit(X_train, y_train)
fig, ax = radtree.plot_radial(
clf,
X=X_test,
Y=y_test,
smooth_d=8,
l_alpha=0.2,
l_width=1,
random_state=random_state,
)
API
plot_radial
plot_radial(
clf,
X=None,
Y=None,
data=None,
feature_cols=None,
label_col=None,
num_samples=100,
levels=None,
edges_labels=None,
draw_labels=None,
style="radplot",
bbox="dark",
cmap="pairs",
tree_node_size=50,
leaf_node_size=50,
node_size=50,
l_width=1,
l_alpha=1,
fig_res=72,
save_img=False,
img_res=300,
png_transparent=True,
spring=False,
smooth_edges=False,
smooth_d=None,
smooth_res=50,
random_state=None,
)
Core parameters:
clf: fittedDecisionTreeClassifier.X/Yordata: input records and labels.num_samples: number of rows to render. UseNoneto use all rows.random_state: deterministic sampling seed.smooth_d: enables spline smoothing when set.save_img: saves output PNG to./plots/.
Return value:
(fig, ax)matplotlib figure and axes.
Additional helpers:
quick_fitted_treeplot_pcaplot_tsneplot_umap(requires optional dependencyumap-learn)
Performance and limits
plot_radial uses num_samples=100 by default as a safe rendering baseline.
Runtime grows with sample size, and grows faster when smoothing is enabled.
Practical guidance:
- Start with the default
num_samples=100. - Increase to
200+only when needed. - Keep
smooth_d=Nonefor faster previews. - Use
random_statefor repeatable comparisons. - For full-dataset runs (
num_samples=None), prefer smaller evaluation subsets if rendering gets slow.
Examples
Notebooks and example datasets are available in notebooks/.
Third-party notices
Third-party dependency notices are listed in THIRD_PARTY_NOTICES.md.
Contributing
Please read CONTRIBUTING.md for local setup, quality checks, and pull request expectations.
License
MIT License (LICENSE).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file radtree-0.1.0.tar.gz.
File metadata
- Download URL: radtree-0.1.0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
504e231a570dbf928412c9097569dd27ada50d88bfecd0ada35a40423a8c9fc1
|
|
| MD5 |
261e388f4ce9b4112711015c17a85d19
|
|
| BLAKE2b-256 |
efa3d532203d4a49a9d66c1ecb8623e8debf86bccc043a1999518b8a29b094ef
|
Provenance
The following attestation bundles were made for radtree-0.1.0.tar.gz:
Publisher:
release.yml on poctaviano/radtree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
radtree-0.1.0.tar.gz -
Subject digest:
504e231a570dbf928412c9097569dd27ada50d88bfecd0ada35a40423a8c9fc1 - Sigstore transparency entry: 1018719663
- Sigstore integration time:
-
Permalink:
poctaviano/radtree@d303b55cf91253e871887c1da9981c4e8b1841ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/poctaviano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d303b55cf91253e871887c1da9981c4e8b1841ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file radtree-0.1.0-py3-none-any.whl.
File metadata
- Download URL: radtree-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f482857d85873388419f0eacd18451e6ddb5a9dfb2464b5d1bbd8bb39458c55
|
|
| MD5 |
473d5574ac6085b4d16402952ec9a8e3
|
|
| BLAKE2b-256 |
87962d749b76aafec31ef6eaa422fb84b68a506d812e58d95556433d10d0f542
|
Provenance
The following attestation bundles were made for radtree-0.1.0-py3-none-any.whl:
Publisher:
release.yml on poctaviano/radtree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
radtree-0.1.0-py3-none-any.whl -
Subject digest:
5f482857d85873388419f0eacd18451e6ddb5a9dfb2464b5d1bbd8bb39458c55 - Sigstore transparency entry: 1018719665
- Sigstore integration time:
-
Permalink:
poctaviano/radtree@d303b55cf91253e871887c1da9981c4e8b1841ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/poctaviano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d303b55cf91253e871887c1da9981c4e8b1841ec -
Trigger Event:
push
-
Statement type: