Error while training CNN in TMVA

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

Pulkit Gera


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


@moneta @darthgera123 I am also facing the same issue with training of CNN in TMVA.

This the notebook where i faced the same error in factory.TrainAllMethods() method. I even used DataLoader::AddVariablesArray method,but still this error was not resolved.

@darthgera123 can you please suggest how did you resolve this issue.

The error reported indicates that the input Tree does not contain that variable. You should check the input content, by calling Three::Print before using it in TMVA