Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Experimental::RBDT Class Referencefinal

Definition at line 37 of file RBDT.hxx.

Public Types

typedef float Value_t
 

Public Member Functions

 RBDT ()=default
 IO constructor (both for ROOT IO and LoadText()).
 
 RBDT (const std::string &key, const std::string &filename)
 Construct backends from model in ROOT file.
 
template<typename Vector >
Vector Compute (const Vector &x) const
 Compute model prediction on a single event.
 
RTensor< Value_tCompute (RTensor< Value_t > const &x) const
 Compute model prediction on input RTensor.
 
std::vector< Value_tCompute (std::vector< Value_t > const &x) const
 Compute model prediction on a single event.
 
TClassIsA () const
 
void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static RBDT LoadText (std::string const &txtpath, std::vector< std::string > &features, int nClasses, bool logistic, Value_t baseScore)
 

Private Types

using IndexMap = std::unordered_map< int, int >
 Map from XGBoost to RBDT indices.
 

Private Member Functions

void ComputeImpl (const Value_t *array, Value_t *out) const
 
Value_t EvaluateBinary (const Value_t *array) const
 
void Softmax (const Value_t *array, Value_t *out) const
 

Static Private Member Functions

static void correctIndices (std::span< int > indices, IndexMap const &nodeIndices, IndexMap const &leafIndices)
 RBDT uses a more efficient representation of the BDT in flat arrays.
 
static RBDT LoadText (std::istream &is, std::vector< std::string > &features, int nClasses, bool logistic, Value_t baseScore)
 
static void terminateTree (TMVA::Experimental::RBDT &ff, int &nPreviousNodes, int &nPreviousLeaves, IndexMap &nodeIndices, IndexMap &leafIndices, int &treesSkipped)
 

Private Attributes

std::vector< Value_tfBaseResponses
 
Value_t fBaseScore = 0.0
 
std::vector< unsigned intfCutIndices
 
std::vector< Value_tfCutValues
 
std::vector< intfLeftIndices
 
bool fLogistic = false
 
std::vector< Value_tfResponses
 
std::vector< intfRightIndices
 
std::vector< intfRootIndices
 
std::vector< intfTreeNumbers
 

#include <TMVA/RBDT.hxx>

Member Typedef Documentation

◆ IndexMap

using TMVA::Experimental::RBDT::IndexMap = std::unordered_map<int, int>
private

Map from XGBoost to RBDT indices.

Definition at line 70 of file RBDT.hxx.

◆ Value_t

Definition at line 39 of file RBDT.hxx.

Constructor & Destructor Documentation

◆ RBDT() [1/2]

TMVA::Experimental::RBDT::RBDT ( )
default

IO constructor (both for ROOT IO and LoadText()).

◆ RBDT() [2/2]

TMVA::Experimental::RBDT::RBDT ( const std::string &  key,
const std::string &  filename 
)

Construct backends from model in ROOT file.

Definition at line 357 of file RBDT.cxx.

Member Function Documentation

◆ Class()

static TClass * TMVA::Experimental::RBDT::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TMVA::Experimental::RBDT::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TMVA::Experimental::RBDT::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 92 of file RBDT.hxx.

◆ Compute() [1/3]

template<typename Vector >
Vector TMVA::Experimental::RBDT::Compute ( const Vector &  x) const
inline

Compute model prediction on a single event.

The method is intended to be used with std::vectors-like containers, for example RVecs.

Definition at line 52 of file RBDT.hxx.

◆ Compute() [2/3]

RTensor< TMVA::Experimental::RBDT::Value_t > TMVA::Experimental::RBDT::Compute ( RTensor< Value_t > const &  x) const

Compute model prediction on input RTensor.

Definition at line 109 of file RBDT.cxx.

◆ Compute() [3/3]

std::vector< Value_t > TMVA::Experimental::RBDT::Compute ( std::vector< Value_t > const &  x) const
inline

Compute model prediction on a single event.

Definition at line 61 of file RBDT.hxx.

◆ ComputeImpl()

void TMVA::Experimental::RBDT::ComputeImpl ( const Value_t array,
Value_t out 
) const
private

