# Usage of the BDTG standalone C++ class from TMVA

**URL:** <https://root-forum.cern.ch/t/usage-of-the-bdtg-standalone-c-class-from-tmva/29348>\
**Category:** TMVA\
**Created:** [June 13, 2018, 12:02pm UTC](https://root-forum.cern.ch/t/usage-of-the-bdtg-standalone-c-class-from-tmva/29348 "2018-06-13T12:02:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxgiraud](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/b9bd4f/32.png) [@maxgiraud](https://root-forum.cern.ch/u/maxgiraud)\
**Post date:** [June 13, 2018, 12:02pm UTC](https://root-forum.cern.ch/t/usage-of-the-bdtg-standalone-c-class-from-tmva/29348/1 "2018-06-13T12:02:06Z")

</div>

Hello TMVA experts,

I am trying to use the BDTG standalone c++ class and having some trouble with it.  
The BDTG response is completely different when I compare it from the TMVAGUI and the autogenerated C++ class implemented in a homemade program  
Here, the TMVAGUI output on the left and the c++ class output on the right :

 ![bdtg_output_tmva_vs_homemade](https://root-forum.cern.ch/uploads/default/original/3X/4/a/4a4f84baec7a9077ec7bb1dc9d2873dd6da194c8.png)

I don’t understand the differences even so the input events are exactly the same in TMVA and my homemade program, I also tried with a Reader but I get the same result.

To investigate this, I have tried the same procedure with MLPBNN and it works fine.

Maybe is there differences in the usage of the BDTG class compared with MLPBNN one ?

Thank you for your help.

Cheers,  
Maxime

---

<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:** [June 14, 2018, 12:35pm UTC](https://root-forum.cern.ch/t/usage-of-the-bdtg-standalone-c-class-from-tmva/29348/2 "2018-06-14T12:35:38Z")

</div>

Hi,

Just to clarify; Is the output consistent between the TMVA::Reader and the stand-alone c++ class?

This would hint at a mismatch between the setups because the output when running `TrainAllMethods` and `TestAllMethods` is actually generated in a way very similar to how the Reader does it (recreating the method from the xml-file).

Notice that your plot does not include negative outputs. Could you regenerate your plot using the range -1 to 1?  
Also notice that the TMVA graph output is normalised so that the histogram sums to 1 for (i.e signal is normalised to sum to 1, and background is normalised to sum to 1.).

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![maxgiraud](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/b9bd4f/32.png) [@maxgiraud](https://root-forum.cern.ch/u/maxgiraud)\
**Post date:** [June 19, 2018, 1:38pm UTC](https://root-forum.cern.ch/t/usage-of-the-bdtg-standalone-c-class-from-tmva/29348/3 "2018-06-19T13:38:37Z")

</div>

Hi,

Thank you very much, you pointed out my silly mistake, indeed my neural net output range is [0,1] but the BDT is in the range [-1,1].  
Now that I have normalized in the good range these output are consistent.

cheers,  
Maxime

---

<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:** [June 19, 2018, 3:32pm UTC](https://root-forum.cern.ch/t/usage-of-the-bdtg-standalone-c-class-from-tmva/29348/4 "2018-06-19T15:32:08Z")

</div>

Great Maxime!

Please mark the topic as solved if indeed it is, and good luck with your machine learning 🙂

Cheers,  
Kim
