How to Save and Load an XGBoost Model

Saving and loading XGBoost models sounds trivial — and mostly it is — but there are enough format options, version compatibility nuances, and post-load gotchas (particularly around early stopping) to make it worth covering carefully. This guide covers every serialisation format XGBoost supports, when to use each, and what to watch out for. Format Overview … Read more

How to Use XGBoost with scikit-learn Pipelines

Wrapping XGBoost in a scikit-learn pipeline solves a problem that bites almost every ML project eventually: training-serving skew. When preprocessing steps live outside the model, it is easy for inference code to apply them slightly differently — wrong scaler, missing imputer, column order mismatch — producing silent errors that corrupt predictions without raising exceptions. A … Read more

XGBoost Multiclass Classification Guide

XGBoost handles multiclass classification with the same API as binary classification — just change the objective and let XGBoost figure out the rest. The model trains one set of trees per class (one-vs-all internally), outputs a probability for each class, and predicts the class with the highest probability. This guide covers the full workflow: training, … Read more

LightGBM for Imbalanced Classification

Imbalanced classification — fraud detection, medical diagnosis, churn prediction, rare event detection — is where default model settings fail most predictably. A model that predicts the majority class for every sample achieves 99% accuracy on a 1:99 dataset while being completely useless. LightGBM has several built-in mechanisms for imbalanced data, and combining them with the … Read more

XGBoost for Time Series Forecasting

XGBoost is not a time series model — it has no built-in understanding of temporal order, seasonality, or autocorrelation. But it becomes a powerful time series forecaster once you add that structure through feature engineering. The approach is to transform a forecasting problem into a supervised regression problem: create lag features, rolling statistics, and calendar … Read more

How to Interpret XGBoost SHAP Values

Feature importance scores built into XGBoost — gain, weight, cover — tell you which features the model used, but not how or in which direction. SHAP values do both: they assign each feature a contribution to each individual prediction, with sign indicating direction and magnitude indicating impact. The result is a local explanation you can … Read more