Belle II Software  release-08-01-10
Combination.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 #ifndef INCLUDE_GUARD_BELLE2_MVA_COMBINATION_HEADER
11 #define INCLUDE_GUARD_BELLE2_MVA_COMBINATION_HEADER
12 
13 #include <mva/interface/Options.h>
14 #include <mva/interface/Teacher.h>
15 #include <mva/interface/Expert.h>
16 
17 
18 namespace Belle2 {
23  namespace MVA {
24 
29 
30  public:
35  virtual void load(const boost::property_tree::ptree& pt) override;
36 
41  virtual void save(boost::property_tree::ptree& pt) const override;
42 
46  virtual po::options_description getDescription() override;
47 
51  virtual std::string getMethod() const override { return "Combination"; }
52 
53  std::vector<std::string> m_weightfiles;
55  };
56 
60  class CombinationTeacher : public Teacher {
61 
62  public:
68  CombinationTeacher(const GeneralOptions& general_options, const CombinationOptions& specific_options);
69 
74  virtual Weightfile train(Dataset& training_data) const override;
75 
76  private:
78  };
79 
83  class CombinationExpert : public MVA::Expert {
84 
85  public:
90  virtual void load(Weightfile& weightfile) override;
91 
96  virtual std::vector<float> apply(Dataset& test_data) const override;
97 
98  private:
100  std::vector<std::unique_ptr<Expert>> m_experts;
101  std::vector<std::vector<std::string>> m_expert_variables;
102  };
103 
104 
105  }
107 }
108 
109 #endif
Expert for the Combination MVA method.
Definition: Combination.h:83
std::vector< std::unique_ptr< Expert > > m_experts
Experts of the methods to combine.
Definition: Combination.h:100
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this expert onto a dataset.
Definition: Combination.cc:105
CombinationOptions m_specific_options
Method specific options.
Definition: Combination.h:99
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Definition: Combination.cc:77
std::vector< std::vector< std::string > > m_expert_variables
Results of the experts to combine.
Definition: Combination.h:101
Options for the Combination MVA method.
Definition: Combination.h:28
virtual std::string getMethod() const override
Return method name.
Definition: Combination.h:51
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: Combination.cc:46
std::vector< std::string > m_weightfiles
Weightfiles of all methods we want to combine.
Definition: Combination.h:53
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism to load Options from a xml tree.
Definition: Combination.cc:21
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism to store Options in a xml tree.
Definition: Combination.cc:37
Teacher for the Combination MVA method.
Definition: Combination.h:60
CombinationTeacher(const GeneralOptions &general_options, const CombinationOptions &specific_options)
Constructs a new teacher using the GeneralOptions and specific options of this training.
Definition: Combination.cc:56
CombinationOptions m_specific_options
Method specific options.
Definition: Combination.h:77
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Definition: Combination.cc:60
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
Definition: Dataset.h:33
Abstract base class of all Expert Each MVA library has its own implementation of this class,...
Definition: Expert.h:31
General options which are shared by all MVA trainings.
Definition: Options.h:62
Specific Options, all method Options have to inherit from this class.
Definition: Options.h:98
Abstract base class of all Teachers Each MVA library has its own implementation of this class,...
Definition: Teacher.h:29
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:38
Abstract base class for different kinds of events.