ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
int16_t m_right
 right relative index (to be added to current) (left is always current + 1)
var_t m_var
 index of the variable to cut for internal nodes, -1 for leaf nodes
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) { }
int8_t m_default_left
Definition NodeImpl.h:153
var_t m_var
index of the variable to cut for internal nodes, -1 for leaf nodes
Definition NodeImpl.h:152
int16_t m_right
right relative index (to be added to current) (left is always current + 1)
Definition NodeImpl.h:151
float m_cut
cut value for internal nodes or response for leaf nodes
Definition NodeImpl.h:150

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; }
str index
Definition DeMoScan.py:362

◆ 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 }
index_t GetRight(index_t index) const
Definition NodeImpl.h:147
index_t GetLeft(index_t index) const
Definition NodeImpl.h:146

◆ 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: