Skip to main content

WoeBoost

Author: xRiskLab
License: MIT License (2025)

Title

CI Free-threaded Compatibility PyPI Version License Contributors Issues Forks Stars

WoeBoost is a Python 🐍 package designed to bridge the gap between the predictive power of gradient boosting and the interpretability required in high-stakes domains such as finance, healthcare, and law. It introduces an interpretable, evidence-driven framework for scoring tasks, inspired by the principles of Weight of Evidence (WOE) and the ideas of Alan M. Turing.

🔑 Key Features

  • 🌟 Gradient Boosting with Explainability: Combines the strength of gradient boosting with the interpretability of WOE-based scoring systems.
  • 📊 Calibrated Scores: Produces well-calibrated scores essential for decision-making in regulated environments.
  • 🤖 AutoML-like Enhancements:
    • Infers monotonic relationships automatically (infer_monotonicity).
    • Supports early stopping for efficient training (enable_early_stopping).
  • 🔧 Support for Missing Values & Categorical Inputs: Handles various data types seamlessly while maintaining interpretability.
  • 🛠️ Diagnostic Toolkit:
    • Partial dependence plots.
    • Feature importance analysis.
    • Decision boundary visualization.
  • 📈 WOE Inference Maker: Provides classical WOE calculations and bin-level insights.

⚙️ How It Works

  1. 🔍 Initialization: Starts with prior log odds, representing baseline probabilities.
  2. 📈 Iterative Updates: Each boosting iteration calculates residual per each binned feature and sums residuals into total evidence (WOE), updating predictions.
  3. 🔗 Evidence Accumulation: Combines evidence from all iterations, producing a cumulative and interpretable scoring model.

🧐 Why WoeBoost?

  • 💡 Interpretability: Every model step adheres to principles familiar to risk managers and data scientists, ensuring transparency and trust.
  • ✅ Alignment with Regulatory Requirements: Calibrated and interpretable results meet the demands of high-stakes applications.
  • ⚡ Flexibility: Works seamlessly with diverse data types and bins and transforms features in parallel by default, with free-threaded Python support.

Installation ⤵

Standard Installation

Install the package using pip:

pip install woeboost

⚡ Parallelism

Features are binned and transformed in parallel on a thread pool by default — no configuration needed. The number of workers is chosen from the number of features (up to 4, or up to 8 on free-threaded Python).

from concurrent.futures import ThreadPoolExecutor

from woeboost import WoeLearner

learner = WoeLearner()  # parallel by default
learner = WoeLearner(n_tasks=8)  # explicit number of workers
learner = WoeLearner(n_tasks=1)  # sequential
learner = WoeLearner(n_tasks=8, executor_cls=ThreadPoolExecutor)  # any executor taking max_workers
print(f"Free-threading detected: {learner.is_freethreaded}")

Results are identical to sequential processing. Measured on an Apple Silicon Mac (n=200,000, 20 features, 30 boosting rounds):

Python n_tasks=1 default
3.14 (GIL) 11.1s 5.1s
3.14t (free-threaded) 11.0s 4.0s

NumPy releases the GIL inside its kernels, so most of the speedup is available on the standard build as well.

Free-Threaded Python (Experimental)

On a free-threaded build, WoeBoost uses more workers. Note that the GIL is re-enabled at runtime if an extension module does not declare free-threading support (is_freethreaded reflects the runtime state); set PYTHON_GIL=0 to override.

uv python install 3.14t
PYTHON_GIL=0 uv run --python 3.14t --with woeboost python your_script.py

# Run free-threaded tests
./tests/run_freethreaded_tests.sh

💻 Example Usage

Below we provide two examples of using WoeBoost.

Training and Inference with WoeBoost classifier

from woeboost import WoeBoostClassifier

# Initialize the classifier
woe_model = WoeBoostClassifier(infer_monotonicity=True)

# Fit the model
woe_model.fit(X_train, y_train)

# Predict probabilities and scores
probas = woe_model.predict_proba(X_test)[:, 1]
preds = woe_model.predict(X_test)
scores = woe_model.predict_score(X_test)

Preparation of WOE inputs for logistic regression

from woeboost import WoeBoostClassifier

# Initialize the classifier
woe_model = WoeBoostClassifier(infer_monotonicity=True)

# Fit the model
woe_model.fit(X_train, y_train)

X_woe_train = woe_model.transform(X_train)
X_woe_test = woe_model.transform(X_test)

📚 Documentation

📝 Changelog

For a changelog, see CHANGELOG.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for woeboost 1.2.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 woeboost 1.2.0
File Size Uploaded
woeboost-1.2.0.tar.gz 35.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for woeboost 1.2.0
File Interpreter ABI Platform
woeboost-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 62.8 kB

Release files / woeboost-1.2.0.tar.gz

Download URL woeboost-1.2.0.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3f6933092acb09c82df4774cfd597bcec8d6908f1bbf0ceac1484b0b194efa03
BLAKE2b-256 checksum
How to use checksums
61ca680fe57fd80a3a527486a5fe5d96322abdb2ea4a4642ba09affdc0d2bd1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 2, 2026.

Transparency log

Release files / woeboost-1.2.0-py3-none-any.whl

Download URL woeboost-1.2.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
031a242581f1fde555dfe52875acd493d065c6dbc7f19eb73ccd736cab3091f6
BLAKE2b-256 checksum
How to use checksums
11d1ed387419d6ae90e3d58d9b8a0bb3c7d2eb3ca1c5dd31232bde83c05ed4d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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