MorphTree
Adaptive tree learning for tabular data, with structural evolution and a simple Python API.
MorphTree 2.2.0 supports binary classification, multiclass classification and single-target regression. It screens applicable native Boost and Bag tree families, selects a parent, diagnoses training errors and evaluates structural changes to the executable learning program. A descendant replaces its parent only when the internal selection criteria are satisfied; otherwise the parent is retained.
Automatic preprocessing, structural evolution, optional final numerical optimization and model persistence are available through fit() and predict().
Why MorphTree?
MorphTree explores changes to the tree-learning program itself, not only its numerical parameters. A fitted model can be used directly for predictions; inspecting or exporting the selected learning program is optional.
Project status
An early-stage system under active development. Version 2.2.0 extends structural search with Frontier split search, partitions32 and supported typed compositions. It also improves fold-local preprocessing and supports autonomous trainer export within qualified contracts. A general predictive benefit from structural evolution has not yet been established. See the release notes and qualification scope.
When to use it
For research into evolving tree-learning rules, examining structural decisions, or exploring reuse of a qualified frozen learning program.
When to consider alternatives
Conventional tree ensembles are better starting points when fast training or extensively validated predictive performance is the priority. MorphTree's search requires additional computation and may retain its initial program if no proposed modification meets the selection criteria.
Install
pip install morphtree
This installs the latest compatible release available on PyPI. MorphTree 2.2.0 requires Python 3.12-3.14. Prebuilt wheels include native components on supported platforms; source builds require a C compiler. See the installation guide for compatibility and build requirements.
Quick start
The examples use scikit-learn datasets (pip install scikit-learn).
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from morphtree import MorphTreeClassifier
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42, stratify=y
)
model = MorphTreeClassifier(random_state=42).fit(X_train, y_train)
print("Test accuracy:", model.score(X_test, y_test))
The same classifier accepts multiclass targets; use MorphTreeRegressor for
regression. The fitted model can predict directly, with no export step.
See examples.
This example demonstrates the API, not the benchmark protocol.
Structural evolution
During fit(), MorphTree screens tree families, diagnoses errors, evaluates
structural descendants, retains accepted changes, freezes the selected program,
and runs optional final Optuna tuning followed by configured refit.
The current mutation grammar includes growth and split rules, Frontier split
search and supported typed compositions; it does not generate arbitrary
algorithms. Search adds computation, but is not repeated when predicting with
a saved fitted model.
mode="baseline" disables structural evolution; use_optuna=False disables
final numerical tuning. See architecture
and the API reference.
Inspect and reuse
print(model.get_algorithm_program())
print(model.get_mutation_history())
model.save("morphtree-model.json")
restored = MorphTreeClassifier.load("morphtree-model.json")
Advanced APIs distinguish a standalone fitted predictor (export_standalone)
from a trainer of a frozen learning program (export_algorithm). In qualified
structural, numerical and environment contracts, the latter can learn new weights
without importing MorphTree or repeating structural search and Optuna. It requires
NumPy and the Python standard library. Unsupported export contracts are refused.
See autonomous export
and the API reference.
Limitations
- Structural evolution is not guaranteed to improve predictive performance; proposed mutations may all be rejected.
- Training cost includes screening and descendant fitting; no universal speed or memory advantage is established.
- Improvement on the internal SEARCH partition does not establish independent predictive benefit; refit can change held-out performance.
- Autonomous trainer export is limited to qualified contracts.
- Performance and resource requirements depend on the dataset, program and search budget.
The direct comparison without external tuning measured 1,462 of 1,488 planned scores on FIT/SEARCH; it is exploratory. A separate prospective study evaluated 234 complete ten-method allocations on EVAL and did not demonstrate a systematic advantage over the static parent or prior MorphTree. The original P9 protocol was not reproduced in full. See the benchmark overview, comparison report, capacity study, and benchmark methodology.
Documentation
- Installation
- API reference
- Architecture
- Data and resource limits
- Examples
- Autonomous export
- Qualification
- Release notes
- Changelog
- Roadmap
- Contributing
License
MorphTree is created by Luca Lullo and released under the MIT License.
Author
Created by Luca Lullo.
Metadata
Release files for morphtree 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| morphtree-2.2.0.tar.gz | 1.3 MB | With provenance | Details for morphtree-2.2.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| morphtree-2.2.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for morphtree-2.2.0-py3-none-win_amd64.whl |
| morphtree-2.2.0-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl | Python 3 | none | Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 | Details for morphtree-2.2.0-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl |
Total release size: 2.4 MB
Release files / morphtree-2.2.0.tar.gz
| Download URL | morphtree-2.2.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
946fd59bd7a2e913a7bc7ddd1e54627c87b3c3cc5f4914240461ab6562ea326a
|
|
BLAKE2b-256 checksum How to use checksums |
0b8d0af9ef7de4ea100350a443bddb630d7c91a3850b806c89f0777b76d27cdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / morphtree-2.2.0-py3-none-win_amd64.whl
| Download URL | morphtree-2.2.0-py3-none-win_amd64.whl |
|---|---|
| Size | 572.7 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4a177efde4ab467abf749671d36c22b06b2495edc8bc05f4f422e8420e85ab5b
|
|
BLAKE2b-256 checksum How to use checksums |
9cd77acb33de51746747a48b2881946219ef695dce34dc3edae2ab63a545765b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / morphtree-2.2.0-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
| Download URL | morphtree-2.2.0-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 523.9 kB |
| Tags | Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f1c1b62abeed5e52d71cb8a9de9bf32519f8d974351cd69f07debb1e32840e65
|
|
BLAKE2b-256 checksum How to use checksums |
634e1e4dde8fdf1f49b404c429ec4e5f98089eb1f667e983572df68811e11ada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for morphtree 2.2.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.
Full provenance
All 3 files in this release have been uploaded with provenance metadata.
Attestation for morphtree-2.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA 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.