XGBoost

XGBoost – eXtreme Gradient Boosting

An optimised gradient boosting trees library, one of the strongest options for tabular data, with GPU and distributed training support.

ActiveMediumv3.4.1Apache-2.0Machine Learning Frameworks & Libraries

Official documentationTry the examples

Basic information

NameXGBoost
Full nameXGBoost – eXtreme Gradient Boosting
CategoryMachine Learning Frameworks & Libraries
DeveloperThe DMLC community
Release year2014
Official websitexgboost.readthedocs.io/en/stable
GitHub repositorydmlc/xgboost
Official documentationxgboost.readthedocs.io/en/stable
Package on PyPIxgboost
LicenseApache-2.0 (PyPI license_expression)
Project statusActive Had a release in the last 12 months
Latest version15 August 2026 (version 3.4.1)
Programming languageC++, Python, R, JVM
Operating systemsOS Independent (as declared by the package on PyPI)
Required Python version>=3.12
Difficulty levelMedium

Data last checked: 21 November 2026 — source: PyPI JSON API (2026-11-21)

Overview

XGBoost builds an ensemble of decision trees sequentially, each tree correcting the errors of the previous ones, with regularization, missing-value handling and fast split algorithms, and runs on CPUs and GPUs.

It is widely used in tabular data competitions and in industry, and integrates with scikit-learn through a compatible API and with SHAP to explain decisions.

When to choose it? Choose it for tabular data when you need high accuracy and GPU support; compare LightGBM and CatBoost alongside it.

Uses

Main uses

  • Classification and regression on tabular data
  • Ranking
  • Strong baselines for structured data

Scientific fields

  • Finance
  • Medicine
  • Marketing and industry

Suitable project types

  • Risk prediction
  • Fraud detection
  • Predicting patient readmission
  • Predicting patient readmission

Research applications

  • Comparing deep models with strong baselines on tabular data
  • Comparing deep models with strong baselines on tabular data

Gradient boosting treesClassical machine learning

Technical features

A feature is shown as "Supported" only if it is documented in the library's official documentation; anything we have not verified is shown as "Not specified".

CPU supportSupported
GPU supportSupported
CUDA compatibilitySupported
Distributed training or computingSupportedThrough Dask, Spark and Ray according to the documentation.
Automatic differentiation (Autodiff)Not supported
Model deploymentSupportedSaves the model in its own format or JSON, with external conversion tools.
Pre-trained modelsNot applicable
Supported data typesDense and sparse matrices, pandas tables, categorical features supported
Integration with other librariesScikit-learn, Pandas, Dask, SHAP, Optuna
Flexibility (editorial estimate)Medium
Performance (editorial estimate)High
Community (editorial estimate)Very large
Documentation quality (editorial estimate)Good documentation

Installation and running

Shell
pip install xgboost

Compatibility: Python >=3.12 — according to the package data on PyPI, checked on 21 November 2026

Compatibility: Python >=3.12 — according to the package data on PyPI, checked on 21 November 2026

Installing inside a virtual environment (venv or conda) is recommended. If you need compatibility with a specific CUDA version or operating system, refer to the official documentation, because this information changes with every release.

Code examples

Examples marked "Run and tested" were actually run, with their output, test date and library versions recorded; the others need a GPU or model downloads, so they were not run in the test environment.

MediumXGBoost with early stoppingRun and tested

Goal: Stopping the addition of trees when the validation set stops improving.

Python — example.py
import xgboost as xgb
from sklearn.datasets import load_breast_cancer
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split

X, y = load_breast_cancer(return_X_y=True)
X_tr, X_va, y_tr, y_va = train_test_split(X, y, test_size=0.25, stratify=y, random_state=0)
model = xgb.XGBClassifier(n_estimators=500, learning_rate=0.05, max_depth=3,
                          early_stopping_rounds=20, eval_metric="logloss", random_state=0)
model.fit(X_tr, y_tr, eval_set=[(X_va, y_va)], verbose=False)
print("Best number of trees:", model.best_iteration + 1)
print(f"Validation AUC: {roc_auc_score(y_va, model.predict_proba(X_va)[:, 1]):.4f}")

Code explanation

We pass a validation set to fit and set early_stopping_rounds, so training stops after 20 rounds without improvement and the best number of trees is saved in best_iteration.

Requirements

Shell
pip install xgboost scikit-learn

How to run

Save the code in a file example.py then run it:

Shell
python example.py

Output recorded during testing

Best number of trees: 116
Validation AUC: 0.9795

This example was actually run and tested on 21 November 2026 on a CPU — xgboost 3.4.1, scikit-learn 1.9.1, python 3.13.18

Example page

All XGBoost examples in the Code Explorer

Pros

  • High accuracy on tabular data
  • GPU and distributed training support
  • Handles missing values

Limitations

  • Many hyperparameters that need tuning
  • Less suited to raw images and text

References and verification

  • Package page on PyPI (source of the version, licence and release date) Checked directly

    https://pypi.org/project/xgboost/

    Checked on: 21 November 2026 — version checked: 3.4.1 — reviewed by: the DLArabic team

  • Official website A link the package officially declares on PyPI

    https://xgboost.readthedocs.io/en/stable/

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official documentation A link the package officially declares on PyPI

    https://xgboost.readthedocs.io/en/stable/

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official repository A link the package officially declares on PyPI

    https://github.com/dmlc/xgboost

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Package page on PyPI (source of the version, licence and release date) Checked directly

    https://pypi.org/project/xgboost/

    Checked on: 21 November 2026 — version checked: 3.4.1 — reviewed by: the DLArabic team

  • Official website A link the package officially declares on PyPI

    https://xgboost.readthedocs.io/en/stable/

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official documentation A link the package officially declares on PyPI

    https://xgboost.readthedocs.io/en/stable/

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official repository A link the package officially declares on PyPI

    https://github.com/dmlc/xgboost

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

History of verified versions

VersionRelease dateChecked on
3.4.115 August 202621 November 2026

Page information last reviewed: 21 November 2026. The description was written originally for the encyclopedia and is not copied from the official websites.

Report information that needs updating