Skip to main content

fast-model-trees

Fast implementation of PILOT (PIecewise Linear Organic Trees) and RaFFLE (Random Forest Featuring Linear Extensions) algorithms.

Overview

This package provides efficient C++-based implementations of:

  • PILOT: A linear model tree algorithm that builds piecewise linear models
  • RaFFLE: A random forest ensemble method using PILOT trees as base learners

Papers

  • PILOT: Raymaekers, J., Rousseeuw, P. J., Verdonck, T., & Yao, R. (2024). Fast linear model trees by PILOT. Machine Learning, 1-50. https://doi.org/10.1007/s10994-024-06590-3

  • RaFFLE: Raymaekers, J., Rousseeuw, P. J., Servotte, T., Verdonck, T., & Yao, R. (2025). A Powerful Random Forest Featuring Linear Extensions (RaFFLE). Under Review

Installation

pip install fast-model-trees

Building from Source

If you need to build from source, you'll need:

  • C++17 compatible compiler
  • CMake >= 3.12
  • Armadillo linear algebra library
  • BLAS and LAPACK libraries
  • pybind11
  • carma (C++ Armadillo/NumPy bridge)

See INSTALL.md for detailed installation instructions.

Development

For development setup, running benchmarks, and reproducing paper results, see DEVELOPMENT.md.

Quick Start

Using RaFFLE (Random Forest)

from pilot import RaFFLE
import numpy as np

# Create sample data
X = np.random.randn(1000, 10)
y = X[:, 0] + 0.5 * X[:, 1] ** 2 + np.random.randn(1000) * 0.1

# Train RaFFLE model
model = RaFFLE(
    n_estimators=100,
    max_depth=5,
    random_state=42
)
model.fit(X, y)

# Make predictions
predictions = model.predict(X)

# Get feature importances
importances = model.feature_importances_

Using PILOT (Single Tree)

from pilot import PILOT
import numpy as np

# Create sample data
X = np.random.randn(1000, 10)
y = X[:, 0] + 0.5 * X[:, 1] ** 2 + np.random.randn(1000) * 0.1

# Train PILOT model — all parameters have sensible defaults
model = PILOT(max_depth=5)
model.train(X, y)  # categorical defaults to all-numerical

# Make predictions
predictions = model.predict(X)

# Inspect the tree structure
print(model.tree_summary())

Key Features

  • Fast C++ implementation: Optimized for performance using Armadillo linear algebra
  • Scikit-learn compatible: Follows scikit-learn API conventions
  • Flexible model complexity: Control tree depth and piecewise linear behavior
  • Feature importance: Built-in feature importance calculation
  • Bootstrap aggregation: RaFFLE uses bootstrap sampling for robust predictions

Parameters

RaFFLE

  • n_estimators: Number of trees in the forest (default: 10)
  • max_depth: Maximum depth of each tree (default: 12)
  • min_sample_fit: Minimum samples needed to fit any node (default: 10)
  • min_sample_alpha: Minimum samples for piecewise nodes (default: 5)
  • min_sample_leaf: Minimum samples in each leaf (default: 5)
  • random_state: Random seed for reproducibility (default: 42)
  • n_features_tree: Fraction of features to consider per tree (default: 1.0)
  • n_features_node: Fraction of features to consider per node (default: 1.0)
  • alpha: Controls piecewise linear complexity (default: 1)

PILOT

  • df_settings: Degrees of freedom for node types [con, lin, pcon, blin, plin, pconc]. Defaults to [1, 2, 5, 5, 7, 5]. Set a value to -1 to disable that node type.
  • max_depth: Maximum split depth (default: 20)
  • max_model_depth: Maximum total depth including linear model nodes (default: 100)
  • max_features: Features considered per split; None (default) uses all features
  • min_sample_fit: Minimum samples to fit any node (default: 5)
  • min_sample_alpha: Minimum samples for piecewise nodes (default: 5)
  • min_sample_leaf: Minimum samples per leaf (default: 5)
  • rel_tolerance: Minimum relative RSS improvement to keep growing (default: 0.01)

License

MIT License - see LICENSE file for details

Citation

If you use this package in your research, please cite:

@article{raymaekers2024pilot,
  title={Fast linear model trees by PILOT},
  author={Raymaekers, J. and Rousseeuw, P.J. and Verdonck, T. and Yao, R.},
  journal={Machine Learning},
  pages={1--50},
  year={2024},
  doi={10.1007/s10994-024-06590-3}
}

Contributing

