20 ClassImp(RMethodBase);
23 RMethodBase::RMethodBase(
const TString &jobName,
24 Types::EMVA methodType,
25 const TString &methodTitle,
27 const TString &theOption , ROOT::R::TRInterface &_r): MethodBase(jobName, methodType, methodTitle, dsi, theOption),
34 RMethodBase::RMethodBase(Types::EMVA methodType,
36 const TString &weightFile,ROOT::R::TRInterface &_r): MethodBase(methodType, dsi, weightFile),
43 void RMethodBase::LoadData()
48 const UInt_t nvar = DataInfo().GetNVariables();
50 const UInt_t ntrains = Data()->GetNTrainingEvents();
53 std::vector<std::vector<Float_t> > fArrayTrain(nvar);
57 fWeightTrain.ResizeTo(ntrains);
58 for (UInt_t j = 0; j < ntrains; j++) {
59 const Event *ev = Data()->GetEvent(j, Types::ETreeType::kTraining);
62 if (ev->GetClass() == Types::kSignal) fFactorTrain.push_back(
"signal");
63 else fFactorTrain.push_back(
"background");
65 fWeightTrain[j] = ev->GetWeight();
68 for (UInt_t i = 0; i < nvar; i++) {
69 fArrayTrain[i].push_back(ev->GetValue(i));
73 for (UInt_t i = 0; i < nvar; i++) {
74 fDfTrain[DataInfo().GetListOfVariables()[i].Data()] = fArrayTrain[i];
80 const UInt_t ntests = Data()->GetNTestEvents();
81 const UInt_t nspectators = DataInfo().GetNSpectators(kTRUE);
84 std::vector<std::vector<Float_t> > fArrayTest(nvar);
86 std::vector<std::vector<Float_t> > fArraySpectators(nvar);
87 fWeightTest.ResizeTo(ntests);
89 for (UInt_t j = 0; j < ntests; j++) {
90 const Event *ev = Data()->GetEvent(j, Types::ETreeType::kTesting);
93 if (ev->GetClass() == Types::kSignal) fFactorTest.push_back(
"signal");
94 else fFactorTest.push_back(
"background");
96 fWeightTest[j] = ev->GetWeight();
98 for (UInt_t i = 0; i < nvar; i++) {
99 fArrayTest[i].push_back(ev->GetValue(i));
101 for (UInt_t i = 0; i < nspectators; i++) {
102 fArraySpectators[i].push_back(ev->GetSpectator(i));
105 for (UInt_t i = 0; i < nvar; i++) {
106 fDfTest[DataInfo().GetListOfVariables()[i].Data()] = fArrayTest[i];
108 for (UInt_t i = 0; i < nspectators; i++) {
109 fDfSpectators[DataInfo().GetSpectatorInfo(i).GetLabel().Data()] = fArraySpectators[i];