1 |
bendavid |
1.1 |
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
#include "../interface/GBRForest.h"
|
5 |
|
|
//#include <iostream>
|
6 |
|
|
#include "TMVA/DecisionTree.h"
|
7 |
|
|
#include "TMVA/MethodBDT.h"
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
ClassImp(GBRForest)
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
//_______________________________________________________________________
|
14 |
|
|
GBRForest::GBRForest() :
|
15 |
|
|
fInitialResponse(0.)
|
16 |
|
|
{
|
17 |
|
|
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
//_______________________________________________________________________
|
21 |
|
|
GBRForest::~GBRForest()
|
22 |
|
|
{
|
23 |
|
|
for (UInt_t i=0; i<fTrees.size(); ++i) {
|
24 |
|
|
delete fTrees.at(i);
|
25 |
|
|
}
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
//_______________________________________________________________________
|
29 |
|
|
GBRForest::GBRForest(const TMVA::MethodBDT *bdt) :
|
30 |
|
|
TNamed("GBRForest","GBRForest"),
|
31 |
|
|
fInitialResponse(bdt->GetBoostWeights().front())
|
32 |
|
|
{
|
33 |
|
|
|
34 |
|
|
const std::vector<TMVA::DecisionTree*> &forest = bdt->GetForest();
|
35 |
|
|
for (std::vector<TMVA::DecisionTree*>::const_iterator it=forest.begin(); it!=forest.end(); ++it) {
|
36 |
|
|
GBRTree *tree = new GBRTree(*it);
|
37 |
|
|
fTrees.push_back(tree);
|
38 |
|
|
}
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|