57 predict("predict.C5.0"),
59 C50Control("C5.0Control"),
60 asfactor("
as.factor"),
66 fControlSubset =
kTRUE;
69 fControlNoGlobalPruning =
kFALSE;
72 fControlFuzzyThreshold =
kFALSE;
74 r[
"sample.int(4096, size = 1) - 1L"] >> fControlSeed;
75 fControlEarlyStopping =
kTRUE;
77 ListOfVariables = DataInfo().GetListOfVariables();
79 SetWeightFileDir(
gConfig().GetIONames().fWeightFileDir);
88 predict(
"predict.C5.0"),
90 C50Control(
"C5.0Control"),
91 asfactor(
"as.factor"),
130 Error(
"Init",
"R's package C50 can not be loaded.");
131 Log() <<
kFATAL <<
" R's package C50 can not be loaded."
139 if (
Data()->GetNTrainingEvents() == 0)
Log() <<
kFATAL <<
"<Train> Data() has zero events" <<
Endl;
151 r[
"C50Model"] << Model;
152 r <<
"save(C50Model,file='" + path +
"')";
159 DeclareOptionRef(fNTrials,
"NTrials",
"An integer specifying the number of boosting iterations");
164 predictors for splits? Note: the C5.0 command line version defaults this \
165 parameter to ‘FALSE’, meaning no attempted gropings will be evaluated \
166 during the tree growing stage.");
168 the rules by their affect on the error rate and groups the \
169 rules into the specified number of bands. This modifies the \
170 output so that the effect on the error rate can be seen for \
171 the groups of rules within a band. If this options is \
172 selected and ‘rules = kFALSE’, a warning is issued and ‘rules’ \
173 is changed to ‘kTRUE’.");
176 step to simplify the tree.");
179 put in at least two of the splits.");
182 of the data. See Quinlan (1993) for details and examples.");
184 proportion of the data should be used to train the model. By \
185 default, all the samples are used for model training. Samples \
186 not used for training are used to evaluate the accuracy of \
187 the model in the printed output.");
188 DeclareOptionRef(fControlSeed,
"ControlSeed",
" An integer for the random number seed within the C code.");
190 stopping boosting should be used.");
199 Log() <<
kERROR <<
" fNTrials <=0... that does not work !! "
200 <<
" I set it to 1 .. just so that the program does not crash"
219 Log() <<
kINFO <<
"Testing Classification C50 METHOD " <<
Endl;
232 for (
UInt_t i = 0; i < nvar; i++) {
240 mvaValue = result[1];
254 Log() <<
"Decision Trees and Rule-Based Models " <<
Endl;
268 TString path = GetWeightFileDir() +
"/C50Model.RData";
272 r <<
"load('" + path +
"')";
274 r[
"C50Model"] >> Model;
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
const TString & GetWeightFileDir() const
MsgLogger & Endl(MsgLogger &ml)
Namespace for new ROOT classes and functions.
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
UInt_t GetNVariables() const
ROOT::R::TRFunctionImport C50Control
Bool_t fControlFuzzyThreshold
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static Bool_t IsModuleLoaded
ROOT::R::TRFunctionImport asfactor
Bool_t Require(TString pkg)
Method to load an R's package.
MethodC50(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="", TDirectory *theTargetDir=NULL)
virtual void TestClassification()
initialization
This is a class to get ROOT's objects from R's objects
std::vector< std::string > fFactorTrain
const Event * GetEvent() const
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
Bool_t fControlEarlyStopping
ROOT::R::TRObject fModelControl
ROOT::R::TRFunctionImport predict
Describe directory structure in memory.
void GetHelpMessage() const
Bool_t fControlNoGlobalPruning
static TRInterface & Instance()
static method to get an TRInterface instance reference
ROOT::R::TRFunctionImport C50
DataSetInfo & DataInfo() const
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
#define REGISTER_METHOD(CLASS)
for example
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< Float_t > & GetValues()
ROOT::R::TRDataFrame fDfTrain
void SetWeightFileDir(TString fileDir)
set directory of weight file
ROOT::R::TRObject * fModel
std::vector< TString > GetListOfVariables() const
returns list of variables
Rcpp::internal::NamedPlaceHolder Label
virtual void TestClassification()
initialization
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
This is a class to create DataFrames from ROOT to R