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

Node for LGBM without nan implementation. More...

#include <NodeImpl.h>

Collaboration diagram for MVAUtils::NodeLGBMSimple:

Public Member Functions

 NodeLGBMSimple (const int ivar, const float val, const index_t right)
 
void Print (index_t index) const
 
index_t GetNext (const float value, index_t index) const
 
bool IsLeaf () const
 is the current node a leaf node More...
 
var_t GetVar () const
 The variable index to cut on (or -1 if leaf, but use IsLeaf instead if checking for leaf) More...
 
float GetVal () const
 The value to cut on (if not leaf), or the response (if leaf). More...
 
index_t GetLeft (index_t index) const
 For debugging: returns the index of the left node; is passed the current node index. More...
 
index_t GetRight (index_t index) const
 For debugging: returns the index of the right node; is passed the current node index. More...
 

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...
 

Detailed Description

Node for LGBM without nan implementation.

This follow the implementation in LGBM next = value <= cut ? left : right

Does not support nan or categorical inputs.

Definition at line 91 of file NodeImpl.h.

Constructor & Destructor Documentation

◆ NodeLGBMSimple()

MVAUtils::NodeLGBMSimple::NodeLGBMSimple ( const int  ivar,
const float  val,
const index_t  right 
)
inline

Definition at line 94 of file NodeImpl.h.

95  : m_cut(val), m_right(right), m_var(ivar) { }

Member Function Documentation

◆ GetLeft()

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

For debugging: returns the index of the left node; is passed the current node index.

Definition at line 108 of file NodeImpl.h.

108 { return index + 1; }

◆ GetNext()

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

Definition at line 120 of file NodeImpl.h.

120  {
121  // note that this is different from TMVA (and not the opposite, e.g. cannot simply invert left/right)
122  return (value <= m_cut) ? GetLeft(index) : GetRight(index);
123  }

◆ GetRight()

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

For debugging: returns the index of the right node; is passed the current node index.

Definition at line 112 of file NodeImpl.h.

112 { return index + m_right; }

◆ GetVal()

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

The value to cut on (if not leaf), or the response (if leaf).

Definition at line 104 of file NodeImpl.h.

104 { return m_cut; }

◆ GetVar()

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

The variable index to cut on (or -1 if leaf, but use IsLeaf instead if checking for leaf)

Definition at line 101 of file NodeImpl.h.

101 { return m_var; }

◆ IsLeaf()

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

is the current node a leaf node

Definition at line 98 of file NodeImpl.h.

◆ Print()

void NodeLGBMSimple::Print ( index_t  index) const

Definition at line 18 of file NodeImpl.cxx.

19 {
20  std::cout << " Variable: " << int(m_var) << ", Cut: " << m_cut
21  << " (index = " << index << ")" << std::endl;
22 }

Member Data Documentation

◆ m_cut

float MVAUtils::NodeLGBMSimple::m_cut
private

cut value for internal nodes or response for leaf nodes

Definition at line 115 of file NodeImpl.h.

◆ m_right

int16_t MVAUtils::NodeLGBMSimple::m_right
private

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

Definition at line 116 of file NodeImpl.h.

◆ m_var

var_t MVAUtils::NodeLGBMSimple::m_var
private

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

Definition at line 117 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
athena.value
value
Definition: athena.py:122
MVAUtils::NodeLGBMSimple::m_cut
float m_cut
cut value for internal nodes or response for leaf nodes
Definition: NodeImpl.h:115
MVAUtils::NodeLGBMSimple::GetLeft
index_t GetLeft(index_t index) const
For debugging: returns the index of the left node; is passed the current node index.
Definition: NodeImpl.h:108
plotBeamSpotCompare.ivar
int ivar
Definition: plotBeamSpotCompare.py:383
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
MVAUtils::NodeLGBMSimple::m_right
int16_t m_right
right relative index (to be added to current) (left is always current + 1)
Definition: NodeImpl.h:116
MVAUtils::NodeLGBMSimple::m_var
var_t m_var
index of the variable to cut for internal nodes, -1 for leaf nodes
Definition: NodeImpl.h:117
MVAUtils::NodeLGBMSimple::GetRight
index_t GetRight(index_t index) const
For debugging: returns the index of the right node; is passed the current node index.
Definition: NodeImpl.h:112