Belle II Software development
TrivialOptions Class Reference

Options for the Trivial MVA method. More...

#include <Trivial.h>

Inheritance diagram for TrivialOptions:
SpecificOptions Options

Public Member Functions

virtual void load (const boost::property_tree::ptree &pt) override
 Load mechanism to load Options from a xml tree.
 
virtual void save (boost::property_tree::ptree &pt) const override
 Save mechanism to store Options in a xml tree.
 
virtual po::options_description getDescription () override
 Returns a program options description for all available options.
 
virtual std::string getMethod () const override
 Return method name.
 

Public Attributes

double m_output = 0.5
 Output of the trivial method.
 
std::vector< double > m_multiple_output = {}
 Output of the trivial method.
 
bool m_passthrough = false
 Flag for passthrough setting.
 

Detailed Description

Options for the Trivial MVA method.

Used for debugging and testing

Definition at line 28 of file Trivial.h.

Member Function Documentation

◆ getDescription()

po::options_description getDescription ( )
overridevirtual

Returns a program options description for all available options.

Implements Options.

Definition at line 49 of file Trivial.cc.

50 {
51 po::options_description description("Trivial options");
52 description.add_options()
53 ("output", po::value<double>(&m_output),
54 "Outputs this value for all predictions in binary classification (unless passthrough is enabled).");
55 description.add_options()
56 ("multiple_output", po::value<std::vector<double>>(&m_multiple_output)->multitoken(),
57 "Outputs these values for their respective classes in multiclass classification (unless passthrough is enabled).");
58 description.add_options()
59 ("passthrough", po::value<bool>(&m_passthrough),
60 "If enabled, the method returns the value of the input variable. For binary classification this option requires the presence of only one input variable. For multiclass classification we require either one input variable which is returned for all classes, or an input variable per class.");
61 return description;
62 }
double m_output
Output of the trivial method.
Definition: Trivial.h:53
std::vector< double > m_multiple_output
Output of the trivial method.
Definition: Trivial.h:54
bool m_passthrough
Flag for passthrough setting.
Definition: Trivial.h:55

◆ getMethod()

virtual std::string getMethod ( ) const
inlineoverridevirtual

Return method name.

Implements SpecificOptions.

Definition at line 51 of file Trivial.h.

51{ return "Trivial"; }

◆ load()

void load ( const boost::property_tree::ptree &  pt)
overridevirtual

Load mechanism to load Options from a xml tree.

Parameters
ptxml tree

Implements Options.

Definition at line 20 of file Trivial.cc.

21 {
22 int version = pt.get<int>("Trivial_version");
23 if (version != 1) {
24 B2ERROR("Unknown weightfile version " << std::to_string(version));
25 throw std::runtime_error("Unknown weightfile version " + std::to_string(version));
26 }
27 m_output = pt.get<double>("Trivial_output");
28
29 auto numberOfOutputs = pt.get<unsigned int>("Trivial_number_of_multiple_outputs", 0u);
30 m_multiple_output.resize(numberOfOutputs);
31 for (unsigned int i = 0; i < numberOfOutputs; ++i) {
32 m_multiple_output[i] = pt.get<double>(std::string("Trivial_multiple_output") + std::to_string(i));
33 }
34
35 m_passthrough = pt.get<bool>("Trivial_passthrough", false);
36 }

◆ save()

void save ( boost::property_tree::ptree &  pt) const
overridevirtual

Save mechanism to store Options in a xml tree.

Parameters
ptxml tree

Implements Options.

Definition at line 38 of file Trivial.cc.

39 {
40 pt.put("Trivial_version", 1);
41 pt.put("Trivial_output", m_output);
42 pt.put("Trivial_number_of_multiple_outputs", m_multiple_output.size());
43 for (unsigned int i = 0; i < m_multiple_output.size(); ++i) {
44 pt.put(std::string("Trivial_multiple_output") + std::to_string(i), m_multiple_output[i]);
45 }
46 pt.put("Trivial_passthrough", m_passthrough);
47 }

Member Data Documentation

◆ m_multiple_output

std::vector<double> m_multiple_output = {}

Output of the trivial method.

Definition at line 54 of file Trivial.h.

◆ m_output

double m_output = 0.5

Output of the trivial method.

Definition at line 53 of file Trivial.h.

◆ m_passthrough

bool m_passthrough = false

Flag for passthrough setting.

Definition at line 55 of file Trivial.h.


The documentation for this class was generated from the following files: