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