liveBook · Manning

Objective function

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

A loss function quantifies the discrepancy between model predictions and expected target values for optimization.

An objective function defines what model training should optimize: it quantifies prediction error and supplies the direction for improving estimates. In gradient boosting, each successive tree learns corrections from gradients, moving predictions toward the target. section 5.4.1 section 5.2.1

Choose the objective according to the prediction problem:

  • Use reg objectives for regression, binary objectives for binary classification, and multi objectives for multiclass classification. section 5.4.1
  • Use count for discrete events, survival for time-to-event analysis with censoring, and rank for ranking problems. section 5.4.1
  • Use reg:gamma or reg:tweedie when modeling distributions associated with insurance claim amounts; Poisson supports event-frequency modeling. section 5.4.1

For binary classification, reg:logistic and binary:logistic are comparable to log-loss. The objective differs from an evaluation metric: the objective drives optimization, whereas evaluation metrics assess results. section 5.4.1

Gradient boosting classifier

A compact GradientBoosting implementation computes the gradient as y_pred - y_true, initializes predictions from the target mean, and repeatedly fits trees to corrections. On Airbnb NYC data, a train/test workflow with 300 trees, learning rate 0.1, and maximum depth four reports 0.82503 accuracy.

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

How deep it goes
Explains objective selection and gradient-based corrections, but stops short of deriving the available loss functions mathematically.
Examples
Uses logistic classification, insurance claim distributions, event counts, and an Airbnb NYC gradient boosting implementation with measured accuracy.
What it assumes
Assumes familiarity with gradient descent, decision trees, model predictions, and target labels.
What you can do after
Configure XGBoost objectives for different prediction tasks and distinguish training losses from evaluation metrics.
How it connects
Connects objective functions with gradient boosting, gradient descent, evaluation metrics, Hessian matrices, and prediction-task types.

Also explained in

Compare how 30 books explain objective function →

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.