I'm getting only a single value from the EvaluateMVA() method in the TMVAClassificationApplication.C macro

I am performing ML tasks. I first trained and tested multiple configurations of BDTs using the TMVAClassification.C macro but when I’m trying to run my model using the TMVAClassificationApplication.C macro, I’m getting only 1 value for the entire dataset. I did make the necessary changes in the application macro.

 // --------------------------------------------------------------------------------------------------
      if (Use["BDT"          ])   histBdt1    ->Fill( reader->EvaluateMVA( "BDT-1 method"           ) );
      if (Use["BDT"          ])   histBdt2    ->Fill( reader->EvaluateMVA( "BDT-2 method"           ) );
      if (Use["BDT"          ])   histBdt3    ->Fill( reader->EvaluateMVA( "BDT-3 method"           ) );

      if (Use["BDTG"         ])   histBdtG1   ->Fill( reader->EvaluateMVA( "BDTG-1 method"          ) );
      if (Use["BDTG"         ])   histBdtG2   ->Fill( reader->EvaluateMVA( "BDTG-2 method"          ) );
      if (Use["BDTG"         ])   histBdtG3   ->Fill( reader->EvaluateMVA( "BDTG-3 method"          ) );
      // --------------------------------------------------------------------------------------------------

I think there’s some problem with filling the trees. I’m attaching the macro and the data file.

TMVAClassificationApplication.C (23.5 KB)
Data_90k.root (1.7 MB)

The weight files are as follows:

TMVAClassification_BDT-2.class.C (396.5 KB)
TMVAClassification_BDT-3.class.C (567.3 KB)
TMVAClassification_BDTG-1.class.C (1.4 MB)
TMVAClassification_BDTG-2.class.C (390.8 KB)
TMVAClassification_BDTG-3.class.C (732.2 KB)

TMVAClassification_BDT-1.class.C (450.9 KB)

Welcome to the ROOT forum

I guess @moneta can help you.

For running your code I would need the .xml files for the weigths. The .C files are to be used to evaluate the method in a standalone C++ code. See for example the TMVA Users Guide paragraph 3.4.


Sir I’m sending the files individually since ROOT Forum doesn’t allow .xml files

(Attachment TMVAClassification_BDT-1.weights.xml is missing)

(Attachment TMVAClassification_BDTG-2.weights.xml is missing)

ROOT isn’t allowing me to send.XML files. Can you please suggest me how can I send them to you?

You can try making a tar file with the xml file and upload the tar file, otherwise you can put on some share drive, like dropbox or cernbox or you can try directly by email


Sir, here is the zip file. Zip was the default format. I really appreciate your help.

Kind regards

(Attachment weights.zip is missing)

Sir, here is the link containing the zip as well as the tar file. Zip was the default format. I really appreciate your help.

Kind regards


Hi Mr. Moneta! Just wanted to follow up with my query.

Hi Mr. Moneta! Just wanted to follow up with my query. It would be really helpful if you could help me out ASAP since I need to submit my abstract this week.



There is a problem reading the input variables form the input file, since they are not stored as floating type variables. You need to convert to float before evaluating the method and set the correct type in TTree::SetBranchAddress. See my modified macro (you might want to remove some of the debug printout).
I see still a potential issue that the file will contains many inputs equal for many events and this will result in same output values.

Apologies for my delay in answering,
Best regards

TMVAClassificationApplication.C (24.0 KB)

Thank you Mr. Moneta. Your modification indeed solved the problem. Can’t thank you enough.:smile: