I went through the explanation here ( http://blog.kaggle.com/2017/01/23/a-kaggle-master-explains-gradient-boosting/), but don't understand why the new trees in gradient boosting try to predict he gradient of loss function instead of actual residual ( y-y^). And is my understanding right that the first tree uses (as its prediction) a simple constant value to approximate true values , like a median for all the y.

Also, another question is how does it work for classification.

Can anyone please explain the statement made below, in detail if possible, in here Understanding gradient boosting

"In general, gradient boosting, when used for classification, fits trees not on the level of the gradient of predicted probabilities, but to the gradient of the predicted log-odds."

  • $\begingroup$ you can use mathjax for math typesetting. more information: math.meta.stackexchange.com/questions/5020/… $\endgroup$
    – Sycorax
    Commented Aug 7, 2019 at 17:05
  • $\begingroup$ @Matthew Drury can you please answer this $\endgroup$
    – tjt
    Commented Aug 7, 2019 at 17:11

1 Answer 1


For (half) squared error loss the negative gradient is the residual. In general, a tree is fit to the gradient in order to avoid overfitting, since the loss $L(y_i,\hat{y}_i)$ can be made arbitrarily small if we constantly add to $\hat{y}_i$ the (scaled) negative gradient of $L(\cdot)$ wrt $\hat{y}_i$. The additive expansion of trees (boosting) stops when the test error has settled in.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.