Response Values using Trained TMVACrossValidation_MLP


I’ve been using different TMVA models with my data and found really good signal efficiencies and background efficiencies using a MLP neural network using TMVACrossValidation. However the code below errors when reader calls EvaluateMultiClass with the error.

terminate called after throwing an instance of ‘std::out_of_range’ what(): map::at

This is also true using EvaluateMVA. I have previously used this same implementation with a TMVAClassification_BDT model and it works. Can anyone tell me how I need to change my use of reader when using TMVACrossValidation?

reader->BookMVA("TMVACrossValidation_MLP", "dataset/weight/TMVACrossValidation_BDT.weights.xml");

for (Long64_t ievt=0; ievt<data->GetEntries(); ievt++){
    var[0] = userVar[0];
    var[1] = userVar[1];
    var[2] = userVar[2];
    var[3] = userVar[3];


    BDT_Response = reader->EvaluateMulticlass("TMVACrossValidation_MLP")[0];


Hello @Unlucky,

I invite @moneta or @kialbert to help here. In the mean time, could you try to find the line where the exception is thrown?
For this, try if you get the following to work:

  • Optional, but helpful: Try to get a root version with debug symbols. I don’t know where you get ROOT from, but if it’s from cvmfs, there are often versions with dbg in the name.
  • Start gdb root.exe to attach a debugger to root. (If you are not running the evaluation from within ROOT, attach gdb to the executable you are running).
  • Type catch throw to catch all exceptions.
  • Type start, and start running your macro / script / executable.
  • When it stops because the execption is thrown, type bt to get a backtrace. Post this here.