Logo ROOT   6.08/07
Reference Guide
MethodRXGB.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 : RMethodRXGB *
8  * *
9  * Description: *
10  * R´s Package xgboost method based on ROOTR *
11  * *
12  **********************************************************************************/
13 
14 #ifndef ROOT_TMVA_RMethodXGB
15 #define ROOT_TMVA_RMethodXGB
16 
17 //////////////////////////////////////////////////////////////////////////
18 // //
19 // RMethodRXGB //
20 // //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TMVA_RMethodBase
25 #include "TMVA/RMethodBase.h"
26 #endif
27 
28 namespace TMVA {
29 
30  class Factory; // DSMTEST
31  class Reader; // DSMTEST
32  class DataSetManager; // DSMTEST
33  class Types;
34  class MethodRXGB: public RMethodBase {
35 
36  public :
37 
38  // constructors
39  MethodRXGB(const TString &jobName,
40  const TString &methodTitle,
41  DataSetInfo &theData,
42  const TString &theOption = "");
43 
45  const TString &theWeightFile);
46 
47 
48  ~MethodRXGB(void);
49  void Train();
50  // options treatment
51  void Init();
52  void DeclareOptions();
53  void ProcessOptions();
54  // create ranking
56  {
57  return NULL; // = 0;
58  }
59 
60 
61  Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets);
62 
63  // performs classifier testing
64  virtual void TestClassification();
65 
66 
67  Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0);
68  virtual void MakeClass(const TString &classFileName = TString("")) const; //required for model persistence
70  // the actual "weights"
71  virtual void AddWeightsXMLTo(void *parent) const {} // = 0;
72  virtual void ReadWeightsFromXML(void *wghtnode) {} // = 0;
73  virtual void ReadWeightsFromStream(std::istream &) {} //= 0; // backward compatibility
74 
75  void ReadModelFromFile();
76 
77  // signal/background classification response for all current set of data
78  virtual std::vector<Double_t> GetMvaValues(Long64_t firstEvt = 0, Long64_t lastEvt = -1, Bool_t logProgress = false);
79 
80  private :
82  friend class Factory; // DSMTEST
83  friend class Reader; // DSMTEST
84  protected:
85 
86 
87  //RXGBfunction options
88  //https://github.com/dmlc/xgboost/blob/master/doc/parameter.md
93 
94  std::vector<UInt_t> fFactorNumeric; //factors creations
95  //xgboost require a numeric factor then background=0 signal=1 from fFactorTrain
96 
97  ROOT::R::TRFunctionImport predict;
98  ROOT::R::TRFunctionImport xgbtrain;
99  ROOT::R::TRFunctionImport xgbdmatrix;
100  ROOT::R::TRFunctionImport xgbsave;
101  ROOT::R::TRFunctionImport xgbload;
102  ROOT::R::TRFunctionImport asfactor;
103  ROOT::R::TRFunctionImport asmatrix;
104  ROOT::R::TRObject *fModel;
105 
106 
107  // get help message text
108  void GetHelpMessage() const;
109 
110  ClassDef(MethodRXGB, 0)
111  };
112 } // namespace TMVA
113 #endif
ROOT::R::TRFunctionImport xgbdmatrix
Definition: MethodRXGB.h:99
long long Long64_t
Definition: RtypesCore.h:69
const Ranking * CreateRanking()
Definition: MethodRXGB.h:55
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Definition: MethodRXGB.cxx:96
EAnalysisType
Definition: Types.h:129
ROOT::R::TRFunctionImport asfactor
Definition: MethodRXGB.h:102
ROOT::R::TRObject * fModel
Definition: MethodRXGB.h:104
Basic string class.
Definition: TString.h:137
DataSetManager * fDataSetManager
Definition: MethodRXGB.h:81
bool Bool_t
Definition: RtypesCore.h:59
void ReadModelFromFile()
Definition: MethodRXGB.cxx:267
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual std::vector< Double_t > GetMvaValues(Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
get all the MVA values for the events of the current Data type
Definition: MethodRXGB.cxx:193
virtual void ReadWeightsFromStream(std::istream &)
Definition: MethodRXGB.h:73
ROOT::R::TRFunctionImport xgbsave
Definition: MethodRXGB.h:100
virtual void ReadWeightsFromXML(void *wghtnode)
Definition: MethodRXGB.h:72
ROOT::R::TRFunctionImport xgbload
Definition: MethodRXGB.h:101
unsigned int UInt_t
Definition: RtypesCore.h:42
ROOT::R::TRFunctionImport asmatrix
Definition: MethodRXGB.h:103
Double_t fEta
Definition: MethodRXGB.h:90
double Double_t
Definition: RtypesCore.h:55
virtual void TestClassification()
initialization
Definition: MethodRXGB.cxx:166
int type
Definition: TGX11.cxx:120
MethodRXGB(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
Definition: MethodRXGB.cxx:50
Abstract ClassifierFactory template that handles arbitrary types.
UInt_t fMaxDepth
Definition: MethodRXGB.h:91
ROOT::R::TRFunctionImport predict
Definition: MethodRXGB.h:97
#define NULL
Definition: Rtypes.h:82
virtual void ReadWeightsFromStream(std::istream &)=0
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
Definition: MethodRXGB.cxx:281
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
Definition: MethodRXGB.cxx:174
static Bool_t IsModuleLoaded
Definition: MethodRXGB.h:92
void GetHelpMessage() const
Definition: MethodRXGB.cxx:247
ROOT::R::TRFunctionImport xgbtrain
Definition: MethodRXGB.h:98
virtual void AddWeightsXMLTo(void *parent) const
Definition: MethodRXGB.h:71
std::vector< UInt_t > fFactorNumeric
Definition: MethodRXGB.h:94