Definition at line 156 of file RBDT.cxx.

◆ correctIndices()

void TMVA::Experimental::RBDT::correctIndices ( std::span< int indices,
IndexMap const &  nodeIndices,
IndexMap const &  leafIndices 
)
staticprivate

RBDT uses a more efficient representation of the BDT in flat arrays.

This function translates the indices to the RBDT indices. In RBDT, leaf nodes are stored in separate arrays. To encode this, the sign of the index is flipped.

Definition at line 191 of file RBDT.cxx.

◆ DeclFileName()

static const char * TMVA::Experimental::RBDT::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 92 of file RBDT.hxx.

◆ EvaluateBinary()

TMVA::Experimental::RBDT::Value_t TMVA::Experimental::RBDT::EvaluateBinary ( const Value_t array) const
private

Definition at line 169 of file RBDT.cxx.

◆ IsA()

TClass * TMVA::Experimental::RBDT::IsA ( ) const
inline
Returns
TClass describing current object

Definition at line 92 of file RBDT.hxx.

◆ LoadText() [1/2]

TMVA::Experimental::RBDT TMVA::Experimental::RBDT::LoadText ( std::istream &  is,
std::vector< std::string > &  features,
int  nClasses,
bool  logistic,
Value_t  baseScore 
)
staticprivate

Definition at line 248 of file RBDT.cxx.

◆ LoadText() [2/2]

TMVA::Experimental::RBDT TMVA::Experimental::RBDT::LoadText ( std::string const &  txtpath,
std::vector< std::string > &  features,
int  nClasses,
bool  logistic,
Value_t  baseScore 
)
static

Definition at line 234 of file RBDT.cxx.

◆ Softmax()

void TMVA::Experimental::RBDT::Softmax ( const Value_t array,
Value_t out 
) const
private

Definition at line 129 of file RBDT.cxx.

◆ Streamer()

void TMVA::Experimental::RBDT::Streamer ( TBuffer )

◆ StreamerNVirtual()

void TMVA::Experimental::RBDT::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 92 of file RBDT.hxx.

◆ terminateTree()

void TMVA::Experimental::RBDT::terminateTree ( TMVA::Experimental::RBDT ff,
int nPreviousNodes,
int nPreviousLeaves,
IndexMap nodeIndices,
IndexMap leafIndices,
int treesSkipped 
)
staticprivate

Definition at line 212 of file RBDT.cxx.

Member Data Documentation

◆ fBaseResponses

std::vector<Value_t> TMVA::Experimental::RBDT::fBaseResponses
private

Definition at line 88 of file RBDT.hxx.

◆ fBaseScore

Value_t TMVA::Experimental::RBDT::fBaseScore = 0.0
private

Definition at line 89 of file RBDT.hxx.

◆ fCutIndices

std::vector<unsigned int> TMVA::Experimental::RBDT::fCutIndices
private

Definition at line 82 of file RBDT.hxx.

◆ fCutValues

std::vector<Value_t> TMVA::Experimental::RBDT::fCutValues
private

Definition at line 83 of file RBDT.hxx.

◆ fLeftIndices

std::vector<int> TMVA::Experimental::RBDT::fLeftIndices
private

Definition at line 84 of file RBDT.hxx.

◆ fLogistic

bool TMVA::Experimental::RBDT::fLogistic = false
private

Definition at line 90 of file RBDT.hxx.

◆ fResponses

std::vector<Value_t> TMVA::Experimental::RBDT::fResponses
private

Definition at line 86 of file RBDT.hxx.

◆ fRightIndices

std::vector<int> TMVA::Experimental::RBDT::fRightIndices
private

Definition at line 85 of file RBDT.hxx.

◆ fRootIndices

std::vector<int> TMVA::Experimental::RBDT::fRootIndices
private

Definition at line 81 of file RBDT.hxx.

◆ fTreeNumbers

std::vector<int> TMVA::Experimental::RBDT::fTreeNumbers
private

Definition at line 87 of file RBDT.hxx.

Libraries for TMVA::Experimental::RBDT:

The documentation for this class was generated from the following files: