|
ATLAS Offline Software
|
Go to the documentation of this file.
17 std::vector<int> *vars =
nullptr;
18 std::vector<float> *
values =
nullptr;
21 std::vector<NodeTMVA> nodes;
23 tree->SetBranchAddress(
"vars", &vars);
27 int numEntries =
tree->GetEntries();
32 throw std::runtime_error(
33 "vars pointer is null in ForestTMVA constructor");
36 throw std::runtime_error(
37 "values pointers is null in ForestTMVA constructor");
39 if (vars->size() !=
values->size()) {
40 throw std::runtime_error(
41 "inconsistent size for vars and values in ForestTMVA constructor");
48 for (
size_t i = 0;
i < vars->size(); ++
i) {
49 nodes.emplace_back(vars->at(
i),
values->at(
i), right[
i]);
63 TTree *
tree =
new TTree(
name.Data(),
"creator=TMVA");
65 std::vector<int> vars;
70 tree->Branch(
"vars", &vars);
73 for (
size_t itree = 0; itree <
GetNTrees(); ++itree) {
77 vars.push_back(
node.GetVar());
88 std::cout <<
"***BDT TMVA: Printing entire forest***" << std::endl;
virtual TTree * WriteTree(TString name) const override
Return a TTree representing the BDT.
Node for TMVA implementation.
void newTree(const std::vector< NodeTMVA > &nodes, float weight)
std::vector< NodeTMVA > GetTree(unsigned int itree) const
Return the vector of nodes for the tree itree.
std::vector< index_t > computeRight(const std::vector< int > &vars)
Compute the offsets between the nodes to their right children from a serialized representation of the...
virtual unsigned int GetNTrees() const override final
virtual void PrintForest() const override
float GetTreeWeight(unsigned int itree) const
virtual void PrintForest() const override
Implement a Forest with weighted nodes This a general Forest class which implement the strategy used ...