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

Definition at line 36 of file RBDT.hxx.

Public Types

typedef float Value_t
 

Public Member Functions

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.
 

Static Public Member Functions

static RBDT LoadXGBoost (std::string const &jsonPath)
 Construct an RBDT from an XGBoost model in its native JSON serialization.
 

Private Types

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

Private Member Functions

 RBDT ()=default
 Private default constructor, used by the public LoadXGBoost() factory.
 
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 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 65 of file RBDT.hxx.

◆ Value_t

Definition at line 38 of file RBDT.hxx.

Constructor & Destructor Documentation

◆ RBDT()

TMVA::Experimental::RBDT::RBDT ( )
privatedefault

Private default constructor, used by the public LoadXGBoost() factory.

Member Function Documentation

◆ 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 45 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 99 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 54 of file RBDT.hxx.

◆ ComputeImpl()

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

Definition at line 146 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 181 of file RBDT.cxx.

◆ EvaluateBinary()

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

Definition at line 159 of file RBDT.cxx.

◆ LoadXGBoost()

TMVA::Experimental::RBDT TMVA::Experimental::RBDT::LoadXGBoost ( std::string const & jsonPath)
static

Construct an RBDT from an XGBoost model in its native JSON serialization.

This reads the structured model that XGBoost writes with Booster.save_model(). That format stores each tree as a set of parallel arrays and references features by index, so no feature-name resolution is needed. Everything else (objective, base score, number of classes) is taken from the file, which makes this a self-contained, Python-free entry point.

Definition at line 231 of file RBDT.cxx.

◆ Softmax()

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

Definition at line 119 of file RBDT.cxx.

◆ terminateTree()

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

Definition at line 202 of file RBDT.cxx.

Member Data Documentation

◆ fBaseResponses

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

Definition at line 81 of file RBDT.hxx.

◆ fBaseScore

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

Definition at line 82 of file RBDT.hxx.

◆ fCutIndices

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

Definition at line 75 of file RBDT.hxx.

◆ fCutValues

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

Definition at line 76 of file RBDT.hxx.

◆ fLeftIndices

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

Definition at line 77 of file RBDT.hxx.

◆ fLogistic

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

Definition at line 83 of file RBDT.hxx.

◆ fResponses

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

Definition at line 79 of file RBDT.hxx.

◆ fRightIndices

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

Definition at line 78 of file RBDT.hxx.

◆ fRootIndices

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

Definition at line 74 of file RBDT.hxx.

◆ fTreeNumbers

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

Definition at line 80 of file RBDT.hxx.

Libraries for TMVA::Experimental::RBDT:

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