Belle II Software  release-05-02-19
TMVAExpert Class Referenceabstract

Expert for the TMVA MVA method. More...

#include <TMVA.h>

Inheritance diagram for TMVAExpert:
Collaboration diagram for TMVAExpert:

Public Member Functions

virtual void load (Weightfile &weightfile) override
 Load the expert from a Weightfile. More...
 
virtual std::vector< float > apply (Dataset &test_data) const =0
 Apply this expert onto a dataset. More...
 
virtual std::vector< float > apply (Dataset &test_data, const unsigned int classID) const
 Apply this expert onto a dataset. More...
 

Protected Attributes

std::unique_ptr< TMVA::Reader > m_expert
 TMVA::Reader pointer.
 
std::vector< float > m_input_cache
 Input Cache for TMVA::Reader: Otherwise we would have to set the branch addresses in each apply call.
 
std::vector< float > m_spectators_cache
 Spectators Cache for TMVA::Reader: Otherwise we would have to set the branch addresses in each apply call.
 
GeneralOptions m_general_options
 General options loaded from the weightfile.
 

Detailed Description

Expert for the TMVA MVA method.

Definition at line 297 of file TMVA.h.

Member Function Documentation

◆ apply() [1/2]

virtual std::vector<float> apply ( Dataset test_data) const
pure virtualinherited

◆ apply() [2/2]

virtual std::vector<float> apply ( Dataset test_data,
const unsigned int  classID 
) const
inlinevirtualinherited

Apply this expert onto a dataset.

Multi-class mode signature. Not pure virtual, since not all derived classes need to re-implement this.

Parameters
test_datadataset
classIDclass identifier.

Reimplemented in TMVAExpertMulticlass.

Definition at line 59 of file Expert.h.

◆ load()

void load ( Weightfile weightfile)
overridevirtual

Load the expert from a Weightfile.

Parameters
weightfilecontaining all information necessary to build the expert

Implements Expert.

Reimplemented in TMVAExpertRegression, TMVAExpertMulticlass, and TMVAExpertClassification.

Definition at line 446 of file TMVA.cc.

449  {
450  m_expert->AddVariable(Belle2::makeROOTCompatible(general_options.m_variables[i]), &m_input_cache[i]);
451  }
452  m_spectators_cache.resize(general_options.m_spectators.size(), 0);
453  for (unsigned int i = 0; i < general_options.m_spectators.size(); ++i) {
454  m_expert->AddSpectator(Belle2::makeROOTCompatible(general_options.m_spectators[i]), &m_spectators_cache[i]);
455  }
456 
457  if (weightfile.containsElement("TMVA_Logfile")) {
458  std::string custom_weightfile = weightfile.generateFileName("logfile");
459  weightfile.getFile("TMVA_Logfile", custom_weightfile);
460  }
461 
462  }
463 
464  void TMVAExpertClassification::load(Weightfile& weightfile)
465  {
466 
467  weightfile.getOptions(specific_options);
468  if (specific_options.transform2probability) {
469  expert_signalFraction = weightfile.getSignalFraction();
470  }

The documentation for this class was generated from the following files:
Belle2::MVA::TMVAExpertClassification::load
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Definition: TMVA.cc:472
Belle2::MVA::TMVAExpert::m_spectators_cache
std::vector< float > m_spectators_cache
Spectators Cache for TMVA::Reader: Otherwise we would have to set the branch addresses in each apply ...
Definition: TMVA.h:311
Belle2::makeROOTCompatible
std::string makeROOTCompatible(std::string str)
Remove special characters that ROOT dislikes in branch names, e.g.
Definition: MakeROOTCompatible.cc:74
Belle2::MVA::TMVAExpert::m_input_cache
std::vector< float > m_input_cache
Input Cache for TMVA::Reader: Otherwise we would have to set the branch addresses in each apply call.
Definition: TMVA.h:309
Belle2::MVA::TMVAExpert::m_expert
std::unique_ptr< TMVA::Reader > m_expert
TMVA::Reader pointer.
Definition: TMVA.h:307