Belle II Software  release-05-02-19
PDF.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_PDF_HEADER
13 #define INCLUDE_GUARD_BELLE2_MVA_PDF_HEADER
14 
15 #include <mva/interface/Options.h>
16 #include <mva/interface/Teacher.h>
17 #include <mva/interface/Expert.h>
18 #include <mva/utility/Binning.h>
19 
20 namespace Belle2 {
25  namespace MVA {
26 
27 
31  class PDFOptions : public SpecificOptions {
32 
33  public:
38  virtual void load(const boost::property_tree::ptree& pt) override;
39 
44  virtual void save(boost::property_tree::ptree& pt) const override;
45 
49  virtual po::options_description getDescription() override;
50 
54  virtual std::string getMethod() const override { return "PDF"; }
55 
56  std::string m_binning = "frequency";
57  std::string m_mode = "probability";
58  unsigned int m_nBins = 100;
60  };
61 
65  class PDFTeacher : public Teacher {
66 
67  public:
73  PDFTeacher(const GeneralOptions& general_options, const PDFOptions& specific_options);
74 
79  virtual Weightfile train(Dataset& training_data) const override;
80 
81  private:
83  };
84 
88  class PDFExpert : public MVA::Expert {
89 
90  public:
95  virtual void load(Weightfile& weightfile) override;
96 
101  virtual std::vector<float> apply(Dataset& test_data) const override;
102 
103  private:
106  std::vector<double> m_value;
107  };
108 
109 
110  }
112 }
113 
114 #endif
Belle2::MVA::PDFExpert::m_specific_options
PDFOptions m_specific_options
Specific options of the PDF method.
Definition: PDF.h:104
Belle2::MVA::PDFOptions::m_nBins
unsigned int m_nBins
number of bins used to bin the data
Definition: PDF.h:58
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::PDFTeacher::m_specific_options
PDFOptions m_specific_options
Specific options of the PDF method.
Definition: PDF.h:82
Belle2::MVA::PDFTeacher
Teacher for the PDF MVA method.
Definition: PDF.h:65
Belle2::MVA::SpecificOptions
Specific Options, all mehtod Options have to inherit from this class.
Definition: Options.h:99
Belle2::MVA::PDFOptions::getDescription
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: PDF.cc:50
Belle2::MVA::PDFTeacher::PDFTeacher
PDFTeacher(const GeneralOptions &general_options, const PDFOptions &specific_options)
Constructs a new teacher using the GeneralOptions and PDFoptions for this training.
Definition: PDF.cc:61
Belle2::MVA::PDFOptions::m_mode
std::string m_mode
mode which defines the final output e.g.
Definition: PDF.h:57
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::PDFOptions::m_binning
std::string m_binning
which type of binning is performed e.g.
Definition: PDF.h:56
Belle2::MVA::PDFOptions
Options for the PDF MVA method.
Definition: PDF.h:31
Belle2::MVA::PDFExpert::load
virtual void load(Weightfile &weightfile) override
Load the PDF expert from a Weightfile.
Definition: PDF.cc:128
Belle2::MVA::PDFExpert
Expert for the PDF MVA method.
Definition: PDF.h:88
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::PDFTeacher::train
virtual Weightfile train(Dataset &training_data) const override
Train PDF method using the given dataset returning a Weightfile.
Definition: PDF.cc:64
Belle2::MVA::PDFExpert::apply
virtual std::vector< float > apply(Dataset &test_data) const override
Apply PDF expert onto a dataset.
Definition: PDF.cc:153
Belle2::MVA::PDFOptions::load
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism (used by Weightfile) to load Options from a xml tree.
Definition: PDF.cc:29
Belle2::MVA::PDFExpert::m_binning
Binning m_binning
used binning
Definition: PDF.h:105
Belle2::MVA::Binning
Binning of a data distribution Provides PDF and CDF values of the distribution per bin.
Definition: Binning.h:29
Belle2::MVA::PDFOptions::save
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism (used by Weightfile) to store Options in a xml tree.
Definition: PDF.cc:42
Belle2::MVA::PDFExpert::m_value
std::vector< double > m_value
value returned by expert for each bin
Definition: PDF.h:106
Belle2::MVA::PDFOptions::getMethod
virtual std::string getMethod() const override
Return method name.
Definition: PDF.h:54