# Issue with MVA and NaN Values

**URL:** <https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038>\
**Category:** TMVA\
**Tags:** tmva\
**Created:** [November 8, 2023, 6:34pm UTC](https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038 "2023-11-08T18:34:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![asmaa.aboulhorma](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@asmaa.aboulhorma](https://root-forum.cern.ch/u/asmaa.aboulhorma)\
**Post date:** [November 8, 2023, 6:34pm UTC](https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038/1 "2023-11-08T18:34:14Z")

</div>

Hello everyone,

I’m facing a problem with my code for limit calculations. I have a dataset with variables m, pt, eta, and phi, I’m applying some BDT scores from TMVA training.  
The issue I’m encountering is as follows:  
 : 2-th variable of the event is NaN → return MVA value -999,  
 : that’s all I can do, please fix or remove this event.  
I’m getting this error for different variables in different events. It seems that some of my variables are becoming NaN, and this is causing the MVA value to be set to -999. This behavior is unexpected and is affecting the accuracy of my calculations.  
i have scanned all my root file and non of them have a NAN value.

If anyone has encountered a similar issue or has any insights into why this might be happening, I would be incredibly grateful for your help.

Thank you in advance for your assistance!

---

<div class="post-metadata">

**Author:** ![Eddy\_Offermann](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eddy_offermann/32/25079_2.png) [@Eddy\_Offermann](https://root-forum.cern.ch/u/Eddy_Offermann)\
**Post date:** [November 8, 2023, 9:18pm UTC](https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038/2 "2023-11-08T21:18:29Z")

</div>

Hi @asmaa.aboulhorma , great to see you on the forum.

I am not sure how large your data set is but a fast way to check  
input data is to calculate the mean and variance of each column. If those  
numbers are finite, none of your input will be NaN.

-Eddy

---

<div class="post-metadata">

**Author:** ![asmaa.aboulhorma](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@asmaa.aboulhorma](https://root-forum.cern.ch/u/asmaa.aboulhorma)\
**Post date:** [November 8, 2023, 9:34pm UTC](https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038/3 "2023-11-08T21:34:07Z")

</div>

hi @Eddy_Offermann, Thank you for your feed back.  
I have checked my tree by scanning each column, and it seems to be normal. I also thought that maybe the problem was because my tree had double and the training used float. I just converted my tree variable to float but still have the same problem.

---

<div class="post-metadata">

**Author:** ![Eddy\_Offermann](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eddy_offermann/32/25079_2.png) [@Eddy\_Offermann](https://root-forum.cern.ch/u/Eddy_Offermann)\
**Post date:** [November 8, 2023, 9:47pm UTC](https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038/4 "2023-11-08T21:47:46Z")

</div>

Did you scan by looking at the values or doing an operation with them ?

---

<div class="post-metadata">

**Author:** ![asmaa.aboulhorma](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@asmaa.aboulhorma](https://root-forum.cern.ch/u/asmaa.aboulhorma)\
**Post date:** [November 8, 2023, 10:39pm UTC](https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038/5 "2023-11-08T22:39:11Z")

</div>

I scaned by looking looking at the values

---

<div class="post-metadata">

**Author:** ![asmaa.aboulhorma](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@asmaa.aboulhorma](https://root-forum.cern.ch/u/asmaa.aboulhorma)\
**Post date:** [November 15, 2023, 9:54pm UTC](https://root-forum.cern.ch/t/issue-with-mva-and-nan-values/57038/6 "2023-11-15T21:54:26Z")

</div>

hi @Eddy_Offermann

I have calculated the mean and variance of each column. all of those numbers are finite. i have attached a screen of one of the outputs.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/5/1/513612b67923e0c6ef5f8559a70d2c5b5fc1f3c9.jpeg)
