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);
26 tree->SetBranchAddress(
"values", &values);
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));