CLARITree: optimal regression trees with C++ backend
Project description
CLARITree: Cholesky and Lookahead Accelerations for Regression with Interpretable Piecewise Linear Trees
This repository contains the code and experiment artifacts for the ICML 2026 paper "CLARITree: Cholesky and Lookahead Accelerations for Regression with Interpretable Piecewise Linear Trees."
Installation
Install the released Python package with:
pip install claritree
The PyPI distribution is named claritree; the Python import package remains
clari_tree:
from clari_tree import CLARITree
To use the dataframe-based example, install the optional example dependencies:
pip install "claritree[examples]"
Source Requirements
CLARITree requires Python 3.9+, CMake, a C++17 compiler, and Eigen 3.
Clone the repository:
git clone https://github.com/Yixiao-Wang-Stats/CLARITree.git
cd CLARITree
C++ Demo
Build the C++ executable:
make
Run the built-in demo:
make test
This compiles run_tree and runs it on one of the included datasets. You can also call it directly:
./run_tree data/airfoil/splits/outer_0/train.csv 4.0 0.001 0.001 20 quantile
The command-line interface is:
./run_tree <csv_file> <depth> <lambda> <kappa> [n_thresholds] [thresholds_strategy]
depth: maximum tree depth.lambda: tree-complexity penalty.kappa: ridge penalty for the linear models in the leaves.n_thresholds: candidate split thresholds per feature.thresholds_strategy:quantileoruniform; defaults toquantile.
The executable creates a reproducible 80/20 train/test split and reports MSE, R2, and runtime for both Greedy and CLARITree. CSV files may have a header and must otherwise be numeric. The target is read from the final column, except for filenames containing targetfirst, where it is read from the first column.
Clean the C++ build output with:
make clean
Python Build
For local Python development, use the rebuild helper:
./rebuild_clari_tree.sh
The script creates .venv if needed, builds the pybind11 extension, installs the package in editable mode, and verifies that the Python module imports correctly. To use a different virtual environment path:
CLARITREE_VENV=claritree-env ./rebuild_clari_tree.sh
After the build, activate the environment before running Python scripts:
source .venv/bin/activate
Python Quick Start
Run the included Airfoil example from the repository root:
python scripts/example.py
The minimal API is:
import pandas as pd
from clari_tree import CLARITree
data = pd.read_csv("data/airfoil/splits/outer_0/train.csv").to_numpy(float)
X, y = data[:, :-1], data[:, -1]
model = CLARITree(
depth=4,
lambda_=0.001,
kappa=0.001,
n_thresholds=20,
thresholds_strategy="quantile",
min_leaf_node_size=0,
)
model.fit(X, y)
predictions = model.predict(X)
model.print_tree()
Input CSV files should contain features followed by the target in the final column. Binary split features should be encoded as 0/1; categorical features should be one-hot encoded before fitting.
Repository Layout
clari_tree/: Python package.src/andinclude/: C++ implementation and Python bindings.scripts/: experiment, table, and plotting scripts.data/: datasets and pre-generated train/test splits.results/: selected result tables and paper figures.
The public plotting entry points are:
python scripts/images/main_teaser.py
python scripts/images/plot_completion_rate.py
python scripts/images/plot_linear.py
License
CLARITree is released under the MIT 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 claritree-0.1.1.tar.gz.
File metadata
- Download URL: claritree-0.1.1.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19cd68913a01e42bae31c51371567c2c489275ee9815bedf49ca5100601f84a1
|
|
| MD5 |
1563fed9153ec689358441e137cb51f9
|
|
| BLAKE2b-256 |
71285009270efe8ed1271c80eae94b587ee46692c353107fd4e63c2b0df896c6
|
File details
Details for the file claritree-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: claritree-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 201.5 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4b29dc1bd3b66cc6286ad2626fa1bed16a7ca5c8ad8147a7357cb0dff2a2642
|
|
| MD5 |
ac87e5af0426a1a3a3dd4d843972eefd
|
|
| BLAKE2b-256 |
78b4919107d2ca709a3b03f387b6685e67fb345989c189cdeecf6628ad8082f2
|