Logo ROOT  
Reference Guide
RMethodBase.h
Go to the documentation of this file.
1 // @(#)root/tmva/rmva $Id$
2 // Author: Omar Zapata,Lorenzo Moneta, Sergei Gleyzer 2015
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : RMethodBase *
8  * *
9  * Description: *
10  * Virtual base class for all MVA method based on ROOTR *
11  * *
12  **********************************************************************************/
13 
14 #ifndef ROOT_TMVA_RMethodBase
15 #define ROOT_TMVA_RMethodBase
16 
17 //////////////////////////////////////////////////////////////////////////
18 // //
19 // RMethodBase //
20 // //
21 // Virtual base class for all TMVA method based on ROOTR //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TMVA/MethodBase.h"
26 
27 #include <TRInterface.h>
28 
29 #include <vector>
30 #include <string>
31 
32 class TGraph;
33 class TTree;
34 class TDirectory;
35 class TSpline;
36 class TH1F;
37 class TH1D;
38 
39 namespace TMVA {
40 
41  class Ranking;
42  class PDF;
43  class TSpline1;
44  class MethodCuts;
45  class MethodBoost;
46  class DataSetInfo;
47 
48  class RMethodBase : public MethodBase {
49 
50  friend class Factory;
51  protected:
53  public:
54 
55  // default constructur
56  RMethodBase(const TString &jobName,
57  Types::EMVA methodType,
58  const TString &methodTitle,
59  DataSetInfo &dsi,
60  const TString &theOption = "", ROOT::R::TRInterface &_r = ROOT::R::TRInterface::Instance());
61 
62  // constructor used for Testing + Application of the MVA, only (no training),
63  // using given weight file
64  RMethodBase(Types::EMVA methodType,
65  DataSetInfo &dsi,
67 
68  // default destructur
69  virtual ~RMethodBase() {};
70  virtual void Train() = 0;
71  // options treatment
72  virtual void Init() = 0;
73  virtual void DeclareOptions() = 0;
74  virtual void ProcessOptions() = 0;
75  // create ranking
76  virtual const Ranking *CreateRanking() = 0;
77 
78  virtual Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0) = 0;
79 
80  Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) = 0;
81  protected:
82  // the actual "weights"
83  virtual void AddWeightsXMLTo(void *parent) const = 0;
84  virtual void ReadWeightsFromXML(void *wghtnode) = 0;
85  virtual void ReadWeightsFromStream(std::istream &) = 0; // backward compatibility
86  virtual void ReadWeightsFromStream(TFile &) {} // backward compatibility
87 
88 
89  void LoadData();//Read data from Data() Aand DataInfo() to Dataframes and Vectors
90  protected:
91  ROOT::R::TRDataFrame fDfTrain;//signal and backgrd
95  std::vector<std::string> fFactorTrain;
96  std::vector<std::string> fFactorTest;
98 
99  private:
100  ClassDef(RMethodBase, 0) // Virtual base class for all TMVA method
101 
102  };
103 } // namespace TMVA
104 
105 #endif
106 
107 
TMVA::RMethodBase::DeclareOptions
virtual void DeclareOptions()=0
TMVA::RMethodBase::CreateRanking
virtual const Ranking * CreateRanking()=0
TMVA::RMethodBase::GetMvaValue
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
TMVA::RMethodBase::~RMethodBase
virtual ~RMethodBase()
Definition: RMethodBase.h:69
TMVA::Ranking
Ranking for variables in method (implementation)
Definition: Ranking.h:48
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TH1D
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:618
ROOT::R::TRInterface
ROOT R was implemented using the R Project library and the modules Rcpp and RInside
Definition: TRInterface.h:137
TSpline
Base class for spline implementation containing the Draw/Paint methods.
Definition: TSpline.h:31
MethodBase.h
TMVA::RMethodBase::fWeightTest
TVectorD fWeightTest
Definition: RMethodBase.h:94
TString
Basic string class.
Definition: TString.h:136
TMVA::RMethodBase::HasAnalysisType
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)=0
TMVA::RMethodBase::r
ROOT::R::TRInterface & r
Definition: RMethodBase.h:52
bool
TMVA::RMethodBase::ReadWeightsFromXML
virtual void ReadWeightsFromXML(void *wghtnode)=0
TRInterface.h
TMVA::DataSetInfo
Class that contains all the data information.
Definition: DataSetInfo.h:62
TMVA::RMethodBase::ReadWeightsFromStream
virtual void ReadWeightsFromStream(std::istream &)=0
TMVA::Types::EAnalysisType
EAnalysisType
Definition: Types.h:128
TMVA::RMethodBase::RMethodBase
RMethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="", ROOT::R::TRInterface &_r=ROOT::R::TRInterface::Instance())
Definition: RMethodBase.cxx:23
TMVA::RMethodBase::fFactorTest
std::vector< std::string > fFactorTest
Definition: RMethodBase.h:96
TMVA::RMethodBase::ProcessOptions
virtual void ProcessOptions()=0
TMVA::RMethodBase
Definition: RMethodBase.h:48
TMVA::RMethodBase::fDfTrain
ROOT::R::TRDataFrame fDfTrain
Definition: RMethodBase.h:91
TMVA::Factory
This is the main MVA steering class.
Definition: Factory.h:80
TMVA::RMethodBase::ReadWeightsFromStream
virtual void ReadWeightsFromStream(TFile &)
Definition: RMethodBase.h:86
TMVA::MethodBase
Virtual base Class for all MVA method.
Definition: MethodBase.h:111
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
unsigned int
TVectorT< Double_t >
TMVA::RMethodBase::fWeightTrain
TVectorD fWeightTrain
Definition: RMethodBase.h:93
Double_t
double Double_t
Definition: RtypesCore.h:59
TGraph
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
TMVA::Types::EMVA
EMVA
Definition: Types.h:78
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
TMVA::RMethodBase::AddWeightsXMLTo
virtual void AddWeightsXMLTo(void *parent) const =0
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMVA::RMethodBase::LoadData
void LoadData()
Definition: RMethodBase.cxx:43
TMVA::RMethodBase::fDfSpectators
ROOT::R::TRDataFrame fDfSpectators
Definition: RMethodBase.h:97
TDirectory
Describe directory structure in memory.
Definition: TDirectory.h:45
ROOT::R::TRInterface::Instance
static TRInterface & Instance()
static method to get an TRInterface instance reference
Definition: TRInterface.cxx:187
type
int type
Definition: TGX11.cxx:121
TMVA::RMethodBase::Init
virtual void Init()=0
TMVA::RMethodBase::Train
virtual void Train()=0
TMVA::RMethodBase::fFactorTrain
std::vector< std::string > fFactorTrain
Definition: RMethodBase.h:95
ROOT::R::TRDataFrame
This is a class to create DataFrames from ROOT to R.
Definition: TRDataFrame.h:177
TMVA
create variable transformations
Definition: GeneticMinimizer.h:22
TMVA::RMethodBase::fDfTest
ROOT::R::TRDataFrame fDfTest
Definition: RMethodBase.h:92