|  | ATLAS Offline Software
    | 
 
 
 
Go to the documentation of this file.
   19     std::vector<int> *vars = 
nullptr;
 
   20     std::vector<float> *
values = 
nullptr;
 
   21     std::vector<bool> *default_left = 
nullptr;
 
   23     std::vector<NodeXGBoost> nodes;
 
   25     tree->SetBranchAddress(
"vars", &vars);
 
   27     tree->SetBranchAddress(
"default_left", &default_left);
 
   29     for (
int i = 0; 
i < 
tree->GetEntries(); ++
i)
 
   33         if (!vars) { 
throw std::runtime_error(
"vars pointer is null in ForestXGBoost constructor"); }
 
   34         if (!
values) { 
throw std::runtime_error(
"values pointers is null in ForestXGBoost constructor"); }
 
   35         if (!default_left) { 
throw std::runtime_error(
"default_left pointers is null in ForestXGBoost constructor"); }
 
   36         if (vars->size() != 
values->size()) { 
throw std::runtime_error(
"inconsistent size for vars and values in ForestXGBoost constructor"); }
 
   37         if (default_left->size() != 
values->size()) { 
throw std::runtime_error(
"inconsistent size for default_left and values in ForestXGBoost constructor"); }
 
   43         for (
size_t i = 0; 
i < vars->size(); ++
i) {
 
   44             nodes.emplace_back(vars->at(
i), 
values->at(
i), right[
i], default_left->at(
i));
 
   57     TTree *
tree = 
new TTree(
name.Data(), 
"creator=xgboost");
 
   59     std::vector<int> vars;
 
   61     std::vector<bool> default_left;
 
   63     tree->Branch(
"vars", &vars);
 
   65     tree->Branch(
"default_left", &default_left);
 
   67     for (
size_t itree = 0; itree < 
GetNTrees(); ++itree) {
 
   72             vars.push_back(
node.GetVar());
 
   74             default_left.push_back(
node.GetDefaultLeft());
 
   83     std::cout << 
"***BDT XGBoost: Printing entire forest***" << std::endl;
 
  
std::vector< NodeXGBoost > GetTree(unsigned int itree) const
Return the vector of nodes for the tree itree.
Node for XGBoost with nan implementation.
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
void newTree(const std::vector< NodeXGBoost > &nodes)
append a new tree (defined by a vector of nodes serialized in preorder) to the forest
virtual void PrintForest() const override
virtual void PrintForest() const override
virtual TTree * WriteTree(TString name) const override
Return a TTree representing the BDT.