Belle II Software  release-08-01-10
Trivial.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_TRIVIAL_HEADER
11 #define INCLUDE_GUARD_BELLE2_MVA_TRIVIAL_HEADER
12 
13 #include <mva/interface/Options.h>
14 #include <mva/interface/Teacher.h>
15 #include <mva/interface/Expert.h>
16 
17 namespace Belle2 {
22  namespace MVA {
23 
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 "Trivial"; }
52 
53  double m_output = 0.5;
54  std::vector<double> m_multiple_output = {};
55  bool m_passthrough = false;
56  };
57 
62  class TrivialTeacher : public Teacher {
63 
64  public:
70  TrivialTeacher(const GeneralOptions& general_options, const TrivialOptions& specific_options);
71 
76  virtual Weightfile train(Dataset& training_data) const override;
77 
78  private:
80  };
81 
86  class TrivialExpert : public MVA::Expert {
87 
88  public:
93  virtual void load(Weightfile& weightfile) override;
94 
99  virtual std::vector<float> apply(Dataset& test_data) const override;
100 
105  virtual std::vector<std::vector<float>> applyMulticlass(Dataset& test_data) const override;
106 
107  private:
109  };
110 
111  }
113 }
114 #endif
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
Expert for the Trivial MVA method.
Definition: Trivial.h:86
TrivialOptions m_specific_options
Method specific options.
Definition: Trivial.h:108
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this expert onto a dataset.
Definition: Trivial.cc:83
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Definition: Trivial.cc:77
virtual std::vector< std::vector< float > > applyMulticlass(Dataset &test_data) const override
Apply this expert onto a dataset.
Definition: Trivial.cc:102
Options for the Trivial MVA method.
Definition: Trivial.h:28
double m_output
Output of the trivial method.
Definition: Trivial.h:53
virtual std::string getMethod() const override
Return method name.
Definition: Trivial.h:51
std::vector< double > m_multiple_output
Output of the trivial method.
Definition: Trivial.h:54
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: Trivial.cc:49
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism to load Options from a xml tree.
Definition: Trivial.cc:20
bool m_passthrough
Flag for passthrough setting.
Definition: Trivial.h:55
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism to store Options in a xml tree.
Definition: Trivial.cc:38
Teacher for the Trivial MVA method.
Definition: Trivial.h:62
TrivialTeacher(const GeneralOptions &general_options, const TrivialOptions &specific_options)
Constructs a new teacher using the GeneralOptions and specific options of this training.
Definition: Trivial.cc:64
TrivialOptions m_specific_options
Method specific options.
Definition: Trivial.h:79
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Definition: Trivial.cc:68
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.