Skip to content

Pseudo-Residuals

The target values for the next base model in gradient boosting: the negative derivative of the loss function with respect to the current prediction of the ensemble.

Formula

\[ r_{im}=-\left.\frac{\partial \ell(y_i,F(x_i))}{\partial F(x_i)}\right\rvert_{F=F_{m-1}}. \]

Notation:

  • \(r_{im}\) — the pseudo-residual of object \(i\) at stage \(m\);
  • \(\ell\) — the loss of a single object;
  • \(y_i\) — the true value;
  • \(F(x_i)\) — the current prediction;
  • \(F=F_{m-1}\) — the derivative is computed for the ensemble before the new model is added.

The minus sign denotes the direction in which the loss decreases: the new model shifts predictions not along the gradient, but against it.

Squared Loss: Coincidence with Residuals

For the loss \(\ell(y,F)=\frac12(y-F)^2\) the derivative with respect to the prediction is

\[ \frac{\partial \ell}{\partial F}=F-y, \]

so the pseudo-residual coincides with the ordinary residual:

\[ r_{im}=y_i-F_{m-1}(x_i). \]

This is why examples with training on residuals correctly describe gradient boosting: for squared loss there is no difference between a residual and a pseudo-residual.

Logistic Loss: Residual and Pseudo-Residual Diverge

Classification more often uses the logistic loss (binary cross-entropy). If \(p_i=\sigma(F(x_i))\) is the predicted probability of the positive class, then the derivative of the loss with respect to the prediction is \(p_i-y_i\), and the pseudo-residual is

\[ r_{im}=y_i-p_i. \]

This is no longer the difference "truth minus prediction": \(p_i\) is a probability, not the value of the target variable. The pseudo-residual shows how far the predicted probability is from the class label; the prefix "pseudo-" reflects exactly this discrepancy.

For other losses the expression is different as well: the pseudo-residual is determined by the chosen loss function, not by the formula \(y-\hat y\).

See also

← All terms