ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
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 = "",
63 
64  // constructor used for Testing + Application of the MVA, only (no training),
65  // using given weight file
66  RMethodBase(Types::EMVA methodType,
67  DataSetInfo &dsi,
68  const TString &weightFile,
70 
71  // default destructur
72  virtual ~RMethodBase() {};
73  virtual void Train() = 0;
74  // options treatment
75  virtual void Init() = 0;
76  virtual void DeclareOptions() = 0;
77  virtual void ProcessOptions() = 0;
78  // create ranking
79  virtual const Ranking *CreateRanking() = 0;
80 
81  virtual Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0) = 0;
82 
83  Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) = 0;
84  protected:
85  // the actual "weights"
86  virtual void AddWeightsXMLTo(void *parent) const = 0;
87  virtual void ReadWeightsFromXML(void *wghtnode) = 0;
88  virtual void ReadWeightsFromStream(std::istream &) = 0; // backward compatibility
89  virtual void ReadWeightsFromStream(TFile &) {} // backward compatibility
90 
91 
92  void LoadData();//Read data from Data() Aand DataInfo() to Dataframes and Vectors
93  protected:
94  ROOT::R::TRDataFrame fDfTrain;//signal and backgrd
98  std::vector<std::string> fFactorTrain;
99  std::vector<std::string> fFactorTest;
101 
102  private:
103  ClassDef(RMethodBase, 0) // Virtual base class for all TMVA method
104 
105  };
106 } // namespace TMVA
107 
108 #endif
109 
110 
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)=0
std::vector< std::string > fFactorTest
Definition: RMethodBase.h:99
ROOT::R::TRDataFrame fDfTest
Definition: RMethodBase.h:95
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:45
EAnalysisType
Definition: Types.h:124
RMethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="", TDirectory *theBaseDir=0, ROOT::R::TRInterface &_r=ROOT::R::TRInterface::Instance())
Basic string class.
Definition: TString.h:137
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:570
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:96
#define ClassDef(name, id)
Definition: Rtypes.h:254
ROOT::R::TRDataFrame fDfSpectators
Definition: RMethodBase.h:100
std::vector< std::string > fFactorTrain
Definition: RMethodBase.h:98
virtual void ProcessOptions()=0
TVectorD fWeightTest
Definition: RMethodBase.h:97
unsigned int UInt_t
Definition: RtypesCore.h:42
ROOT::R::TRInterface & r
Definition: RMethodBase.h:53
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:613
virtual void Init()=0
double Double_t
Definition: RtypesCore.h:55
virtual ~RMethodBase()
Definition: RMethodBase.h:72
Describe directory structure in memory.
Definition: TDirectory.h:44
virtual void ReadWeightsFromStream(std::istream &)=0
int type
Definition: TGX11.cxx:120
virtual void AddWeightsXMLTo(void *parent) const =0
static TRInterface & Instance()
static method to get an TRInterface instance reference
virtual void ReadWeightsFromStream(TFile &)
Definition: RMethodBase.h:89
ROOT::R::TRDataFrame fDfTrain
Definition: RMethodBase.h:94
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
This is a class to create DataFrames from ROOT to R
Definition: TRDataFrame.h:183