# Loss functions for BDTG

**URL:** <https://root-forum.cern.ch/t/loss-functions-for-bdtg/52125>\
**Category:** TMVA\
**Created:** [October 27, 2022, 8:24pm UTC](https://root-forum.cern.ch/t/loss-functions-for-bdtg/52125 "2022-10-27T20:24:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smitmatt](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/smitmatt/32/26905_2.png) [@smitmatt](https://root-forum.cern.ch/u/smitmatt)\
**Post date:** [October 27, 2022, 8:24pm UTC](https://root-forum.cern.ch/t/loss-functions-for-bdtg/52125/1 "2022-10-27T20:24:17Z")

</div>

Good afternoon,

I have two questions concerning the loss functions used for the Gradient Boosted Decision Tree TMVA method.

1. What is the default loss function used?  
This post [here](https://root-forum.cern.ch/t/how-gradient-decent-implemented-in-bdtg-model/33374) pretty clearly states it is cross-entropy. However, page 68 of the TMVA User guide states the default for all TMVA implimentations of GradientBoost is the binomial log-likelihood loss. Thank you in advance for the clarification!

2. Is it possible to define a custom loss function for use in BDTG training? [this presentation](https://indico.cern.ch/event/779121/contributions/3241955/attachments/1765603/2866457/TMVASeminarPitt.pdf) suggests on slide 20 that it is possible for regression problems. If so, pointing me towards a practical example of how to do so would be greatly appreciated. For context, i require the use of a modified cross-entropy loss function that would still be differentiable.

Thanks again,

Matt

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [October 28, 2022, 8:02am UTC](https://root-forum.cern.ch/t/loss-functions-for-bdtg/52125/2 "2022-10-28T08:02:02Z")

</div>

Hi,

- The loss used for classification is the cross-entropy, which is a binomial log-likelihood loss. So what stated in the documentation is correct.
- For regression you have the choice of several loss functions, teh default is the Huber loss function, (see [here](https://en.wikipedia.org/wiki/Huber_loss)) and you can optionally uses also a Least Square function or AbsoluteDeviation. I think is not possible to provide a user defined function. It is maybe some functionality that we could add if requested

Best regards

Lorenzo
