Belle II Software development
PDF.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_PDF_HEADER
11#define INCLUDE_GUARD_BELLE2_MVA_PDF_HEADER
12
13#include <mva/interface/Options.h>
14#include <mva/interface/Teacher.h>
15#include <mva/interface/Expert.h>
16#include <mva/utility/Binning.h>
17
18namespace Belle2 {
23 namespace MVA {
24
25
29 class PDFOptions : public SpecificOptions {
30
31 public:
36 virtual void load(const boost::property_tree::ptree& pt) override;
37
42 virtual void save(boost::property_tree::ptree& pt) const override;
43
47 virtual po::options_description getDescription() override;
48
52 virtual std::string getMethod() const override { return "PDF"; }
53
54 std::string m_binning = "frequency";
55 std::string m_mode = "probability";
56 unsigned int m_nBins = 100;
58 };
59
63 class PDFTeacher : public Teacher {
64
65 public:
71 PDFTeacher(const GeneralOptions& general_options, const PDFOptions& specific_options);
72
77 virtual Weightfile train(Dataset& training_data) const override;
78
79 private:
81 };
82
86 class PDFExpert : 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
101 private:
104 std::vector<double> m_value;
105 };
106
107
108 }
110}
111
112#endif
Binning of a data distribution Provides PDF and CDF values of the distribution per bin.
Definition: Binning.h:27
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
Expert for the PDF MVA method.
Definition: PDF.h:86
Binning m_binning
used binning
Definition: PDF.h:103
virtual std::vector< float > apply(Dataset &test_data) const override
Apply PDF expert onto a dataset.
Definition: PDF.cc:143
PDFOptions m_specific_options
Specific options of the PDF method.
Definition: PDF.h:102
std::vector< double > m_value
value returned by expert for each bin
Definition: PDF.h:104
virtual void load(Weightfile &weightfile) override
Load the PDF expert from a Weightfile.
Definition: PDF.cc:118
Options for the PDF MVA method.
Definition: PDF.h:29
virtual std::string getMethod() const override
Return method name.
Definition: PDF.h:52
unsigned int m_nBins
number of bins used to bin the data
Definition: PDF.h:56
std::string m_binning
which type of binning is performed e.g.
Definition: PDF.h:54
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: PDF.cc:40
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:19
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:32
std::string m_mode
mode which defines the final output e.g.
Definition: PDF.h:55
Teacher for the PDF MVA method.
Definition: PDF.h:63
PDFOptions m_specific_options
Specific options of the PDF method.
Definition: PDF.h:80
virtual Weightfile train(Dataset &training_data) const override
Train PDF method using the given dataset returning a Weightfile.
Definition: PDF.cc:54
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.