ATLAS Offline Software
Loading...
Searching...
No Matches
GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t > Struct Template Reference

#include <BDT.h>

Collaboration diagram for GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >:

Public Member Functions

score_t decision_function (input_t x) const

Public Attributes

int feature [n_nodes]
threshold_t threshold [n_nodes]
score_t value [n_nodes]
int children_left [n_nodes]
int children_right [n_nodes]
int parent [n_nodes]

Detailed Description

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
struct GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >

Definition at line 49 of file Trigger/TrigT1/Global/GlobalSimulation/src/FirstChain/Egamma1BDT/BDT.h.

Member Function Documentation

◆ decision_function()

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
score_t GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >::decision_function ( input_t x) const
inline

Definition at line 59 of file Trigger/TrigT1/Global/GlobalSimulation/src/FirstChain/Egamma1BDT/BDT.h.

59 {
60
61 bool comparison[n_nodes];
62 bool activation[n_nodes];
63 bool activation_leaf[n_leaves] = {false};
65
66 // Execute all comparisons
67 for(int i = 0; i < n_nodes; i++){
68 // Only non-leaf nodes do comparisons
69 // negative values mean is a leaf (sklearn: -2)
70 if(feature[i] >= 0){
71 comparison[i] = x[feature[i]] <= threshold[i];
72 }else{
73 comparison[i] = true;
74 }
75 }
76
77 // Determine node activity for all nodes
78 int iLeaf = 0;
79 for(int i = 0; i < n_nodes; i++){
80 // Root node is always active
81 if(i == 0){
82 activation[i] = true;
83 }else{
84 // If this node is the left child of its parent
85 if(i == children_left[parent[i]]){
87 }else{ // Else it is the right child
89 }
90 }
91 // Skim off the leaves
92 if(children_left[i] == -1){ // is a leaf
95 iLeaf++;
96 }
97 }
98
99 score_t y = 0;
100 for(int i = 0; i < n_leaves; i++){
101 if(activation_leaf[i]){
102 return value_leaf[i];
103 }
104 }
105 return y;
106 }

Member Data Documentation

◆ children_left

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
int GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >::children_left[n_nodes]

◆ children_right

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
int GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >::children_right[n_nodes]

◆ feature

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
int GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >::feature[n_nodes]

◆ parent

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
int GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >::parent[n_nodes]

◆ threshold

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
threshold_t GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >::threshold[n_nodes]

◆ value

template<int n_tree, int n_nodes, int n_leaves, class input_t, class score_t, class threshold_t>
score_t GlobalSim::BDT::Tree< n_tree, n_nodes, n_leaves, input_t, score_t, threshold_t >::value[n_nodes]

The documentation for this struct was generated from the following file: