Belle II Software development
Interface< TemplateOptions, TemplateTeacher, TemplateExpert > Class Template Reference

Template class to easily construct a interface for an MVA library using a library-specific Options, Teacher and Expert class. More...

#include <Interface.h>

Inheritance diagram for Interface< TemplateOptions, TemplateTeacher, TemplateExpert >:
AbstractInterface

Public Member Functions

 Interface ()
 Constructs a new interface.
 
virtual std::unique_ptr< SpecificOptionsgetOptions () const override
 Get Options of this MVA library.
 
virtual std::unique_ptr< TeachergetTeacher (const GeneralOptions &general_options, const SpecificOptions &specific_options) const override
 Get Teacher of this MVA library.
 
virtual std::unique_ptr< MVA::ExpertgetExpert () const override
 Get Exoert of this MVA library.
 
std::string getName () const
 Returns the name of the third-party MVA library.
 

Static Public Member Functions

static std::map< std::string, AbstractInterface * > getSupportedInterfaces ()
 Returns interfaces supported by the MVA Interface.
 
static void initSupportedInterfaces ()
 Static function which initliazes all supported interfaces, has to be called once before getSupportedInterfaces can be used.
 

Private Attributes

std::string m_name
 Name of the third-party library.
 

Static Private Attributes

static std::map< std::string, AbstractInterface * > s_supported_interfaces
 Map of supported interfaces.
 

Detailed Description

template<class TemplateOptions, class TemplateTeacher, class TemplateExpert>
class Belle2::MVA::Interface< TemplateOptions, TemplateTeacher, TemplateExpert >

Template class to easily construct a interface for an MVA library using a library-specific Options, Teacher and Expert class.

Definition at line 99 of file Interface.h.

Constructor & Destructor Documentation

◆ Interface()

Interface ( )
inline

Constructs a new interface.

Definition at line 104 of file Interface.h.

104: AbstractInterface(TemplateOptions().getMethod()) { }
AbstractInterface(const std::string &name)
Creates a new Interface to a third-party library.
Definition: Interface.cc:27

Member Function Documentation

◆ getExpert()

virtual std::unique_ptr< MVA::Expert > getExpert ( ) const
inlineoverridevirtual

Get Exoert of this MVA library.

Implements AbstractInterface.

Definition at line 125 of file Interface.h.

125{ return std::unique_ptr<MVA::Expert>(new TemplateExpert); }

◆ getName()

std::string getName ( ) const
inherited

Returns the name of the third-party MVA library.

Returns
name of the third-party MVA library

Definition at line 41 of file Interface.cc.

41{ return m_name; }
std::string m_name
Name of the third-party library.
Definition: Interface.h:84

◆ getOptions()

virtual std::unique_ptr< SpecificOptions > getOptions ( ) const
inlineoverridevirtual

Get Options of this MVA library.

Implements AbstractInterface.

Definition at line 109 of file Interface.h.

109{ return std::unique_ptr<SpecificOptions>(new TemplateOptions); }

◆ getSupportedInterfaces()

static std::map< std::string, AbstractInterface * > getSupportedInterfaces ( )
inlinestaticinherited

Returns interfaces supported by the MVA Interface.

Returns
supported interfaces

Definition at line 53 of file Interface.h.

53{ return s_supported_interfaces; }
static std::map< std::string, AbstractInterface * > s_supported_interfaces
Map of supported interfaces.
Definition: Interface.h:89

◆ getTeacher()

virtual std::unique_ptr< Teacher > getTeacher ( const GeneralOptions general_options,
const SpecificOptions specific_options 
) const
inlineoverridevirtual

Get Teacher of this MVA library.

Parameters
general_optionsshared options of all libraries
specific_optionsspecific options for this library

Implements AbstractInterface.

Definition at line 116 of file Interface.h.

118 {
119 return std::unique_ptr<Teacher>(new TemplateTeacher(general_options, dynamic_cast<const TemplateOptions&>(specific_options)));
120 }

◆ initSupportedInterfaces()

void initSupportedInterfaces ( )
staticinherited

Static function which initliazes all supported interfaces, has to be called once before getSupportedInterfaces can be used.

It is save to call it multiple times

Definition at line 45 of file Interface.cc.

46 {
47 static Interface<FastBDTOptions, FastBDTTeacher, FastBDTExpert> interface_FastBDT;
48 static Interface<RegressionFastBDTOptions, RegressionFastBDTTeacher, RegressionFastBDTExpert> interface_RegressionFastBDT;
49 static Interface<FANNOptions, FANNTeacher, FANNExpert> interface_FANN;
50 static Interface<TMVAOptionsClassification, TMVATeacherClassification, TMVAExpertClassification>
51 interface_TMVAClassification;
52 static Interface<TMVAOptionsRegression, TMVATeacherRegression, TMVAExpertRegression> interface_TMVARegression;
53 static Interface<TMVAOptionsMulticlass, TMVATeacherMulticlass, TMVAExpertMulticlass> interface_TMVAMulticlass;
54 static Interface<PythonOptions, PythonTeacher, PythonExpert> interface_Python;
55 static Interface<PDFOptions, PDFTeacher, PDFExpert> interface_PDF;
56 static Interface<CombinationOptions, CombinationTeacher, CombinationExpert> interface_Combination;
57 static Interface<ReweighterOptions, ReweighterTeacher, ReweighterExpert> interface_Reweighter;
58 static Interface<TrivialOptions, TrivialTeacher, TrivialExpert> interface_Trivial;
59 }

Member Data Documentation

◆ m_name

std::string m_name
privateinherited

Name of the third-party library.

Definition at line 84 of file Interface.h.

◆ s_supported_interfaces

std::map< std::string, AbstractInterface * > s_supported_interfaces
staticprivateinherited

Map of supported interfaces.

Definition at line 89 of file Interface.h.


The documentation for this class was generated from the following file: