 |
Belle II Software
release-05-02-19
|
12 #include <mva/modules/MVAExpert/MVAPrototypeModule.h>
13 #include <mva/interface/Interface.h>
15 #include <boost/algorithm/string/predicate.hpp>
28 setDescription(
"Prototype of a module which uses the MVA package");
37 addParam(
"identifier", m_identifier,
"The database identifier or filename which is used to load the weights during the training.");
44 "signalFraction to calculate probability (if -1 the signalFraction of the training data is used)", -1.0);
68 std::stringstream ss((*m_weightfile_representation)->m_data);
87 MVA::GeneralOptions general_options;
88 weightfile.getOptions(general_options);
95 m_expert = supported_interfaces[general_options.m_method]->getExpert();
102 std::vector<float> dummy(general_options.m_variables.size(), 0);
103 m_dataset = std::make_unique<MVA::SingleDataset>(general_options, dummy, 0);
113 B2ERROR(
"MVA Expert is not loaded! I will return 0");
119 for (
unsigned int i = 0; i <
m_dataset->getNumberOfFeatures(); ++i) {
128 B2INFO(
"The probability is " << probability);
std::unique_ptr< MVA::Expert > m_expert
Pointer to the current MVA Expert.
static std::map< std::string, AbstractInterface * > getSupportedInterfaces()
Returns interfaces supported by the MVA Interface.
void setDescription(const std::string &description)
Sets the description of the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
double m_signal_fraction_override
Signal Fraction which should be used.
virtual void initialize() override
Initialize the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
void init_mva(MVA::Weightfile &weightfile)
Initialize mva expert, dataset and features Called everytime the weightfile in the database changes i...
Abstract base class for different kinds of events.
static Weightfile loadFromFile(const std::string &filename)
Static function which loads a Weightfile from a file.
double m_signal_fraction_override
Signal Fraction which should be used.
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfile_representation
Database pointer to the Database representation of the weightfile.
std::string m_identifier
database identifier or filename of the weightfile
static void initSupportedInterfaces()
Static function which initliazes all supported interfaces, has to be called once before getSupportedI...
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
static Weightfile loadFromStream(std::istream &stream)
Static function which deserializes a Weightfile from a stream.
virtual void beginRun() override
Called at the beginning of a new run.
virtual void event() override
Called for each event.
MVAPrototypeModule()
Constructor.
std::unique_ptr< MVA::SingleDataset > m_dataset
Pointer to the current dataset.