Skip to main content

RXGB — Random eXtreme Gradient Boosting

Python License: MIT PyPI version

RXGB is a robust ensemble framework that combines Random Forest-style bagging with depth-constrained XGBoost learners. It is specifically designed to improve prediction robustness and performance on challenging tabular datasets, including noisy, imbalanced, and complex data.

Overview

RXGB wraps multiple independent XGBoost models in a bagging-style ensemble. Each base learner is trained using a randomized sample of rows and features, and the ensemble combines their predictions.

The design brings together two powerful concepts:

  • Boosting (XGBoost): Builds trees sequentially within each base learner to capture complex relationships and reduce bias.
  • Bagging (Random Forest): Trains independent base learners on different samples and feature subsets to drastically reduce prediction variance.

Why RXGB and not standard XGBoost?

Standard XGBoost is highly sensitive to noise and can easily overfit on small, complex datasets. RXGB solves this by placing XGBoost inside a bagging architecture. By averaging the probabilities of multiple independent XGBoost models, RXGB simultaneously reduces bias and variance. Our benchmarks show that RXGB consistently outperforms standard XGBoost and Random Forest on difficult datasets, offering a superior balance of performance and computational efficiency.

How It Works

RXGB uses two levels of model construction:

  1. Row subsampling: Each base learner trains on a randomized sample of the training rows (controlled by max_samples).
  2. Feature subsampling: Each base learner uses a randomized subset of input features (controlled by max_features).
  3. Independent XGBoost learners: Each base learner fits its own boosted-tree model (controlled by inner_n_estimators and max_depth).
  4. Ensemble prediction: For classification, the base learners' predicted probabilities are combined using soft voting.

Unlike a single XGBoost model, RXGB combines predictions from multiple independently trained models. This parallel independence is what prevents overfitting on noisy data and stabilizes performance on imbalanced classes.

Installation

Install RXGB from PyPI:

pip install rxgb

Quick Start

from rxgb import RXGBClassifier
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score

# 1. Create a challenging synthetic dataset (noisy)
X, y = make_classification(
    n_samples=2000, n_features=20, n_informative=15,
    flip_y=0.15, random_state=42
)

# 2. Split the data
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, random_state=42, stratify=y
)

# 3. Initialize and train RXGB
clf = RXGBClassifier(n_estimators=25, max_depth=4, random_state=42)
clf.fit(X_train, y_train)

# 4. Predict and evaluate
predictions = clf.predict(X_test)
print(f"Accuracy: {accuracy_score(y_test, predictions):.4f}")

Performance Benchmarks

We evaluated RXGB against industry-standard models across five challenging datasets, including imbalanced, noisy, high-dimensional data, and the Pima Indians Diabetes dataset.

Model Average F1-score Average training time Configuration
RXGB (Ours) 0.8438 4.9 s Default parameters (no tuning)
LightGBM 0.8564 2.8 s Tuned via GridSearch
CatBoost 0.8561 10.8 s Tuned via GridSearch
XGBoost 0.8422 6.1 s Tuned via GridSearch
Random Forest 0.8375 3.9 s Tuned via GridSearch

Note: RXGB achieves a highly competitive F1-score without any hyperparameter tuning, outperforming a heavily optimized XGBoost while being significantly faster to train than CatBoost.

Parameters

Parameter Default Description
n_estimators 25 Number of independent XGBoost base learners in the ensemble.
max_depth 4 Maximum tree depth used by each base learner.
learning_rate 0.1 Learning rate used by each XGBoost base learner.
inner_n_estimators 50 Number of boosting rounds inside each XGBoost base learner.
max_samples 0.8 Fraction of training samples drawn for each base learner.
max_features 0.8 Fraction of input features selected for each base learner.
dynamic_weighting True If True, uses a meta-learner (Attention) to dynamiclly weight predictions. Recommended for noisy data.
n_jobs None Number of parallel jobs; -1 requests all available processors.
random_state 42 Random seed for reproducibility.

Documentation and Source Code

The repository contains the full source code, automated tests (PyTest), and reproducible benchmark scripts.

Citation

If you use RXGB in your research, please cite the work:

@article{nouri2026rxgb,
  title   = {RXGB: A Bagging Ensemble of Shallow XGBoost Learners for Classification},
  author  = {Nouri, Kiarash},
  journal = {Journal of Machine Learning Research (Under Review)},
  year    = {2026}
}

License

RXGB is distributed under the MIT License. See the LICENSE file for the full license text.

Metadata

Release files for rxgb 0.3.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 rxgb 0.3.0
File Size Uploaded Provenance
rxgb-0.3.0.tar.gz 11.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 20.7 kB

Release files / rxgb-0.3.0.tar.gz

Download URL rxgb-0.3.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5771849b6997d8f9820d48e5affe4d200ed9dc8579164adc62b6f1116686774f
BLAKE2b-256 checksum
How to use checksums
bedd227a5076938a2c4d9febfe4fa33c0de446bb9d6c5cd636096cb2c43fc0e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rxgb-0.3.0-py3-none-any.whl

Download URL rxgb-0.3.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8d2ddc1a5ffee9ab57763b6932b53b9098114a6b0398279041d3d98be2122d6
BLAKE2b-256 checksum
How to use checksums
0353ded198dc3e3e208a2b9fd5674e07313b34dd69a9ee7a96209b3f7c0312b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for rxgb 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

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