52 const TString &methodTitle,
54 const TString &theOption) :
59 asfactor(
"as.factor"),
148 Error(
"Init",
"R's package RSNNS can not be loaded.");
149 Log() <<
kFATAL <<
" R's package RSNNS can not be loaded." 158 for (
UInt_t i = 0; i < size; i++) {
166 if (
Data()->GetNTrainingEvents() == 0)
Log() <<
kFATAL <<
"<Train> Data() has zero events" <<
Endl;
168 ROOT::R::TRObject PruneFunc;
169 if (
fPruneFunc ==
"NULL") PruneFunc =
r.Eval(
"NULL");
184 ROOT::R::Label[
"libOut"] =
fLinOut,
185 ROOT::R::Label[
"pruneFunc"] = PruneFunc,
187 fModel =
new ROOT::R::TRObject(Model);
195 r[
"RMLPModel"] << Model;
196 r <<
"save(RMLPModel,file='" + path +
"')";
224 other functions, these have to be given in a named list. See\ 225 the pruning demos for further explanation.the update function to use");
233 Log() <<
kERROR <<
" fMaxit <=0... that does not work !! " 234 <<
" I set it to 50 .. just so that the program does not crash" 259 ROOT::R::TRDataFrame fDfEvent;
260 for (
UInt_t i = 0; i < nvar; i++) {
267 mvaValue = result[0];
276 if (firstEvt > lastEvt || lastEvt > nEvents) lastEvt =
nEvents;
277 if (firstEvt < 0) firstEvt = 0;
279 nEvents = lastEvt-firstEvt;
291 std::vector<std::vector<Float_t> > inputData(nvars);
292 for (
UInt_t i = 0; i < nvars; i++) {
293 inputData[i] = std::vector<Float_t>(
nEvents);
296 for (
Int_t ievt=firstEvt; ievt<lastEvt; ievt++) {
300 for (
UInt_t i = 0; i < nvars; i++) {
301 inputData[i][ievt] = e->
GetValue(i);
307 ROOT::R::TRDataFrame evtData;
308 for (
UInt_t i = 0; i < nvars; i++) {
314 std::vector<Double_t> mvaValues(nEvents);
317 mvaValues = result.As<std::vector<Double_t>>();
334 ROOT::R::TRInterface::Instance().Require(
"RSNNS");
339 r <<
"load('" + path +
"')";
341 r[
"RMLPModel"] >> Model;
342 fModel =
new ROOT::R::TRObject(Model);
357 Log() <<
"Decision Trees and Rule-Based Models " <<
Endl;
UInt_t GetNVariables() const
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 SetCurrentEvent(Long64_t ievt) const
MsgLogger & Endl(MsgLogger &ml)
RooCmdArg Label(const char *str)
std::vector< TString > GetListOfVariables() const
returns list of variables
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
ROOT::R::TRFunctionImport predict
UInt_t GetNVariables() const
access the number of variables through the datasetinfo
void GetHelpMessage() const
std::vector< UInt_t > fFactorNumeric
ROOT::R::TRObject * fModel
TString GetElapsedTime(Bool_t Scientific=kTRUE)
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
virtual void TestClassification()
initialization
const TString & GetWeightFileDir() const
const Event * GetEvent() const
Types::ETreeType GetCurrentType() const
DataSetInfo & DataInfo() const
TString fUpdateFuncParams
std::vector< std::string > fFactorTrain
const char * GetName() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
ROOT::R::TRFunctionImport mlp
const TString & GetMethodName() const
UInt_t GetNVariables() const
accessor to the number of variables
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
ROOT::R::TRFunctionImport asfactor
MethodRSNNS(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
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
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
static Bool_t IsModuleLoaded
virtual void TestClassification()
initialization
const Event * GetEvent() const
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
Bool_t IsModelPersistence()