Logo ROOT   master
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 #include "TMVA/RMethodBase.h"
25 
26 namespace TMVA {
27 
28  class Factory; // DSMTEST
29  class Reader; // DSMTEST
30  class DataSetManager; // DSMTEST
31  class Types;
32  class MethodRXGB: public RMethodBase {
33 
34  public :
35 
36  // constructors
37  MethodRXGB(const TString &jobName,
38  const TString &methodTitle,
39  DataSetInfo &theData,
40  const TString &theOption = "");
41 
43  const TString &theWeightFile);
44 
45 
46  ~MethodRXGB(void);
47  void Train();
48  // options treatment
49  void Init();
50  void DeclareOptions();
51  void ProcessOptions();
52  // create ranking
54  {
55  return NULL; // = 0;
56  }
57 
58 
59  Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets);
60 
61  // performs classifier testing
62  virtual void TestClassification();
63 
64 
65  Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0);
66  virtual void MakeClass(const TString &classFileName = TString("")) const; //required for model persistence
68  // the actual "weights"
69  virtual void AddWeightsXMLTo(void * /*parent*/) const {} // = 0;
70  virtual void ReadWeightsFromXML(void * /*wghtnode*/) {} // = 0;
71  virtual void ReadWeightsFromStream(std::istream &) {} //= 0; // backward compatibility
72 
73  void ReadModelFromFile();
74 
75  // signal/background classification response for all current set of data
76  virtual std::vector<Double_t> GetMvaValues(Long64_t firstEvt = 0, Long64_t lastEvt = -1, Bool_t logProgress = false);
77 
78  private :
80  friend class Factory; // DSMTEST
81  friend class Reader; // DSMTEST
82  protected:
83 
84 
85  //RXGBfunction options
86  //https://github.com/dmlc/xgboost/blob/master/doc/parameter.md
91 
92  std::vector<UInt_t> fFactorNumeric; //factors creations
93  //xgboost require a numeric factor then background=0 signal=1 from fFactorTrain
94 
103 
104 
105  // get help message text
106  void GetHelpMessage() const;
107 
108  ClassDef(MethodRXGB, 0)
109  };
110 } // namespace TMVA
111 #endif
ROOT::R::TRFunctionImport xgbdmatrix
Definition: MethodRXGB.h:97
long long Long64_t
Definition: RtypesCore.h:69
const Ranking * CreateRanking()
Definition: MethodRXGB.h:53
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Definition: MethodRXGB.cxx:96
virtual void ReadWeightsFromXML(void *)
Definition: MethodRXGB.h:70
EAnalysisType
Definition: Types.h:127
ROOT::R::TRFunctionImport asfactor
Definition: MethodRXGB.h:100
ROOT::R::TRObject * fModel
Definition: MethodRXGB.h:102
Basic string class.
Definition: TString.h:131
Ranking for variables in method (implementation)
Definition: Ranking.h:48
DataSetManager * fDataSetManager
Definition: MethodRXGB.h:79
bool Bool_t
Definition: RtypesCore.h:59
void ReadModelFromFile()
Definition: MethodRXGB.cxx:267
#define ClassDef(name, id)
Definition: Rtypes.h:326
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
Class that contains all the data information.
Definition: DataSetInfo.h:60
virtual void ReadWeightsFromStream(std::istream &)
Definition: MethodRXGB.h:71
This is a class to get ROOT&#39;s objects from R&#39;s objects
Definition: TRObject.h:71
ROOT::R::TRFunctionImport xgbsave
Definition: MethodRXGB.h:98
This is a class to pass functions from ROOT to R
ROOT::R::TRFunctionImport xgbload
Definition: MethodRXGB.h:99
unsigned int UInt_t
Definition: RtypesCore.h:42
ROOT::R::TRFunctionImport asmatrix
Definition: MethodRXGB.h:101
Double_t fEta
Definition: MethodRXGB.h:88
This is the main MVA steering class.
Definition: Factory.h:81
double Double_t
Definition: RtypesCore.h:55
Class that contains all the data information.
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
The Reader class serves to use the MVAs in a specific analysis context.
Definition: Reader.h:63
create variable transformations
UInt_t fMaxDepth
Definition: MethodRXGB.h:89
virtual void AddWeightsXMLTo(void *) const
Definition: MethodRXGB.h:69
ROOT::R::TRFunctionImport predict
Definition: MethodRXGB.h:95
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:90
void GetHelpMessage() const
Definition: MethodRXGB.cxx:247
ROOT::R::TRFunctionImport xgbtrain
Definition: MethodRXGB.h:96
std::vector< UInt_t > fFactorNumeric
Definition: MethodRXGB.h:92