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
32class TGraph;
33class TTree;
34class TDirectory;
35class TSpline;
36class TH1F;
37class TH1D;
38
39namespace 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
unsigned int UInt_t
Definition: RtypesCore.h:46
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:325
int type
Definition: TGX11.cxx:121
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:45
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
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:618
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
Class that contains all the data information.
Definition: DataSetInfo.h:62
This is the main MVA steering class.
Definition: Factory.h:80
Virtual base Class for all MVA method.
Definition: MethodBase.h:111
virtual void ProcessOptions()=0
std::vector< std::string > fFactorTrain
Definition: RMethodBase.h:95
ROOT::R::TRInterface & r
Definition: RMethodBase.h:52
ROOT::R::TRDataFrame fDfTrain
Definition: RMethodBase.h:91
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:93
virtual void DeclareOptions()=0
virtual void ReadWeightsFromXML(void *wghtnode)=0
ROOT::R::TRDataFrame fDfTest
Definition: RMethodBase.h:92
virtual void Train()=0
TVectorD fWeightTest
Definition: RMethodBase.h:94
virtual ~RMethodBase()
Definition: RMethodBase.h:69
virtual void ReadWeightsFromStream(TFile &)
Definition: RMethodBase.h:86
virtual void AddWeightsXMLTo(void *parent) const =0
std::vector< std::string > fFactorTest
Definition: RMethodBase.h:96
virtual void ReadWeightsFromStream(std::istream &)=0
ROOT::R::TRDataFrame fDfSpectators
Definition: RMethodBase.h:97
virtual void Init()=0
Ranking for variables in method (implementation)
Definition: Ranking.h:48
EAnalysisType
Definition: Types.h:128
Base class for spline implementation containing the Draw/Paint methods.
Definition: TSpline.h:31
Basic string class.
Definition: TString.h:136
A TTree represents a columnar dataset.
Definition: TTree.h:79
create variable transformations