Contributions are welcome! Please see the GitHub repository for more information.

Support

For issues and questions, please use the GitHub issue tracker.

Metadata

Release files for fast-model-trees 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fast-model-trees 0.0.5
File Size Uploaded
fast_model_trees-0.0.5.tar.gz 440.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fast-model-trees 0.0.5
File
fast_model_trees-0.0.5-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
fast_model_trees-0.0.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
fast_model_trees-0.0.5-cp314-cp314t-macosx_15_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 15.0+ ARM64 Details
fast_model_trees-0.0.5-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
fast_model_trees-0.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
fast_model_trees-0.0.5-cp314-cp314-macosx_15_0_arm64.whl CPython 3.14 CPython 3.14 macOS 15.0+ ARM64 Details
fast_model_trees-0.0.5-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
fast_model_trees-0.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
fast_model_trees-0.0.5-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details
fast_model_trees-0.0.5-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
fast_model_trees-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
fast_model_trees-0.0.5-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details
fast_model_trees-0.0.5-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
fast_model_trees-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
fast_model_trees-0.0.5-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details
fast_model_trees-0.0.5-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
fast_model_trees-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
fast_model_trees-0.0.5-cp310-cp310-macosx_15_0_arm64.whl CPython 3.10 CPython 3.10 macOS 15.0+ ARM64 Details

Total release size: 359.7 MB

Release files / fast_model_trees-0.0.5.tar.gz

Download URL fast_model_trees-0.0.5.tar.gz
Size 440.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f5d423ecb49f3463d9b5717d7d030947c8d8fcd76097417902154064f197f7e3
BLAKE2b-256 checksum
How to use checksums
d4d4254e231c9aec6cfb9ef443ed98e864a58bf781a144add76b55f38d1fd6d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp314-cp314t-win_amd64.whl

Download URL fast_model_trees-0.0.5-cp314-cp314t-win_amd64.whl
Size 6.0 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
55cf672faf0914e9cbf0c87aefcbf0c025afa5f6ce8004a5b5c65b2ae961a4ea
BLAKE2b-256 checksum
How to use checksums
32b436f7a6feb27bda63b1e0fb548d35d771a057802d361b58ba240569816597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL fast_model_trees-0.0.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.2 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
19f2471bf3c68725724c199395db12b4bb5c1a1c116010280d65cd7d7fbd1e57
BLAKE2b-256 checksum
How to use checksums
9c883de9b4d0f053507ca590ac913c4e6f306f033ac8f237596415e4fdc9d31a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp314-cp314t-macosx_15_0_arm64.whl

Download URL fast_model_trees-0.0.5-cp314-cp314t-macosx_15_0_arm64.whl
Size 10.8 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
dbdef6fa6d5057de37c727cec1c10f5135e939ccf98f7ed679a8e25cba7b3cdb
BLAKE2b-256 checksum
How to use checksums
af0aaeb65df527e6d3f22fa45fa46ee99dab2479011d2bbbfad7dd02af691a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp314-cp314-win_amd64.whl

Download URL fast_model_trees-0.0.5-cp314-cp314-win_amd64.whl
Size 6.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
221e32a2878e6878ef667dff90ae57378871198eb7415c034897bb32d338e78a
BLAKE2b-256 checksum
How to use checksums
aa35072adae2f370548dfdd37014db8154e1c23abe9c5a5e501c1e4c4ac6a7fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL fast_model_trees-0.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.2 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
da1e6263e6ba20edd76ef9987ecbf6d1c0980f317febae253dd831133ac9a766
BLAKE2b-256 checksum
How to use checksums
2f8ea4dd2f3cfb894d2d99cf91bdac1ae0f11b4e6bee2ccaffbf0369c93841ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp314-cp314-macosx_15_0_arm64.whl

Download URL fast_model_trees-0.0.5-cp314-cp314-macosx_15_0_arm64.whl
Size 10.8 MB
Tags CPython 3.14 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
f58574c53b34ac4e5af607b89075f3bc9edce061e68b0ade90725a66a2b6be6c
BLAKE2b-256 checksum
How to use checksums
658457009644e836128a5953879a45fcd5dca4584c9ad234a2d20106c6da76e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp313-cp313-win_amd64.whl

