Modify TMVAClassification.C

Hello ROOT forum, good evening

I (am still beginner in TMVA he) want to use classification methods (ANN and BDT), so I already have generated the correspondent file .root, and I have ROOT 6.12.04 and I am trying to modify the code of the macro TMVAClassification.C, but I don’t understand this part:

line 210…
// Define the input variables that shall be used for the MVA training
// note that you may also use variable expressions, such as: “3var1/var2abs(var3)”
// [all types of expressions that can also be parsed by TTree::Draw( “expression” )]
dataloader->AddVariable( “myvar1 := var1+var2”, ‘F’ );
dataloader->AddVariable( “myvar2 := var1-var2”, “Expression 2”, “”, ‘F’ );
dataloader->AddVariable( “var3”, “Variable 3”, “units”, ‘F’ );
dataloader->AddVariable( “var4”, “Variable 4”, “units”, ‘F’ );

// You can add so-called “Spectator variables”, which are not used in the MVA training,
// but will appear in the final “TestTree” produced by TMVA. This TestTree will contain the
// input variables, the response values of all trained MVAs, and the spectator variables

dataloader->AddSpectator( “spec1 := var12", “Spectator 1”, “units”, ‘F’ );
dataloader->AddSpectator( "spec2 := var1
3”, “Spectator 2”, “units”, ‘F’ );

I suppose that var1, var2, var3, var4, are the physical input parameters. It is correct? What mean variables myvar1, myvar 2,spec1, spec2…? Are they really necessary to achieve a classification?

Thanks for your attention,


1 Like

The input variables (features) used for classifications are those defined in AddVariable, i.e.
myvar1, myvar2, var3 and var4.
Some of them can be functions of other variables defined in the input TTree file.

As written in the comment the spectator variables are not used, they can be defined if one wants to have them in the output file produced.

Best Regards