XGBoost
XGBoost is a fast, regularized gradient-boosting library that dominates tabular benchmarks through engineering and second-order optimization.
Boosting, engineered
XGBoost (extreme gradient boosting) is a widely used implementation of gradient boosting that adds explicit regularization, a second-order optimization step, and heavy systems engineering. On structured, tabular data it is a perennial top performer and a sensible default before reaching for deep networks.
What makes it different
- Regularized objective: penalizes the number of leaves and the size of leaf weights, curbing overfitting.
- Second order: uses both gradient and Hessian of the loss for a better split score.
- Sparsity-aware: learns a default direction for missing values at each split.
- Systems: parallel split-finding, cache-aware access, and out-of-core training for large data.
import xgboost as xgb
model = xgb.XGBClassifier(n_estimators=600, learning_rate=0.05,
max_depth=5, subsample=0.8, colsample_bytree=0.8,
reg_lambda=1.0, early_stopping_rounds=50)
model.fit(X_train, y_train, eval_set=[(X_val, y_val)])
Tuning that matters
The most influential knobs are learning_rate paired with n_estimators, max_depth, and the sampling fractions subsample and colsample_bytree. Regularization terms reg_lambda (L2) and reg_alpha (L1) plus min_child_weight further control complexity. Use early stopping on a validation set so the number of trees is chosen automatically.
When to use it
Reach for XGBoost on medium-sized tabular problems with mixed feature types, where it handles missing values, interactions, and nonlinearity with little preprocessing. For very large datasets LightGBM is often faster; for many categorical features CatBoost can be more convenient. All three share the boosting core; the choice is largely engineering.