Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 = nullptr, Double_t *errUpper = nullptr) = 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
#define ClassDef(name, id)
Definition Rtypes.h:342
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
This is a class to create DataFrames from ROOT to R.
ROOT R was implemented using the R Project library and the modules Rcpp and RInside
static TRInterface & Instance()
static method to get an TRInterface instance reference
Describe directory structure in memory.
Definition TDirectory.h:45
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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:671
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:623
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
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)=0
virtual const Ranking * CreateRanking()=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
virtual Double_t GetMvaValue(Double_t *errLower=nullptr, Double_t *errUpper=nullptr)=0
Ranking for variables in method (implementation)
Definition Ranking.h:48
Base class for spline implementation containing the Draw/Paint methods.
Definition TSpline.h:31
Basic string class.
Definition TString.h:139
A TTree represents a columnar dataset.
Definition TTree.h:79
create variable transformations