Skip to content
Snippets Groups Projects
Commit e53085a6 authored by Kim Albertsson's avatar Kim Albertsson Committed by Lorenzo Moneta
Browse files

[TMVA] BDTG -- Parallelise application get values

Simple to //-ise over number of output classes. Doing the same over
number of trees seems to yield no benefit for ~1000 depth=3 tree so this
was skipped (binary and multi class).

Optimal would be to //-ise over events, but the current design makes
this tricky.
parent f84a58f1
No related branches found
No related tags found
No related merge requests found
......@@ -2502,6 +2502,18 @@ const std::vector<Float_t>& TMVA::MethodBDT::GetMulticlassValues()
UInt_t nClasses = DataInfo().GetNClasses();
std::vector<Double_t> temp(nClasses);
auto forestSize = fForest.size();
#ifdef R__USE_IMT
std::vector<TMVA::DecisionTree *> forest = fForest;
auto get_output = [&e, &forest, &temp, forestSize, nClasses](UInt_t iClass) {
for (UInt_t itree = iClass; itree < forestSize; itree += nClasses) {
temp[iClass] += forest[itree]->CheckEvent(e, kFALSE);
}
};
TMVA::Config::Instance().GetThreadExecutor()
.Foreach(get_output, ROOT::TSeqU(nClasses));
#else
// trees 0, nClasses, 2*nClasses, ... belong to class 0
// trees 1, nClasses+1, 2*nClasses+1, ... belong to class 1 and so forth
UInt_t classOfTree = 0;
......@@ -2509,6 +2521,7 @@ const std::vector<Float_t>& TMVA::MethodBDT::GetMulticlassValues()
temp[classOfTree] += fForest[itree]->CheckEvent(e, kFALSE);
if (++classOfTree == nClasses) classOfTree = 0; // cheap modulo
}
#endif
// we want to calculate sum of exp(temp[j] - temp[i]) for all i,j (i!=j)
// first calculate exp(), then replace minus with division.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment