Belle II Software development
Reweighter.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_REWEIGHTER_HEADER
11#define INCLUDE_GUARD_BELLE2_MVA_REWEIGHTER_HEADER
12
13#include <mva/interface/Options.h>
14#include <mva/interface/Teacher.h>
15#include <mva/interface/Expert.h>
16
17
18namespace Belle2 {
23 namespace MVA {
24
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 "Reweighter"; }
52
53 std::string m_weightfile;
54 std::string m_variable;
56 };
57
61 class ReweighterTeacher : public Teacher {
62
63 public:
69 ReweighterTeacher(const GeneralOptions& general_options, const ReweighterOptions& specific_options);
70
75 virtual Weightfile train(Dataset& training_data) const override;
76
77 private:
79 };
80
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:
102 std::unique_ptr<Expert> m_expert;
103 double m_norm = 0.0;
104 };
105
106
107 }
109}
110
111#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
Expert for the Reweighter MVA method.
Definition: Reweighter.h:84
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this expert onto a dataset.
Definition: Reweighter.cc:176
std::unique_ptr< Expert > m_expert
Experts used to reweight.
Definition: Reweighter.h:102
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Definition: Reweighter.cc:154
GeneralOptions m_expert_options
Method general options of the expert.
Definition: Reweighter.h:101
ReweighterOptions m_specific_options
Method specific options.
Definition: Reweighter.h:100
double m_norm
Norm for the weights.
Definition: Reweighter.h:103
Options for the Reweighter MVA method.
Definition: Reweighter.h:28
virtual std::string getMethod() const override
Return method name.
Definition: Reweighter.h:51
std::string m_weightfile
Weightfile of the reweighting expert.
Definition: Reweighter.h:53
virtual po::options_description getDescription() override
Returns a program options description for all available options.
Definition: Reweighter.cc:40
std::string m_variable
Variable which decides if the reweighter is applied or not.
Definition: Reweighter.h:54
virtual void load(const boost::property_tree::ptree &pt) override
Load mechanism to load Options from a xml tree.
Definition: Reweighter.cc:20
virtual void save(boost::property_tree::ptree &pt) const override
Save mechanism to store Options in a xml tree.
Definition: Reweighter.cc:33
Teacher for the Reweighter MVA method.
Definition: Reweighter.h:61
ReweighterOptions m_specific_options
Method specific options.
Definition: Reweighter.h:78
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Definition: Reweighter.cc:56
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.