ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
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/GlobalAlgs/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/GlobalAlgs/Egamma1BDT/BDT.h.

59  {
60 
61  bool comparison[n_nodes];
62  bool activation[n_nodes];
63  bool activation_leaf[n_leaves] = {false};
64  score_t value_leaf[n_leaves];
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]]){
86  activation[i] = comparison[parent[i]] && activation[parent[i]];
87  }else{ // Else it is the right child
88  activation[i] = !comparison[parent[i]] && activation[parent[i]];
89  }
90  }
91  // Skim off the leaves
92  if(children_left[i] == -1){ // is a leaf
93  activation_leaf[iLeaf] = activation[i];
94  value_leaf[iLeaf] = value[i];
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:
x
#define x
GlobalSim::BDT::Tree::feature
int feature[n_nodes]
Definition: Trigger/TrigT1/Global/GlobalSimulation/src/GlobalAlgs/Egamma1BDT/BDT.h:52
GlobalSim::BDT::Tree::value
score_t value[n_nodes]
Definition: Trigger/TrigT1/Global/GlobalSimulation/src/GlobalAlgs/Egamma1BDT/BDT.h:54
lumiFormat.i
int i
Definition: lumiFormat.py:85
GlobalSim::score_t
ap_fixed< 10, 5 > score_t
Definition: parameters.h:21
GlobalSim::BDT::Tree::children_left
int children_left[n_nodes]
Definition: Trigger/TrigT1/Global/GlobalSimulation/src/GlobalAlgs/Egamma1BDT/BDT.h:55
threshold
Definition: chainparser.cxx:74
y
#define y
GlobalSim::BDT::Tree::parent
int parent[n_nodes]
Definition: Trigger/TrigT1/Global/GlobalSimulation/src/GlobalAlgs/Egamma1BDT/BDT.h:57