# TMVA: \*\*\* Break \*\*\* floating point exception

**URL:** <https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019>\
**Category:** TMVA\
**Created:** [August 13, 2023, 6:47pm UTC](https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019 "2023-08-13T18:47:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenith378](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zenith378/32/31705_2.png) [@zenith378](https://root-forum.cern.ch/u/zenith378)\
**Post date:** [August 13, 2023, 6:47pm UTC](https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019/1 "2023-08-13T18:47:45Z")

</div>

Dear all,  
I am getting started with TMVA and I would like to use the library to perform a regression.  
I started with the example posted [here](https://root.cern.ch/doc/v626/TMVARegression_8C.html) and I modified just the data loading part, according to the [this guide](https://root.cern.ch/download/doc/tmva/TMVAUsersGuide.pdf), importing my trees and defining my own variables.  
However, when I launch the code with

```auto
root -l Regression.C\(\"LD\"\)   

```

i get this break

```auto
 ***Break*** floating point exception
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libTMVA.so] TMVA::Factory::EvaluateAllMethods() (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] cling::Interpreter::EvaluateInternal(std:: __1::basic_string<char, std::__ 1::char_traits<char>, std::__1::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCling.so] TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libCore.so] TApplication::ExecuteFile(char const*, int*, bool) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libRint.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/lib/root/libRint.so] TRint::Run(bool) (no debug info)
[/usr/local/Cellar/root/6.26.06_1/bin/root.exe] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
[<unknown binary>] (no debug info)

```

anyone know what this may be about?  
I am pretty sure that the data are read correctly. In fact, before breaking, the terminal prints

```auto
Processing Regression.C("LD")...

==> Start TMVARegression
DataSetInfo : [dataset] : Added class "Regression"
                         : Add Tree Events of type Regression with 120 events
                         : Add Tree Events of type Regression with 60 events
                         : Dataset[dataset] : Class index : 0 name : Regression
Factory : Booking method: LD
                         : 
                         : Rebuilding Dataset dataset
                         : Building event vectors for type 2 Regression
                         : Dataset[dataset] : create input formulas for tree Events
                         : Building event vectors for type 2 Regression
                         : Dataset[dataset] : create input formulas for tree Events
DataSetFactory : [dataset] : Number of events in input trees
                         : 
                         : Dataset[dataset] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
                         : Dataset[dataset] : such that the effective (weighted) number of events in each class is the same 
                         : Dataset[dataset] : (and equals the number of events (entries) given for class=0 )
                         : Dataset[dataset] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
                         : Dataset[dataset] : ... (note that N_j is the sum of TRAINING events
                         : Dataset[dataset] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
                         : Number of training and testing events
                         : ---------------------------------------------------------------------------
                         : Regression -- training events : 90
                         : Regression -- testing events : 90
                         : Regression -- training and testing events: 180
                         : 
DataSetInfo : Correlation matrix (Regression):
                         : ------------------------------------------------------------------------------------------------
                         : var0 var1 var2 var3 var4 var5 var6 var7 var8 var9 var10
                         : var0: +1.000 +0.804 +0.886 -0.738 +0.261 +0.707 +0.681 +0.328 +0.016 -0.547 +0.412
                         : var1: +0.804 +1.000 +0.722 -0.544 +0.159 +0.482 +0.543 +0.071 -0.055 -0.575 +0.340
                         : var2: +0.886 +0.722 +1.000 -0.760 +0.161 +0.656 +0.551 +0.428 +0.051 -0.475 +0.383
                         : var3: -0.738 -0.544 -0.760 +1.000 -0.161 -0.742 -0.572 -0.423 -0.074 +0.467 -0.309
                         : var4: +0.261 +0.159 +0.161 -0.161 +1.000 +0.231 +0.187 +0.066 +0.038 -0.399 +0.007
                         : var5: +0.707 +0.482 +0.656 -0.742 +0.231 +1.000 +0.636 +0.335 +0.318 -0.594 +0.174
                         : var6: +0.681 +0.543 +0.551 -0.572 +0.187 +0.636 +1.000 +0.088 -0.137 -0.662 +0.273
                         : var7: +0.328 +0.071 +0.428 -0.423 +0.066 +0.335 +0.088 +1.000 +0.218 +0.079 +0.091
                         : var8: +0.016 -0.055 +0.051 -0.074 +0.038 +0.318 -0.137 +0.218 +1.000 -0.169 -0.062
                         : var9: -0.547 -0.575 -0.475 +0.467 -0.399 -0.594 -0.662 +0.079 -0.169 +1.000 -0.067
                         : var10: +0.412 +0.340 +0.383 -0.309 +0.007 +0.174 +0.273 +0.091 -0.062 -0.067 +1.000
                         : ------------------------------------------------------------------------------------------------
DataSetFactory : [dataset] :  
                         : 
Factory : Train all methods
Factory : [dataset] : Create Transformation "I" with events from all classes.
                         : 
                         : Transformation, Variable selection : 
                         : Input : variable 'var0' <---> Output : variable 'var0'
                         : Input : variable 'var1' <---> Output : variable 'var1'
                         : Input : variable 'var2' <---> Output : variable 'var2'
                         : Input : variable 'var3' <---> Output : variable 'var3'
                         : Input : variable 'var4' <---> Output : variable 'var4'
                         : Input : variable 'var5' <---> Output : variable 'var5'
                         : Input : variable 'var6' <---> Output : variable 'var6'
                         : Input : variable 'var7' <---> Output : variable 'var7'
                         : Input : variable 'var8' <---> Output : variable 'var8'
                         : Input : variable 'var9' <---> Output : variable 'var9'
                         : Input : variable 'var10' <---> Output : variable 'var10'
TFHandler_Factory : Variable Mean RMS [Min Max]
                         : ----------------------------------------------------------------
                         : var0: -0.057679 2.5936 [-5.5329 5.0246]
                         : var1: 0.027936 1.2102 [-2.5351 2.9997]
                         : var2: 0.0084515 1.9054 [-3.6979 4.6488]
                         : var3: -0.026050 1.5284 [-4.3699 2.8655]
                         : var4: 0.021139 0.68203 [-1.6571 1.8524]
                         : var5: -0.070058 1.8907 [-4.6620 3.5739]
                         : var6: 0.029494 1.5309 [-4.1873 2.8429]
                         : var7: -0.052540 1.1189 [-2.7408 2.9460]
                         : var8: -0.081144 0.95387 [-3.1831 2.1269]
                         : var9: 0.17206 1.8121 [-4.0339 3.8083]
                         : var10: -0.017553 0.89433 [-1.7938 2.0392]
                         : nominal_z: 23.333 74.312 [-120.00 120.00]
                         : ----------------------------------------------------------------
                         : Ranking input variables (method unspecific)...
IdTransformation : Ranking result (top variable is best ranked)
                         : ---------------------------------------------
                         : Rank : Variable : |Correlation with target|
                         : ---------------------------------------------
                         : 1 : var0 : 7.638e-01
                         : 2 : var1 : 6.973e-01
                         : 3 : var9 : 6.913e-01
                         : 4 : var2 : 6.765e-01
                         : 5 : var6 : 6.534e-01
                         : 6 : var5 : 6.486e-01
                         : 7 : var3 : 6.425e-01
                         : 8 : var10 : 3.103e-01
                         : 9 : var4 : 2.535e-01
                         : 10 : var7 : 1.416e-01
                         : 11 : var8 : 1.245e-01
                         : ---------------------------------------------
IdTransformation : Ranking result (top variable is best ranked)
                         : --------------------------------------
                         : Rank : Variable : Mutual information
                         : --------------------------------------
                         : 1 : var0 : -1.000e+00
                         : 2 : var1 : -1.000e+00
                         : 3 : var2 : -1.000e+00
                         : 4 : var3 : -1.000e+00
                         : 5 : var4 : -1.000e+00
                         : 6 : var5 : -1.000e+00
                         : 7 : var6 : -1.000e+00
                         : 8 : var7 : -1.000e+00
                         : 9 : var8 : -1.000e+00
                         : 10 : var9 : -1.000e+00
                         : 11 : var10 : -1.000e+00
                         : --------------------------------------
IdTransformation : Ranking result (top variable is best ranked)
                         : -------------------------------------
                         : Rank : Variable : Correlation Ratio
                         : -------------------------------------
                         : 1 : var0 : -1.000e+00
                         : 2 : var1 : -1.000e+00
                         : 3 : var2 : -1.000e+00
                         : 4 : var3 : -1.000e+00
                         : 5 : var4 : -1.000e+00
                         : 6 : var5 : -1.000e+00
                         : 7 : var6 : -1.000e+00
                         : 8 : var7 : -1.000e+00
                         : 9 : var8 : -1.000e+00
                         : 10 : var9 : -1.000e+00
                         : 11 : var10 : -1.000e+00
                         : -------------------------------------
IdTransformation : Ranking result (top variable is best ranked)
                         : -----------------------------------------
                         : Rank : Variable : Correlation Ratio (T)
                         : -----------------------------------------
                         : 1 : var0 : -1.000e+00
                         : 2 : var1 : -1.000e+00
                         : 3 : var2 : -1.000e+00
                         : 4 : var3 : -1.000e+00
                         : 5 : var4 : -1.000e+00
                         : 6 : var5 : -1.000e+00
                         : 7 : var6 : -1.000e+00
                         : 8 : var7 : -1.000e+00
                         : 9 : var8 : -1.000e+00
                         : 10 : var9 : -1.000e+00
                         : 11 : var10 : -1.000e+00
                         : -----------------------------------------
Factory : Train method: LD for Regression
                         : 
LD : Results for LD coefficients:
                         : -----------------------
                         : Variable: Coefficient:
                         : -----------------------
                         : var0: -10.346
                         : var1: -8.443
                         : var2: +1.887
                         : var3: +7.122
                         : var4: +1.631
                         : var5: +0.202
                         : var6: -3.974
                         : var7: +2.205
                         : var8: -7.079
                         : var9: +12.393
                         : var10: -4.578
                         : (offset): +20.567
                         : -----------------------
                         : Elapsed time for training with 90 events: 0.000389 sec         
                         : Dataset[dataset] : Create results for training
                         : Dataset[dataset] : Evaluation of LD on training sample
                         : Dataset[dataset] : Elapsed time for evaluation of 90 events: 0.00285 sec       
                         : Create variable histograms
                         : Create regression target histograms
                         : Create regression average deviation
                         : Results created
                         : Creating xml weight file: dataset/weights/TMVARegression_LD.weights.xml
Factory : Training finished
                         : 
Factory : === Destroy and recreate all methods via weight files for testing ===
                         : 
                         : Reading weight file: dataset/weights/TMVARegression_LD.weights.xml
Factory : Test all methods
Factory : Test method: LD for Regression performance
                         : 
                         : Dataset[dataset] : Create results for testing
                         : Dataset[dataset] : Evaluation of LD on testing sample
                         : Dataset[dataset] : Elapsed time for evaluation of 90 events: 0.00233 sec       
                         : Create variable histograms
                         : Create regression target histograms
                         : Create regression average deviation
                         : Results created
Factory : Evaluate all methods
                         : Evaluate regression method: LD
                         : TestRegression (testing)
                         : Calculate regression for all events

```

and it seems to break when my code run EvaluateAllMethods().

Thanks in advance for the hints!

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [August 14, 2023, 6:58am UTC](https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019/2 "2023-08-14T06:58:34Z")

</div>

Maybe @moneta can take a look. And note we might need a reproducer

---

<div class="post-metadata">

**Author:** ![zenith378](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zenith378/32/31705_2.png) [@zenith378](https://root-forum.cern.ch/u/zenith378)\
**Post date:** [August 14, 2023, 8:56am UTC](https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019/3 "2023-08-14T08:56:14Z")

</div>

Here are the necessary files.

[Regression.C](https://root-forum.cern.ch/uploads/short-url/7Pn2MQwbixHKHD7icYbDF4XKPnw.C) (12.5 KB)  
[test\_pca.root](https://root-forum.cern.ch/uploads/short-url/hZRqx2qNYeRyHYvjnGXZPesN8mR.root) (17.0 KB)  
[train\_pca.root](https://root-forum.cern.ch/uploads/short-url/71Urt6dLvJQlpfqYTJHnYdBXvjC.root) (8.7 KB)

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![zenith378](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zenith378/32/31705_2.png) [@zenith378](https://root-forum.cern.ch/u/zenith378)\
**Post date:** [August 19, 2023, 10:59am UTC](https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019/4 "2023-08-19T10:59:55Z")

</div>

Quick update: I think the problem is the same as the one reported in [this issue](https://root-forum.cern.ch/t/evaluateallmethods-fails-when-either-the-train-or-the-test-sample-is-less-than-100/55834). In fact, I am trying to train my models with just 72 events. When I try to use TMVA with a dataset containing more events, I do not have this problem.

I am using ROOT 6.26/06 (so it’s not really that old, and I cannot further update due to my OS), and I was wondering if the problem has been really fixed in ROOT 6.28.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [August 19, 2023, 5:09pm UTC](https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019/5 "2023-08-19T17:09:00Z")

</div>

Let’s hope that @moneta find some time for you

---

<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:** [August 23, 2023, 12:15pm UTC](https://root-forum.cern.ch/t/tmva-break-floating-point-exception/56019/6 "2023-08-23T12:15:19Z")

</div>

Hi,  
I don’t have any problem running in ROOT master. I think it should work also in 6.28, if not please let me know

Lorenzo
