# nTrain\_, nTest\_ randomly picked in each process sample for N\>1 background processes?

**URL:** <https://root-forum.cern.ch/t/ntrain-ntest-randomly-picked-in-each-process-sample-for-n-1-background-processes/31716>\
**Category:** TMVA\
**Created:** [November 22, 2018, 7:35am UTC](https://root-forum.cern.ch/t/ntrain-ntest-randomly-picked-in-each-process-sample-for-n-1-background-processes/31716 "2018-11-22T07:35:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmilesi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@mmilesi](https://root-forum.cern.ch/u/mmilesi)\
**Post date:** [November 22, 2018, 7:35am UTC](https://root-forum.cern.ch/t/ntrain-ntest-randomly-picked-in-each-process-sample-for-n-1-background-processes/31716/1 "2018-11-22T07:35:56Z")

</div>

Hello,

say that in a binary classifcation I am adding trees for different processes (i.e., describing different physics processes) to the background sample:

```auto

dataloader.AddSignalTree(treeS, 1.0)
dataloader.AddBackgroundTree(treeBkg1, 1.0)
dataloader.AddBackgroundTree(treeBkg2, 1.0)
dataloader.AddBackgroundTree(treeBkg3, 1.0)

```

If I set the`SplitMode=Random` option, and set a number for `nTrain(Test)_Signal` and `nTrain(Test)_Background`, will it be ensured that the subsample of training(testing) events will be chosen randomly among the various background processes trees? Or is there anything else I should take care of?

Thanks!

Marco

---

<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:** [November 22, 2018, 12:02pm UTC](https://root-forum.cern.ch/t/ntrain-ntest-randomly-picked-in-each-process-sample-for-n-1-background-processes/31716/2 "2018-11-22T12:02:44Z")

</div>

Hi,

Using `nTrain(Test)_Signal(Background)` with `SplitMode=Random` will sample from the signal and background classes uniformly, yes. You don’t have to do anything else 🙂

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![mmilesi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@mmilesi](https://root-forum.cern.ch/u/mmilesi)\
**Post date:** [November 22, 2018, 10:42pm UTC](https://root-forum.cern.ch/t/ntrain-ntest-randomly-picked-in-each-process-sample-for-n-1-background-processes/31716/3 "2018-11-22T22:42:31Z")

</div>

Ahh, good to hear that 🙂

Cheers,

Marco
