Belle II Software  release-05-02-19
Combination.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Keck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 #ifndef INCLUDE_GUARD_BELLE2_MVA_COMBINATION_HEADER
13 #define INCLUDE_GUARD_BELLE2_MVA_COMBINATION_HEADER
14 
15 #include <mva/interface/Options.h>
16 #include <mva/interface/Teacher.h>
17 #include <mva/interface/Expert.h>
18 
19 
20 namespace Belle2 {
25  namespace MVA {
26 
31 
32  public:
37  virtual void load(const boost::property_tree::ptree& pt) override;
38 
43  virtual void save(boost::property_tree::ptree& pt) const override;
44 
48  virtual po::options_description getDescription() override;
49 
53  virtual std::string getMethod() const override { return "Combination"; }
54 
55  std::vector<std::string> m_weightfiles;
57  };
58 
62  class CombinationTeacher : public Teacher {
63 
64  public:
70  CombinationTeacher(const GeneralOptions& general_options, const CombinationOptions& specific_options);
71 
76  virtual Weightfile train(Dataset& training_data) const override;
77 
78  private:
80  };
81 
85  class CombinationExpert : public MVA::Expert {
86 
87  public:
92  virtual void load(Weightfile& weightfile) override;
93 
98  virtual std::vector<float> apply(Dataset& test_data) const override;
99 
100  private:
102  std::vector<std::unique_ptr<Expert>> m_experts;
103  std::vector<std::vector<std::string>> m_expert_variables;
104  };
105 
106 
107  }
109 }
110 
111 #endif
Belle2::MVA::CombinationOptions::getDescription
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: Combination.cc:56
Belle2::MVA::CombinationTeacher::CombinationTeacher
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:66
Belle2::MVA::CombinationExpert
Expert for the Combination MVA method.
Definition: Combination.h:85
Belle2::MVA::CombinationTeacher::m_specific_options
CombinationOptions m_specific_options
Method specific options.
Definition: Combination.h:79
Belle2::MVA::CombinationTeacher
Teacher for the Combination MVA method.
Definition: Combination.h:62
Belle2::MVA::Dataset
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
Definition: Dataset.h:34
Belle2::MVA::Weightfile
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:40
Belle2::MVA::CombinationExpert::m_experts
std::vector< std::unique_ptr< Expert > > m_experts
Experts of the methods to combine.
Definition: Combination.h:102
Belle2::MVA::CombinationExpert::m_expert_variables
std::vector< std::vector< std::string > > m_expert_variables
Results of the experts to combine.
Definition: Combination.h:103
Belle2::MVA::CombinationOptions::save
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism to store Options in a xml tree.
Definition: Combination.cc:47
Belle2::MVA::SpecificOptions
Specific Options, all mehtod Options have to inherit from this class.
Definition: Options.h:99
Belle2::MVA::CombinationTeacher::train
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Definition: Combination.cc:70
Belle2::MVA::CombinationExpert::m_specific_options
CombinationOptions m_specific_options
Method specific options.
Definition: Combination.h:101
Belle2::MVA::CombinationExpert::load
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Definition: Combination.cc:87
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MVA::Teacher
Abstract base class of all Teachers Each MVA library has its own implementation of this class,...
Definition: Teacher.h:31
Belle2::MVA::CombinationOptions
Options for the Combination MVA method.
Definition: Combination.h:30
Belle2::MVA::CombinationExpert::apply
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this expert onto a dataset.
Definition: Combination.cc:115
Belle2::MVA::Expert
Abstract base class of all Expert Each MVA library has its own implementation of this class,...
Definition: Expert.h:33
Belle2::MVA::GeneralOptions
General options which are shared by all MVA trainings.
Definition: Options.h:64
Belle2::MVA::CombinationOptions::m_weightfiles
std::vector< std::string > m_weightfiles
Weightfiles of all methods we want to combine.
Definition: Combination.h:55
Belle2::MVA::CombinationOptions::getMethod
virtual std::string getMethod() const override
Return method name.
Definition: Combination.h:53
Belle2::MVA::CombinationOptions::load
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism to load Options from a xml tree.
Definition: Combination.cc:31