Belle II Software  release-06-00-14
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  };
55 
60  class TrivialTeacher : public Teacher {
61 
62  public:
68  TrivialTeacher(const GeneralOptions& general_options, const TrivialOptions& specific_options);
69 
74  virtual Weightfile train(Dataset& training_data) const override;
75 
76  private:
78  };
79 
84  class TrivialExpert : public MVA::Expert {
85 
86  public:
91  virtual void load(Weightfile& weightfile) override;
92 
97  virtual std::vector<float> apply(Dataset& test_data) const override;
98 
99  private:
101  };
102 
103  }
105 }
106 #endif
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
Definition: Dataset.h:31
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:97
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:84
TrivialOptions m_specific_options
Method specific options.
Definition: Trivial.h:100
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this expert onto a dataset.
Definition: Trivial.cc:63
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Definition: Trivial.cc:58
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
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: Trivial.cc:36
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism to load Options from a xml tree.
Definition: Trivial.cc:20
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism to store Options in a xml tree.
Definition: Trivial.cc:30
Teacher for the Trivial MVA method.
Definition: Trivial.h:60
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:45
TrivialOptions m_specific_options
Method specific options.
Definition: Trivial.h:77
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Definition: Trivial.cc:49
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.