Treecraft
Treecraft is an interactive decision tree framework. Treecraft allows analysts to manually evaluate, override, and prune decision boundaries utilizing an interactive UI interface, while automatically refitting subtrees optimally beneath manual split points.
The framework extends standard Scikit-Learn. Modifications made visually in the interface alter splits in the underlying tree graph. The resulting model can then be exported as a standard, fitted DecisionTreeClassifier or DecisionTreeRegressor compatible with standard sklearn pipelines.
Installation
This module provides an interactive interface built upon anywidget for integration into Jupyter ecosystems.
Install from source locally via standard python package deployment:
pip install -e .
Usage
Initiate the widget by supplying a pandas.DataFrame and declaring the target feature.
import pandas as pd
from sklearn.datasets import load_iris
from treecraft.widget import TreecraftWidget
data = load_iris()
df = pd.DataFrame(data.data, columns=data.feature_names)
df['target'] = data.target
# Instantiate the interactive widget
widget = TreecraftWidget(df=df, target='target', model_id='iris_model')
widget
Once the interactive visualization opens, users can apply initial hyperparameters, manually navigate tree partitions, append/remove split points, and verify node performance across configurable train/validation splits.
Pipeline Extraction
After modifying the boundaries visually to conform to the required constraints, extract the native Scikit-Learn estimator.
from sklearn.pipeline import make_pipeline
# Extract the fitted Scikit-Learn estimator structure
clf = widget.export_sklearn()
pipeline = make_pipeline(clf)
# Execute predictions
X_test = df.drop(columns=['target'])
predictions = pipeline.predict(X_test)
Metadata
Release files for ipytreecraft 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ipytreecraft-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ipytreecraft-0.1.0-py3-none-any.whl |
Release files / ipytreecraft-0.1.0-py3-none-any.whl
| Download URL | ipytreecraft-0.1.0-py3-none-any.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f50424fdd6c32fe59888daeee7bb1074738d0bc89fce036c4f2c1d709b02fd73
|
|
BLAKE2b-256 checksum How to use checksums |
dbd8114878d7afc7d9d90a7e985a55a642ee2b1f7fbc0ed0ed700cd665ddf741
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for ipytreecraft 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.