10#ifndef INCLUDE_GUARD_BELLE2_MVA_TMVA_HEADER
11#define INCLUDE_GUARD_BELLE2_MVA_TMVA_HEADER
13#include <mva/interface/Options.h>
14#include <mva/interface/Teacher.h>
15#include <mva/interface/Expert.h>
17#include <TMVA/Factory.h>
18#include <TMVA/Tools.h>
19#include <TMVA/Reader.h>
20#include <TMVA/DataLoader.h>
41 virtual void load(
const boost::property_tree::ptree& pt)
override;
47 virtual void save(boost::property_tree::ptree& pt)
const override;
57 virtual std::string
getMethod()
const override {
return "TMVA"; }
67 "!H:!V:CreateMVAPdfs:NTrees=400:BoostType=Grad:Shrinkage=0.1:UseBaggedBoost:BaggedSampleFraction=0.5:nCuts=1024:MaxDepth=3:IgnoreNegWeightsInTraining";
96 virtual void load(
const boost::property_tree::ptree& pt)
override;
102 virtual void save(boost::property_tree::ptree& pt)
const override;
112 virtual std::string
getMethod()
const override {
return "TMVAClassification"; }
138 virtual void load(
const boost::property_tree::ptree& pt)
override;
144 virtual void save(boost::property_tree::ptree& pt)
const override;
154 virtual std::string
getMethod()
const override {
return "TMVAMulticlass"; }
181 virtual std::string
getMethod()
const override {
return "TMVARegression"; }
204 Weightfile trainFactory(TMVA::Factory& factory, TMVA::DataLoader& data_loader,
const std::string& jobName)
const;
295 mutable std::vector<float>
297 mutable std::vector<float>
317 virtual std::vector<float>
apply(
Dataset& test_data)
const override;
344 return std::vector<float>();
375 virtual std::vector<float>
apply(
Dataset& test_data)
const override;
Abstract base class of all Datasets given to the MVA interface The current event can always be access...
Abstract base class of all Expert Each MVA library has its own implementation of this class,...
General options which are shared by all MVA trainings.
Specific Options, all method Options have to inherit from this class.
Expert for the TMVA Classification MVA method.
TMVAOptionsClassification specific_options
Method specific options.
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this m_expert onto a dataset.
float expert_signalFraction
Signal fraction used to calculate the probability.
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Expert for the TMVA Multiclass MVA method.
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this m_expert onto a dataset.
TMVAOptionsMulticlass specific_options
Method specific options.
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
virtual std::vector< std::vector< float > > applyMulticlass(Dataset &test_data) const override
Apply this m_expert onto a dataset.
Expert for the TMVA Regression MVA method.
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this m_expert onto a dataset.
TMVAOptionsRegression specific_options
Method specific options.
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Expert for the TMVA MVA method.
std::vector< float > m_input_cache
Input Cache for TMVA::Reader: Otherwise we would have to set the branch addresses in each apply call.
std::unique_ptr< TMVA::Reader > m_expert
TMVA::Reader pointer.
std::vector< float > m_spectators_cache
Spectators Cache for TMVA::Reader: Otherwise we would have to set the branch addresses in each apply ...
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Options for the TMVA Classification MVA method.
virtual std::string getMethod() const override
Return method name.
TMVAOptionsClassification()
Constructor Adds Classification as AnalysisType to the factoryOptions.
virtual po::options_description getDescription() override
Returns a program options description for all available options.
bool transform2probability
Transform output of method to a probability.
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.
Options for the TMVA Multiclass MVA method.
virtual std::string getMethod() const override
Return method name.
TMVAOptionsMulticlass()
Constructor Adds Multiclass as AnalysisType to the factoryOptions.
std::vector< std::string > m_classes
Class name identifiers.
virtual po::options_description getDescription() override
Returns a program options description for all available options.
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.
Options for the TMVA Regression MVA method.
virtual std::string getMethod() const override
Return method name.
TMVAOptionsRegression()
Constructor Adds REgression as AnalysisType to the factoryOptions.
Options for the TMVA MVA method.
virtual std::string getMethod() const override
Return method name.
std::string m_prepareOption
Prepare options passed to prepareTrainingAndTestTree method.
std::string m_prefix
Prefix used for all files generated by TMVA.
std::string m_config
TMVA config string for the chosen method.
std::string m_method
tmva method name
virtual po::options_description getDescription() override
Returns a program options description for all available options.
std::string m_factoryOption
Factory options passed to tmva factory.
std::string m_type
tmva method type
std::string m_workingDirectory
Working directory of TMVA, if empty a temporary directory is used.
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.
Teacher for the TMVA Classification MVA method.
TMVAOptionsClassification specific_options
Method specific options.
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Teacher for the TMVA Multiclass MVA method.
TMVAOptionsMulticlass specific_options
Method specific options.
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Teacher for the TMVA Regression MVA method.
TMVAOptionsRegression specific_options
Method specific options.
virtual Weightfile train(Dataset &training_data) const override
Train a mva method using the given dataset returning a Weightfile.
Teacher for the TMVA MVA method.
Weightfile trainFactory(TMVA::Factory &factory, TMVA::DataLoader &data_loader, const std::string &jobName) const
Train a mva method using the given data loader returning a Weightfile.
TMVAOptions specific_options
Method specific options.
Abstract base class of all Teachers Each MVA library has its own implementation of this class,...
The Weightfile class serializes all information about a training into an xml tree.
Abstract base class for different kinds of events.