Download URL fast_model_trees-0.0.5-cp313-cp313-win_amd64.whl
Size 5.9 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
ab0f34007506f54234893001f91cd675fe292458fb16028f510107c80dbec0d2
BLAKE2b-256 checksum
How to use checksums
abc8bb07148905c55b464f4544bbaa0544605d2476575a012250e002572cab2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL fast_model_trees-0.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.2 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2e8b8ad70faa474873cd859985567f33ede4351ec22cd88f672caeb9dc57dd33
BLAKE2b-256 checksum
How to use checksums
f9e8ab966896431649f1401537d7383094b2a952f0f5c05572f543c666e46efc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp313-cp313-macosx_15_0_arm64.whl

Download URL fast_model_trees-0.0.5-cp313-cp313-macosx_15_0_arm64.whl
Size 10.8 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
60233ee4125118284ae02d95359f738ed5a08d90e4b12cf475f3b45ac0951da1
BLAKE2b-256 checksum
How to use checksums
84a2a6694340110172f6aa26cf2417843f103e09dd197fa009004df423ae3cc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp312-cp312-win_amd64.whl

Download URL fast_model_trees-0.0.5-cp312-cp312-win_amd64.whl
Size 5.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2627d495a2b2d66780159d7a5fd750222923794152b7fdf54843ca37d136b117
BLAKE2b-256 checksum
How to use checksums
089673f855e80218d8f32e5be4a0aa2eacbf38b500c8c495a982ec6b3a2454d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL fast_model_trees-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.2 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
37c24e6800532ce8fa977fe28218b09cb44d445f419eb19b926dfffb7d6d178e
BLAKE2b-256 checksum
How to use checksums
ad84dfc2ea00323aea8ead1b7c0245841b26b36eb2267f5d268bb8867493fca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp312-cp312-macosx_15_0_arm64.whl

Download URL fast_model_trees-0.0.5-cp312-cp312-macosx_15_0_arm64.whl
Size 10.8 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
2db38f124e162836fc6fb7fba914ae823309f47a18b9ad4e6e8e63be899c9cf7
BLAKE2b-256 checksum
How to use checksums
8cb45a1d6eeb501a0aa7d94eeb35a14cffbf24e12bb8b9bba1dd7fb90a8f113e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp311-cp311-win_amd64.whl

Download URL fast_model_trees-0.0.5-cp311-cp311-win_amd64.whl
Size 5.9 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
eb7625f59836c0a6f665e17dd6ff6b42ed483886f87f92c09c1cbdde76aae4a8
BLAKE2b-256 checksum
How to use checksums
736c74edb6076675d2cd8e44a91bdf2a5dc0651222f70a1acbf1df52d62ddbe9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL fast_model_trees-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.2 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
62321f7f6a04ad90b0f0ed5cdec9de72fe3cdfdecaf8c944bf61a574b69618fd
BLAKE2b-256 checksum
How to use checksums
3b575dc8c39be42c48e5a46e55b8327a3cf501623a41aa7d0bdefd06c1e1dd71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp311-cp311-macosx_15_0_arm64.whl

Download URL fast_model_trees-0.0.5-cp311-cp311-macosx_15_0_arm64.whl
Size 10.8 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
0cc19cefbbfb639b76d7a65cb4ee3f991ad08859efe752487b8bc1a07cc17c36
BLAKE2b-256 checksum
How to use checksums
93c573b787f13b1472c77bd3cc608d175ead4c779230e58ba78d8488c18e0769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp310-cp310-win_amd64.whl

Download URL fast_model_trees-0.0.5-cp310-cp310-win_amd64.whl
Size 5.9 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
9f143ef1c537eceed501bc010bcb7e6d44ec3bfdfd9de80ae88f5742ffa63773
BLAKE2b-256 checksum
How to use checksums
fae47fcc66150642a30e491b58aa31609ad2f836dd1cb51f57741621ca8aa3ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL fast_model_trees-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 43.2 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d0399b6c8aad7617fd6a57d51c2bfc061ff644115df4671b2ce48341a44a8271
BLAKE2b-256 checksum
How to use checksums
a8ceae2a82a200475a03ba85aea5ca335db0a3361460bd1b0430dfc025b09452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / fast_model_trees-0.0.5-cp310-cp310-macosx_15_0_arm64.whl

Download URL fast_model_trees-0.0.5-cp310-cp310-macosx_15_0_arm64.whl
Size 10.8 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
7c9442b3653735888e552b9b99963ce339414b06384406397b22058290469022
BLAKE2b-256 checksum
How to use checksums
eb17bd5885221d313e60246a42968dc7ec4f984e087db8581b1c82e68d315913
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.5 This release

19 release files

0.0.2

1 release file

0.0.1

1 release file

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page