57 predict("predict", "xgboost"),
59 xgbdmatrix("xgb.DMatrix"),
62 asfactor("as.factor"),
63 asmatrix("as.matrix"),
76 predict(
"predict",
"xgboost"),
78 xgbdmatrix(
"xgb.DMatrix"),
81 asfactor(
"as.factor"),
82 asmatrix(
"as.matrix"),
108 Error(
"Init",
"R's package xgboost can not be loaded.");
109 Log() <<
kFATAL <<
" R's package xgboost can not be loaded." 118 for (
UInt_t i = 0; i < size; i++) {
129 if (
Data()->GetNTrainingEvents() == 0)
Log() <<
kFATAL <<
"<Train> Data() has zero events" <<
Endl;
131 ROOT::R::TRDataFrame params;
132 params[
"eta"] =
fEta;
141 fModel =
new ROOT::R::TRObject(Model);
156 DeclareOptionRef(
fEta,
"Eta",
"Step size shrinkage used in update to prevents overfitting. After each boosting step, we can directly get the weights of new features. and eta actually shrinks the feature weights to make the boosting process more conservative.");
168 Log() <<
kINFO <<
"Testing Classification RXGB METHOD " <<
Endl;
180 ROOT::R::TRDataFrame fDfEvent;
181 for (
UInt_t i = 0; i < nvar; i++) {
196 if (firstEvt > lastEvt || lastEvt > nEvents) lastEvt =
nEvents;
197 if (firstEvt < 0) firstEvt = 0;
199 nEvents = lastEvt-firstEvt;
211 std::vector<std::vector<Float_t> > inputData(nvars);
212 for (
UInt_t i = 0; i < nvars; i++) {
213 inputData[i] = std::vector<Float_t>(
nEvents);
216 for (
Int_t ievt=firstEvt; ievt<lastEvt; ievt++) {
220 for (
UInt_t i = 0; i < nvars; i++) {
221 inputData[i][ievt] = e->
GetValue(i);
227 ROOT::R::TRDataFrame evtData;
228 for (
UInt_t i = 0; i < nvars; i++) {
234 std::vector<Double_t> mvaValues(nEvents);
236 mvaValues = pred.As<std::vector<Double_t>>();
256 Log() <<
"Decision Trees and Rule-Based Models " <<
Endl;
269 ROOT::R::TRInterface::Instance().Require(
"RXGB");
276 fModel =
new ROOT::R::TRObject(Model);
ROOT::R::TRFunctionImport xgbdmatrix
const TString & GetWeightFileDir() const
MsgLogger & Endl(MsgLogger &ml)
#define REGISTER_METHOD(CLASS)
for example
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
RooCmdArg Label(const char *str)
const char * GetName() const
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
ROOT::R::TRObject * fModel
TString GetElapsedTime(Bool_t Scientific=kTRUE)
UInt_t GetNVariables() const
const TString & GetMethodName() const
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
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
void ReadStateFromFile()
Function to write options and weights to file.
void SetCurrentEvent(Long64_t ievt) const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
UInt_t GetNVariables() const
accessor to the number of variables
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
std::vector< std::string > fFactorTrain
ROOT::R::TRFunctionImport xgbsave
ROOT::R::TRFunctionImport xgbload
void GetHelpMessage() const
const Event * GetEvent() const
char * Form(const char *fmt,...)
ROOT::R::TRFunctionImport asmatrix
Types::ETreeType GetCurrentType() const
const Event * GetEvent() const
virtual void TestClassification()
initialization
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
UInt_t GetNVariables() const
access the number of variables through the datasetinfo
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
DataSetInfo & DataInfo() const
MethodRXGB(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< Float_t > & GetValues()
ROOT::R::TRDataFrame fDfTrain
ROOT::R::TRFunctionImport predict
std::vector< TString > GetListOfVariables() const
returns list of variables
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
static Bool_t IsModuleLoaded
virtual void TestClassification()
initialization
ROOT::R::TRFunctionImport xgbtrain
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
std::vector< UInt_t > fFactorNumeric
Bool_t IsModelPersistence()