# Problem TMVA with binary Inputs

**URL:** <https://root-forum.cern.ch/t/problem-tmva-with-binary-inputs/24752>\
**Category:** TMVA\
**Created:** [May 13, 2017, 10:10am UTC](https://root-forum.cern.ch/t/problem-tmva-with-binary-inputs/24752 "2017-05-13T10:10:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon\_esteban](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/6bbea6/32.png) [@jon\_esteban](https://root-forum.cern.ch/u/jon_esteban)\
**Post date:** [May 13, 2017, 10:10am UTC](https://root-forum.cern.ch/t/problem-tmva-with-binary-inputs/24752/1 "2017-05-13T10:10:57Z")

</div>

Hi,

I’m using TMVA in order to classify people who have or not a heart disease.

As inputs I have many variables such as age, heart rate, sex etc…  
The problem is that if I introduce sex which is a binary variable (0,1) I get the next error:

 ![](https://root-forum.cern.ch/uploads/default/original/2X/f/f590a27dfd342c0d38ab49f6e549012f07278a33.png)

The number of intances is the same for background and signal (120). Besides, if I replace le sex with another non binary variable but discontinous (chest pain [0 , 4]) it works fine.

Am I doing something wrong or TMVA doesn’t accept binary variables as inputs?

I have modified the TMVAClassification.C macro.

Thank you in advance.

---

<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 15, 2017, 7:45am UTC](https://root-forum.cern.ch/t/problem-tmva-with-binary-inputs/24752/2 "2017-05-15T07:45:18Z")

</div>

Hi,

Have you tries to input the binary variable as a float one , which can take only 0 or 1 values ?

Lorenzo

---

<div class="post-metadata">

**Author:** ![jon\_esteban](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/6bbea6/32.png) [@jon\_esteban](https://root-forum.cern.ch/u/jon_esteban)\
**Post date:** [May 15, 2017, 8:10am UTC](https://root-forum.cern.ch/t/problem-tmva-with-binary-inputs/24752/3 "2017-05-15T08:10:58Z")

</div>

Hi,

No, I have tried with an Integer like this:  
 ![](https://root-forum.cern.ch/uploads/default/original/2X/a/a36e6312eec20e3e60effbb7e93b3ce6cf512d4a.png)

And sex variable gets 1 for a men and 0 for a woman.

Thanks!

---

<div class="post-metadata">

**Author:** ![mwojtas](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mwojtas](https://root-forum.cern.ch/u/mwojtas)\
**Post date:** [May 15, 2017, 8:16am UTC](https://root-forum.cern.ch/t/problem-tmva-with-binary-inputs/24752/4 "2017-05-15T08:16:15Z")

</div>

Hi,

Did you check how this variable is defined in your tree (if you are loading data through TTree)?

Maks

---

<div class="post-metadata">

**Author:** ![jon\_esteban](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/6bbea6/32.png) [@jon\_esteban](https://root-forum.cern.ch/u/jon_esteban)\
**Post date:** [May 15, 2017, 8:26am UTC](https://root-forum.cern.ch/t/problem-tmva-with-binary-inputs/24752/5 "2017-05-15T08:26:49Z")

</div>

Apparently it’s ok. I’ve used le TBrowser and I obtain this for the background:

![](https://root-forum.cern.ch/uploads/default/original/2X/c/c85aa8f2d1e0ebd2ba76770bca185707f45eb4c3.png)

And If I use instead the variable painChest which can take (0,1,2,3) then it works fine.

Jon
