# Monte Carlo event weights in BDT

**URL:** <https://root-forum.cern.ch/t/monte-carlo-event-weights-in-bdt/36023>\
**Category:** TMVA\
**Created:** [September 13, 2019, 5:53pm UTC](https://root-forum.cern.ch/t/monte-carlo-event-weights-in-bdt/36023 "2019-09-13T17:53:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anprodri](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/8dc957/32.png) [@anprodri](https://root-forum.cern.ch/u/anprodri)\
**Post date:** [September 13, 2019, 5:53pm UTC](https://root-forum.cern.ch/t/monte-carlo-event-weights-in-bdt/36023/1 "2019-09-13T17:53:25Z")

</div>

Hello!

I’m training a BDT and a DNN with real data and some Monte Carlo simulated data. As real data has weight equal to 1, and simulated data has weights bigger or smaller than 1, I was wondering how could I include this weights into the model trainings. For BDT I could take them in as weights for the trees, or as initial weights for each event? And for DNN, could the weights be incorporated as initial weights too?

I would really appreciate your guidance.

Thank you in advance.  
Have a nice weekend!

---

<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:** [September 16, 2019, 7:46am UTC](https://root-forum.cern.ch/t/monte-carlo-event-weights-in-bdt/36023/2 "2019-09-16T07:46:14Z")

</div>

Hi

TMVA provides support for both DNN and BDT of single event weights. You need just to call the function `DataLoader::SetSignalWeightExpression` for the signal tree and `DataLoader::SetBackgroundWeightExpression` for the background tree. You can see example in the tutorial, ``TMVAClassification.C`  
[https://root.cern.ch/doc/master/TMVAClassification\_8C.html](https://root.cern.ch/doc/master/TMVAClassification_8C.html)

Lorenzo

`

---

<div class="post-metadata">

**Author:** ![anprodri](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/8dc957/32.png) [@anprodri](https://root-forum.cern.ch/u/anprodri)\
**Post date:** [September 26, 2019, 3:29pm UTC](https://root-forum.cern.ch/t/monte-carlo-event-weights-in-bdt/36023/3 "2019-09-26T15:29:49Z")

</div>

> [@moneta](#):
>
> SetSignalWeightExpression

Thanks for the answer.

So if I understand well, `dataloader->SetBackgroundWeightExpression( "weight" )` takes the variable “weight” from the signal tree?

I really apprecciate your help.

Kind regards.

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [September 26, 2019, 5:41pm UTC](https://root-forum.cern.ch/t/monte-carlo-event-weights-in-bdt/36023/4 "2019-09-26T17:41:18Z")

</div>

Indeed, it is so.

Cheers,  
Kim
