Definitions of loss function, predictions, gradient, Hessian for binary classification


I am searching for the code chunks with the definitions of

logistic loss
Hessian matrix
used by xgboost in its Python implementation available at (*)

I can derive the above formulae analytically using the original paper by Chen and Guestrin (available at ), but I need a deep dive into code.

Can somebody point out the location of those definition in (*)? After a quick search I found nothing.


The Python package is only a wrapper. Please refer to the core C++ codebase.


Thank you Philip; could you kindly point me out the location of the aforementioned C++ code?
I found some .h files under

Any suggestion would save me much time: thank you.


You may want to generate Doxygen doc, by running “make doxygen”


Thank you Philip, could you please briefly elaborate your answer? I thank you.