# Rarity distribution for BDT is non-uniform

**URL:** <https://root-forum.cern.ch/t/rarity-distribution-for-bdt-is-non-uniform/45070>\
**Category:** TMVA\
**Created:** [May 25, 2021, 4:53pm UTC](https://root-forum.cern.ch/t/rarity-distribution-for-bdt-is-non-uniform/45070 "2021-05-25T16:53:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuanLeite](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/juanleite/32/24439_2.png) [@JuanLeite](https://root-forum.cern.ch/u/JuanLeite)\
**Post date:** [May 25, 2021, 4:53pm UTC](https://root-forum.cern.ch/t/rarity-distribution-for-bdt-is-non-uniform/45070/1 "2021-05-25T16:53:31Z")

</div>

Hi,

I’m training a BDT Classifier to reject background events of my data sample to increase the purity. I was reading the TMVA Users Guide and in section 3.1.13 it says:

> Another useful aspect of the probability integral transformation (rarity) is the possibility to directly  
> visualise deviations of a test background (which could be physics data) from the training  
> sample, by exhibition of non-uniformity

So, I habilitate the “CreateMVAPds” flag and plotted Rarity to check. The result can be seen below.

![image](https://root-forum.cern.ch/uploads/default/original/3X/1/9/1934ff86156b553c70cd3e048821c0248c168876.png)

What does it mean? And, how can I avoid it?

I’m passing as signal an MC sample with a cut in the signal region, and for background, I’m passing the wings of mass distribution far from the signal region.

Thanks!

---

<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:** [May 28, 2021, 7:50am UTC](https://root-forum.cern.ch/t/rarity-distribution-for-bdt-is-non-uniform/45070/2 "2021-05-28T07:50:50Z")

</div>

Hi,  
It looks then that the distribution from training and test BDT output is very different. You can easily check that by plotting the output distribution train and test ( case 4b in TMVAGui)

Lorenzo

---

<div class="post-metadata">

**Author:** ![JuanLeite](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/juanleite/32/24439_2.png) [@JuanLeite](https://root-forum.cern.ch/u/JuanLeite)\
**Post date:** [May 28, 2021, 4:54pm UTC](https://root-forum.cern.ch/t/rarity-distribution-for-bdt-is-non-uniform/45070/3 "2021-05-28T16:54:20Z")

</div>

Hi Lorenzo,

Looking TMVAGui 4b option I don’t see a big difference.

![image](https://root-forum.cern.ch/uploads/default/original/3X/3/d/3db92db89f8a3f3efa84226feec083485c1c92a4.png)

---

<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:** [May 28, 2021, 6:11pm UTC](https://root-forum.cern.ch/t/rarity-distribution-for-bdt-is-non-uniform/45070/4 "2021-05-28T18:11:38Z")

</div>

Hi,  
This is very strange. Can you please share the macro and the input data file so I can try to reproduce this problem ?

Cheers

Lorenzo
