XGBoost

Machine Learning
Introduced by
Chen, T. & Guestrin, C.
Year
2016
Type
Ensemble (gradient-boosted decision trees)

What does it do?

XGBoost (Extreme Gradient Boosting) is a scalable tree-boosting system introduced by Tianqi Chen and Carlos Guestrin in 2016.

It builds a predictor by adding decision trees one at a time, with each new tree fitted to reduce the errors that the ensemble still makes. The original paper reports that data scientists have used it widely to obtain state-of-the-art results on many machine learning challenges.

The intuition behind the method

Rather than growing independent trees and averaging them, XGBoost adds trees in sequence, and each new tree is fitted to reduce the error that the current ensemble still makes. The objective also includes a penalty on tree complexity, which discourages the trees from simply memorising the training data.

History

XGBoost was introduced by Tianqi Chen and Carlos Guestrin in the 2016 paper 'XGBoost: A Scalable Tree Boosting System', published in the Proceedings of the ACM SIGKDD conference. The paper combines regularised gradient boosting of decision trees with a scalable implementation that includes a sparsity-aware algorithm and a weighted quantile sketch for approximate tree learning. Its wide use by data scientists in machine learning challenges is noted in the paper's abstract.

When to use it

Consider XGBoost for supervised classification or prediction on tabular data, where features may be continuous, categorical, binary or count, and predictive accuracy is the main goal. It makes no normality assumption about the features. Sample size matters: with small samples, boosted trees are more prone to overfitting, and a simpler model such as logistic regression or a single decision tree may generalise more reliably. Avoid XGBoost when a compact, directly readable model is required, or when the data are too few to tune its several hyperparameters.

Limitations and considerations

  • An additive ensemble of many trees cannot be read as a single set of rules, so interpreting it relies on post hoc attribution tools.
  • Several hyperparameters, including the number of boosting rounds and the regularisation settings, usually need cross-validated tuning, and small samples leave too little data to tune them reliably.
  • With small samples, the boosted ensemble is more likely to overfit, and its cross-validated estimates can vary widely; repeated cross-validation helps show how stable they are.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Accurate predictions on tabular data, which the original paper links to its use in many machine learning challenges.
  • The regularised objective penalises tree complexity explicitly, giving a direct mechanism for limiting overfitting.
  • The sparsity-aware algorithm for sparse data allows the model to handle absent entries without a separate preprocessing step.
  • The paper describes design choices for scale (cache access patterns, data compression and sharding) and reports scaling beyond billions of examples.

Applications

  • Classification and prediction on tabular datasets with many features of mixed types.
  • Risk scoring and prediction tasks on continuous, categorical, binary and count features.
  • Large-scale prediction problems, where the paper's scalability design is relevant.
  • Modelling problems with sparse or partly missing inputs, where its sparsity-aware handling applies.

How it works

How it works

1

XGBoost is a gradient-boosting method that combines many decision trees into one additive ensemble. Trees are added one after another. Each new tree is fitted to the pseudo-residuals of the current ensemble, which are the negative gradient of the loss with respect to the current predictions (for squared-error loss, the residuals between observed targets and current predictions). XGBoost is gradient boosting with an added regularisation term on tree complexity.

2

The model minimises an objective with two parts: a loss term that measures how well predictions match the observed targets, and a regularisation term Ω(f_k) that penalises the complexity of each tree. Because the penalty is part of the objective, complexity is traded off against fit during fitting. The exact form of Ω(f_k) is given in the original paper and is not reproduced here; the regularisation settings that the user tunes control the strength of this penalty.

Formula
\mathcal{L} = \sum_i l(\hat{y}_i, y_i) + \sum_k \Omega(f_k)
3

At boosting round t, the prediction for each observation is the previous prediction plus the output of a newly fitted tree f_t. The new tree is chosen to lower the objective, so each round corrects part of the error the ensemble still makes.

Formula
\hat{y}_i^{(t)} = \hat{y}_i^{(t-1)} + f_t(x_i)
4

The final prediction is the sum of the outputs of all fitted trees, and it is used for classification or for predicting a continuous target. The original paper describes a sparsity-aware algorithm for sparse input data, which is the mechanism that lets the model process absent entries directly.

Common pitfalls

  • Applying it to very small samples, where boosted trees tend to overfit and cross-validated estimates are unstable.
  • Keeping default hyperparameters instead of tuning the number of boosting rounds and the regularisation settings by cross-validation.
  • Treating the sparsity-aware handling of gaps as a substitute for checking why values are missing, and leaving categorical encoding unexamined.
  • Reusing the same data for tuning and for the final performance estimate, rather than holding out a test set that is not used during tuning.

Frequently asked questions

How much data does XGBoost need?

No fixed minimum is established for this method. With small samples, gradient boosting is more prone to overfitting and cross-validation results become less stable, so a simpler model such as logistic regression or a single decision tree may be more dependable.

Does XGBoost require normally distributed data?

No. It makes no normality assumption and works with continuous, categorical, binary and count features. The practical requirements are enough data and careful feature preparation.

How is XGBoost different from Random Forest?

Random Forest grows trees independently and averages them. XGBoost grows trees sequentially, with each tree correcting the errors of the previous ones, and it adds a regularisation penalty on tree complexity. It has more hyperparameters to set, and its results depend on how they are tuned.

How do I interpret an XGBoost model?

Because the model is an ensemble of many trees, contributions are usually examined with feature-attribution analysis such as SHAP, alongside test-set metrics such as RMSE or AUC and cross-validated hyperparameter tuning.

Related methods

Sources

  1. Chen, T. & Guestrin, C. (2016). XGBoost: A Scalable Tree Boosting System. Proceedings of the 22nd ACM SIGKDD, 785–794.

    Open DOI reference