A Note About Gradients in Classification Problems

For the gradient boosting packages we have to calculate the gradient of the Loss function with respect to the marginal probabilites.

In this case, we must calculate

The Hessian is similarly calculated:

Where y-hat is the sigmoid function, unless stated otherwise:

We will make use of the following property for the calculations of the Gradients and Hessians:

Note to avoid divide-by-zero errors, we clip the values of the sigmoid such that the output of the sigmoid is bound by 10-15 from below and 1 - 10-15 from above.