Logo ROOT   6.14/05
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 class TGraph;
30 class TTree;
31 class TDirectory;
32 class TSpline;
33 class TH1F;
34 class TH1D;
35 
36 namespace 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 
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)=0
std::vector< std::string > fFactorTest
Definition: RMethodBase.h:93
ROOT::R::TRDataFrame fDfTest
Definition: RMethodBase.h:89
Base class for spline implementation containing the Draw/Paint methods.
Definition: TSpline.h:20
virtual void Train()=0
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:47
EAnalysisType
Definition: Types.h:127
Virtual base Class for all MVA method.
Definition: MethodBase.h:109
Basic string class.
Definition: TString.h:131
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:567
Ranking for variables in method (implementation)
Definition: Ranking.h:48
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:90
#define ClassDef(name, id)
Definition: Rtypes.h:320
ROOT::R::TRDataFrame fDfSpectators
Definition: RMethodBase.h:94
Class that contains all the data information.
Definition: DataSetInfo.h:60
std::vector< std::string > fFactorTrain
Definition: RMethodBase.h:92
virtual void ProcessOptions()=0
TVectorD fWeightTest
Definition: RMethodBase.h:91
unsigned int UInt_t
Definition: RtypesCore.h:42
ROOT::R::TRInterface & r
Definition: RMethodBase.h:49
This is the main MVA steering class.
Definition: Factory.h:81
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:610
virtual void Init()=0
double Double_t
Definition: RtypesCore.h:55
virtual ~RMethodBase()
Definition: RMethodBase.h:66
Describe directory structure in memory.
Definition: TDirectory.h:34
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
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:83
ROOT::R::TRDataFrame fDfTrain
Definition: RMethodBase.h:88
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
virtual void ReadWeightsFromXML(void *wghtnode)=0
A TTree object has a header with a name and a title.
Definition: TTree.h:70
virtual void DeclareOptions()=0
This is a class to create DataFrames from ROOT to R
Definition: TRDataFrame.h:177