51MethodRSNNS::MethodRSNNS(
const TString &jobName,
52 const TString &methodTitle,
54 const TString &theOption) :
59 asfactor(
"as.factor"),
97 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;
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"
246 Log() << kINFO <<
"Testing Classification " <<
fNetType <<
" METHOD " <<
Endl;
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++) {
299 assert(nvars ==
e->GetNVariables());
300 for (
UInt_t i = 0; i < nvars; i++) {
301 inputData[i][ievt] =
e->GetValue(i);
308 for (
UInt_t i = 0; i < nvars; i++) {
314 std::vector<Double_t> mvaValues(nEvents);
317 mvaValues = result.
As<std::vector<Double_t>>();
322 Log() << kINFO <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"Elapsed time for evaluation of " << nEvents <<
" events: "
335 TString path = GetWeightFileDir() +
"/" +
GetName() +
".RData";
339 r <<
"load('" + path +
"')";
341 r[
"RMLPModel"] >> Model;
357 Log() <<
"Decision Trees and Rule-Based Models " <<
Endl;
#define REGISTER_METHOD(CLASS)
for example
char * Form(const char *fmt,...)
This is a class to create DataFrames from ROOT to R.
static TRInterface & Instance()
static method to get an TRInterface instance reference
Bool_t Require(TString pkg)
Method to load an R's package.
Int_t Eval(const TString &code, TRObject &ans)
Method to eval R code and you get the result in a reference to TRObject.
This is a class to get ROOT's objects from R's objects.
T As()
Some datatypes of ROOT or c++ can be wrapped in to a TRObject, this method lets you unwrap those data...
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
Class that contains all the data information.
UInt_t GetNVariables() const
std::vector< TString > GetListOfVariables() const
returns list of variables
const Event * GetEvent() const
Types::ETreeType GetCurrentType() const
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
UInt_t GetNVariables() const
access the number of variables through the datasetinfo
void SetCurrentEvent(Long64_t ievt) const
std::vector< Float_t > & GetValues()
const char * GetName() const
const TString & GetWeightFileDir() const
const TString & GetMethodName() const
const Event * GetEvent() const
DataSetInfo & DataInfo() const
virtual void TestClassification()
initialization
Bool_t IsModelPersistence()
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
static Bool_t IsModuleLoaded
void GetHelpMessage() const
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
ROOT::R::TRFunctionImport predict
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
TString fUpdateFuncParams
virtual void TestClassification()
initialization
MethodRSNNS(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
std::vector< UInt_t > fFactorNumeric
ROOT::R::TRFunctionImport mlp
ROOT::R::TRObject * fModel
std::vector< std::string > fFactorTrain
ROOT::R::TRDataFrame fDfTrain
Timing information for training and evaluation of MVA methods.
TString GetElapsedTime(Bool_t Scientific=kTRUE)
returns pretty string with elapsed time
Singleton class for Global types used by TMVA.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
std::string GetName(const std::string &scope_name)
Rcpp::internal::NamedPlaceHolder Label
Abstract ClassifierFactory template that handles arbitrary types.
MsgLogger & Endl(MsgLogger &ml)