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
29class TGraph;
30class TTree;
31class TDirectory;
32class TSpline;
33class TH1F;
34class TH1D;
35
36namespace TMVA {
37
38 class Ranking;
39 class PDF;
40 class TSpline1;
41 class MethodCuts;
42 class MethodBoost;
43 class DataSetInfo;
44
45 class RMethodBase : public MethodBase {
46
47 friend class Factory;
48 protected:
50 public:
51
52 // default constructur
53 RMethodBase(const TString &jobName,
54 Types::EMVA methodType,
55 const TString &methodTitle,
56 DataSetInfo &dsi,
57 const TString &theOption = "", ROOT::R::TRInterface &_r = ROOT::R::TRInterface::Instance());
58
59 // constructor used for Testing + Application of the MVA, only (no training),
60 // using given weight file
61 RMethodBase(Types::EMVA methodType,
62 DataSetInfo &dsi,
64
65 // default destructur
66 virtual ~RMethodBase() {};
67 virtual void Train() = 0;
68 // options treatment
69 virtual void Init() = 0;
70 virtual void DeclareOptions() = 0;
71 virtual void ProcessOptions() = 0;
72 // create ranking
73 virtual const Ranking *CreateRanking() = 0;
74
75 virtual Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0) = 0;
76
77 Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) = 0;
78 protected:
79 // the actual "weights"
80 virtual void AddWeightsXMLTo(void *parent) const = 0;
81 virtual void ReadWeightsFromXML(void *wghtnode) = 0;
82 virtual void ReadWeightsFromStream(std::istream &) = 0; // backward compatibility
83 virtual void ReadWeightsFromStream(TFile &) {} // backward compatibility
84
85
86 void LoadData();//Read data from Data() Aand DataInfo() to Dataframes and Vectors
87 protected:
88 ROOT::R::TRDataFrame fDfTrain;//signal and backgrd
92 std::vector<std::string> fFactorTrain;
93 std::vector<std::string> fFactorTest;
95
96 private:
97 ClassDef(RMethodBase, 0) // Virtual base class for all TMVA method
98
99 };
100} // namespace TMVA
101
102#endif
103
104
double Double_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:322
int type
Definition: TGX11.cxx:120
This is a class to create DataFrames from ROOT to R.
Definition: TRDataFrame.h:176
ROOT R was implemented using the R Project library and the modules Rcpp and RInside
Definition: TRInterface.h:136
static TRInterface & Instance()
static method to get an TRInterface instance reference
Describe directory structure in memory.
Definition: TDirectory.h:40
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:53
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:614
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:571
Class that contains all the data information.
Definition: DataSetInfo.h:60
This is the main MVA steering class.
Definition: Factory.h:81
Virtual base Class for all MVA method.
Definition: MethodBase.h:111
virtual void ProcessOptions()=0
std::vector< std::string > fFactorTrain
Definition: RMethodBase.h:92
ROOT::R::TRInterface & r
Definition: RMethodBase.h:49
ROOT::R::TRDataFrame fDfTrain
Definition: RMethodBase.h:88
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
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)=0
virtual const Ranking * CreateRanking()=0
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
TVectorD fWeightTrain
Definition: RMethodBase.h:90
virtual void DeclareOptions()=0
virtual void ReadWeightsFromXML(void *wghtnode)=0
ROOT::R::TRDataFrame fDfTest
Definition: RMethodBase.h:89
virtual void Train()=0
TVectorD fWeightTest
Definition: RMethodBase.h:91
virtual ~RMethodBase()
Definition: RMethodBase.h:66
virtual void ReadWeightsFromStream(TFile &)
Definition: RMethodBase.h:83
virtual void AddWeightsXMLTo(void *parent) const =0
std::vector< std::string > fFactorTest
Definition: RMethodBase.h:93
virtual void ReadWeightsFromStream(std::istream &)=0
ROOT::R::TRDataFrame fDfSpectators
Definition: RMethodBase.h:94
virtual void Init()=0
Ranking for variables in method (implementation)
Definition: Ranking.h:48
EAnalysisType
Definition: Types.h:127
Base class for spline implementation containing the Draw/Paint methods.
Definition: TSpline.h:22
Basic string class.
Definition: TString.h:131
A TTree represents a columnar dataset.
Definition: TTree.h:78
create variable transformations