ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
MVAUtils::NodeLGBM Class Reference

Node for LGBM with nan implementation. More...

#include <NodeImpl.h>

Collaboration diagram for MVAUtils::NodeLGBM:

Public Member Functions

 NodeLGBM (const int ivar, const float val, const index_t right, const int8_t default_left)
 
void Print (index_t index) const
 
index_t GetNext (const float value, index_t index) const
 
bool GetDefaultLeft () const
 
bool IsLeaf () const
 is the current node a leaf node More...
 
var_t GetVar () const
 
float GetVal () const
 
index_t GetLeft (index_t index) const
 
index_t GetRight (index_t index) const
 

Private Attributes

float m_cut
 cut value for internal nodes or response for leaf nodes More...
 
int16_t m_right
 right relative index (to be added to current) (left is always current + 1) More...
 
var_t m_var
 index of the variable to cut for internal nodes, -1 for leaf nodes More...
 
int8_t m_default_left
 

Detailed Description

Node for LGBM with nan implementation.

This follow the implementation in LGBM next = value != nan ? (value <= cut ? left : right) : (default_left ? left : right)

default_left is stored for each node (can be different) Does not support categorical inputs.

Definition at line 134 of file NodeImpl.h.

Constructor & Destructor Documentation

◆ NodeLGBM()

MVAUtils::NodeLGBM::NodeLGBM ( const int  ivar,
const float  val,
const index_t  right,
const int8_t  default_left 
)
inline

Definition at line 137 of file NodeImpl.h.

138  : m_cut(val), m_right(right), m_var(ivar), m_default_left(default_left) { }

Member Function Documentation

◆ GetDefaultLeft()

bool MVAUtils::NodeLGBM::GetDefaultLeft ( ) const
inline

Definition at line 141 of file NodeImpl.h.

141 { return m_default_left; }

◆ GetLeft()

index_t MVAUtils::NodeLGBM::GetLeft ( index_t  index) const
inline

Definition at line 146 of file NodeImpl.h.

146 { return index + 1; }

◆ GetNext()

index_t MVAUtils::NodeLGBM::GetNext ( const float  value,
index_t  index 
) const
inline

Definition at line 157 of file NodeImpl.h.

157  {
158  if (not std::isnan(value)) {
159  return (value <= m_cut) ? GetLeft(index) : GetRight(index);
160  }
161  else {
162  return (m_default_left) ? GetLeft(index) : GetRight(index);
163  }
164  }

◆ GetRight()

index_t MVAUtils::NodeLGBM::GetRight ( index_t  index) const
inline

Definition at line 147 of file NodeImpl.h.

147 { return index + m_right; }

◆ GetVal()

float MVAUtils::NodeLGBM::GetVal ( ) const
inline

Definition at line 145 of file NodeImpl.h.

145 { return m_cut; }

◆ GetVar()

var_t MVAUtils::NodeLGBM::GetVar ( ) const
inline

Definition at line 144 of file NodeImpl.h.

144 { return m_var; }

◆ IsLeaf()

bool MVAUtils::NodeLGBM::IsLeaf ( ) const
inline

is the current node a leaf node

Definition at line 142 of file NodeImpl.h.

◆ Print()

void NodeLGBM::Print ( index_t  index) const

Definition at line 25 of file NodeImpl.cxx.

26 {
27  std::cout << " Variable: " << int(m_var) << ", Cut: " << m_cut << ", DefaultLeft: " << (int)m_default_left
28  << " (index = " << index << ")" << std::endl;
29 }

Member Data Documentation

◆ m_cut

float MVAUtils::NodeLGBM::m_cut
private

cut value for internal nodes or response for leaf nodes

Definition at line 150 of file NodeImpl.h.

◆ m_default_left

int8_t MVAUtils::NodeLGBM::m_default_left
private

Definition at line 153 of file NodeImpl.h.

◆ m_right

int16_t MVAUtils::NodeLGBM::m_right
private

right relative index (to be added to current) (left is always current + 1)

Definition at line 151 of file NodeImpl.h.

◆ m_var

var_t MVAUtils::NodeLGBM::m_var
private

index of the variable to cut for internal nodes, -1 for leaf nodes

Definition at line 152 of file NodeImpl.h.


The documentation for this class was generated from the following files:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
index
Definition: index.py:1
MVAUtils::NodeLGBM::GetLeft
index_t GetLeft(index_t index) const
Definition: NodeImpl.h:146
athena.value
value
Definition: athena.py:122
MVAUtils::NodeLGBM::GetRight
index_t GetRight(index_t index) const
Definition: NodeImpl.h:147
MVAUtils::NodeLGBM::m_default_left
int8_t m_default_left
Definition: NodeImpl.h:153
plotBeamSpotCompare.ivar
int ivar
Definition: plotBeamSpotCompare.py:383
MVAUtils::NodeLGBM::m_cut
float m_cut
cut value for internal nodes or response for leaf nodes
Definition: NodeImpl.h:150
MVAUtils::NodeLGBM::m_var
var_t m_var
index of the variable to cut for internal nodes, -1 for leaf nodes
Definition: NodeImpl.h:152
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
MVAUtils::NodeLGBM::m_right
int16_t m_right
right relative index (to be added to current) (left is always current + 1)
Definition: NodeImpl.h:151