Gradient in Gradient Boosting - Cross Validated most recent 30 from stats.stackexchange.com 2019-07-16T16:59:21Z https://stats.stackexchange.com/feeds/question/338658 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://stats.stackexchange.com/q/338658 1 Gradient in Gradient Boosting karthik prasanna https://stats.stackexchange.com/users/136556 2018-04-04T23:21:45Z 2018-04-13T15:08:24Z <p>I know the basic overview of how gradient boosting trees work but i am finding it hard to figure out the use of gradient in gradient boosting. My questions may seem stupid but it would be great if anyone can help me out !. So my question is</p> <p>What exactly is the use of gradient in gradient boosting ?</p> <p>P.S : It would be even more helpful if someone can explain me with less math</p> https://stats.stackexchange.com/questions/338658/-/340376#340376 3 Answer by DiveIntoML for Gradient in Gradient Boosting DiveIntoML https://stats.stackexchange.com/users/136661 2018-04-13T15:08:24Z 2018-04-13T15:08:24Z <p>In short answer, the gradient here refers to the gradient of loss function, and it is the target value for each new tree to predict.</p> <p>Suppose you have a true value $y$ and a predicted value $\hat{y}$. The predicted value is constructed from some existing trees. Then you are trying to construct the next tree which gives a prediction $z$. Then your final prediction will be $\hat{y}+z$. The correct choice of $z$ is $z = y - \hat{y}$. Therefore, you are now constructing trees to predict $y - \hat{y}$.</p> <p>It turns out this is a special case of gradient boosting when your loss function is $L = \frac{1}{2} (y - \hat{y})^2$, and your prediction target for this new tree is the gradient of this loss function as $y - \hat{y} = - \frac{\partial L}{\partial \hat{y}}$. </p> <p>In a more formal definition, if you already have a prediction $\hat{y}$, and you are trying to add a new prediction $z$ from a new tree to it, then the loss function can be expanded by Taylor's expansion near $\hat{y}$ as $$L = L_0 + \frac{\partial L}{\partial \hat{y}} z$$ With the spirit of gradient descent, we want $z$ to be along negative gradient direction, hence $z \sim - \frac{\partial L}{\partial \hat{y}}$. </p> <p>In that way, you set the target response to be predicted by new tree. All that is left to do is to construct a tree, so that the output of the tree on each input data is the negative gradient.</p>