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

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.2.2
File Size Uploaded Provenance
rxgb-0.2.2.tar.gz 10.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 18.8 kB

Release files / rxgb-0.2.2.tar.gz

Download URL rxgb-0.2.2.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eccdaa355791c6b28e2b42c6e7074459553833bc65c7027614f4cdd5bacf5daf
BLAKE2b-256 checksum
How to use checksums
22f2d8b6ef5aec5653124b8d556c694c389394069ddcc6f6a66b4a35b8036013
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.2.2-py3-none-any.whl

Download URL rxgb-0.2.2-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c929c6ba0fe09e0757e7141a7828f142d94a1a7e9e2b2eddf2f753462360e13
BLAKE2b-256 checksum
How to use checksums
2e69a32f296717b7f89fa0a4cd05938b7a43b0e04bed01784faba3e476649814
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.2.2

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