Home | News | Documentation | Download

Error while training CNN in TMVA

Hi,
I am trying to implement a simple CNN in TMVA. I have 2 TTree objects sig_tree;1 and bkg_tree;1. When I try to train them after I write factory.TrainAllMethods();, I get this error -

Factory                  : Train all methods
                         : Building event vectors for type 2 Signal
                         : Dataset[dataset] :  create input formulas for tree sig_tree
<FATAL>                         : Expression var_0 could not be resolved to a valid formula. 
***> abort program execution

Error in <TTreeFormula::Compile>:  Bad numerical expression : "var_0"

As far as I know when I do sig_tree;1->ls(), I do not get anything as “var_0”. Do i change some variable name? Please Help

Regards
Pulkit Gera

Hi,

The problem is that the expression passed in TMVA when adding a variable must match the branch name in the TTree.
Note that in case of the Tree containing a collection (an array of floats or a std::vector ) you can use the new function available from ROOT 6.20, DataLoader::AddVariablesArray, see

https://root.cern.ch/doc/master/classTMVA_1_1DataLoader.html#a068fefb7d74208ed4b6bba8e842f1293

Lorenzo