Skip to main content

User-friendly Python toolbox for interpreting and manipulating decision tree ensembles from scikit-learn

CI Status Linting , formatting, imports sorting: ruff Pre-commit Docs

License Python Versions PyPI Version status

🪵 Key Features

WoodTapper is a Python toolbox that provides:

  • Rule extraction from tree-based ensembles: Generates a final estimator composed of a sequence of simple rule-based on features and thresholds.

  • Fairness-Constrained Gradient Boosting: A second-order tree-boosting implementation that directly incorporates demographic fairness into the training objective via a Wasserstein distance penalty.

  • Example-based explanations: Connects predictions to a small set of representative samples, returning the most similar examples along with their target values.

Detailed information about the modules can be found here.

WoodTapper is supported by a peer reviewed publication:

    WoodTapper: a Python package for explaining decision tree ensembles, Sakho et al. (2026) 📄

and a preprint:

    OT-FairBoost: Optimal Transport-Guided Gradient Boosting for Fairness Regularization on Tabular Data, Shivola et al. (2026) 📄

🛠 Installation

From PyPi:

pip install woodtapper

Compatibility note: WoodTapper includes a compiled Cython component that depends on the binary interface of scikit-learn. If scikit-learn is already installed in your environment, the prebuilt PyPI wheel may be incompatible with it. WoodTapper is currently pinned to scikit-learn 1.6.1: versions 1.9 and newer are not compatible with this component. To use another compatible version, rebuild WoodTapper locally with:

pip uninstall -y woodtapper
pip install -U pip setuptools wheel
pip install -U Cython pybind11
pip install --no-binary=woodtapper --no-build-isolation woodtapper

From source:

git clone https://github.com/artefactory/woodtapper.git
cd woodtapper
pip install -e .[dev,docs]

Warning: If you are a Windows user, you need to have a C/C++ compiler before installing woodtapper.

🌿 WoodTapper RulesExtraction module

from woodtapper.extract_rules import SirusClassifier
from woodtapper.extract_rules.visualization import show_rules

sirus = SirusClassifier(
    n_estimators=1000, max_depth=2, quantile=10, p0=0.01, random_state=0
)
sirus.fit(X_train, y_train)
y_pred_sirus = sirus.predict(X_test)
show_rules(sirus, max_rules=10)

⚖️ WoodTapper boosted trees Fairness module

from woodtapper.fairness import OTFairBoostClassifier

otfair_clf = OTFairBoostClassifier(
    n_estimators=100,
    lambda_fairness_value=0.1,
    fairness_mode="Demographic_Parity",
    verbosity=-1,
)

otfair_clf.fit(X_train, y_train,sensitive_attribute_train)
otfair_clf.predict(X_test)

🌱 WoodTapper ExampleExplanation module

from woodtapper.example_sampling import RandomForestClassifierExplained

rf_explained = RandomForestClassifierExplained(n_estimators=100)
rf_explained.fit(X_train, y_train)

# Get the 5 most similar samples (and target) for each test sample
Xy_explain = rf_explained.explanation(X_test)

🙏 Acknowledgements

This work was done through a partnership between the Artefact Research Center and the Laboratoire de Probabilités Statistiques et Modélisation (LPSM) of Sorbonne University.

   

📜 Citation

If you find the code useful, please consider citing us:

@article{Sakho2026,
doi = {10.21105/joss.10112},
url = {https://doi.org/10.21105/joss.10112},
year = {2026}, publisher = {The Open Journal},
volume = {11},
number = {121},
pages = {10112},
author = {Sakho, Abdoulaye and Aouad, Jad and Gauthier, Carl-Erik and Malherbe, Emmanuel and Scornet, Erwan},
title = {WoodTapper: a Python package for explaining decision tree ensembles},
journal = {Journal of Open Source Software} }
@article{shilova2026ot,
  title={OT-FairBoost: Optimal Transport-Guided Gradient Boosting for Fairness Regularization on Tabular Data},
  author={Shilova, Veronika and Sakho, Abdoulaye and Boumoussou, Younes and Risser, Laurent and Loubes, Jean-Michel and Malherbe, Emmanuel},
  journal={arXiv preprint arXiv:2607.28014},
  year={2026}
}

For SIRUS methodology, consider citing:

@article{benard2021sirus,
  title={Sirus: Stable and interpretable rule set for classification},
  author={Benard, Clement and Biau, Gerard and Da Veiga, Sebastien and Scornet, Erwan},
  year={2021}
}

Metadata

Release files for woodtapper 0.1.0

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

Source distribution (sdist)

Source distribution for woodtapper 0.1.0
File Size Uploaded
woodtapper-0.1.0.tar.gz 397.7 kB Details

Release files / woodtapper-0.1.0.tar.gz

Download URL woodtapper-0.1.0.tar.gz
Size 397.7 kB
Tags Source
SHA-256 checksum
How to use checksums
86c36352a24c25bc65dc8fa98a71f26cee2f89fa0af21798c6447c55b1866896
BLAKE2b-256 checksum
How to use checksums
d57ced20c29313691bd2da6ab5305b71dc01ae0874887e7dd7e3da24852ad648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.8

1 release file

0.0.6

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