liveBook · Manning

Gamma objective

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

A gamma objective is a regression loss objective based on the gamma response distribution for strictly positive, typically right-skewed targets.

A gamma objective is a regression loss for strictly positive, right-skewed targets: many small values and a few substantially larger ones. It is useful when ordinary linear regression does not capture the target’s distribution or relationships. section 7.2.4

In an XGBoost regressor, configure it as objective='reg:gamma'. A first model using this objective produced only positive predictions, approximately halved baseline MAE, and reached an R-squared score near 0.7 on cross-validation. section 7.2.4

First XGBoost model

An XGBRegressor combines booster='gbtree', objective='reg:gamma', 300 estimators, and max_depth=6. Cross-validation then checks prediction range, R-squared, RMSE, and MAE; the reported MAE is 7,227.435 and R-squared is 0.693.

Treat gamma as one candidate rather than an automatic choice. Hyperparameter optimization can compare squared error, gamma, and Tweedie objectives; the reported best configuration selected Tweedie instead, suggesting that the broader target behavior may favor another distribution. section 7.2.5

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Defines the distributional fit and demonstrates configuration and cross-validation, but defers mathematical derivation and detailed loss mechanics.
Examples
Uses an XGBRegressor, positive prediction ranges, regression metrics, and Optuna comparisons among squared-error, gamma, and Tweedie objectives.
What it assumes
Assumes regression modeling and baseline evaluation, while establishing why positive, right-skewed targets require distribution-aware objectives.
What you can do after
Apply it via XGBoost and evaluate positive predictions with cross-validated MAE, RMSE, and R-squared.
How it connects
Connects gamma regression with XGBoost, cross-validation, Tweedie objectives, Poisson distributions, and squared-error regression.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.