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