ATLAS Offline Software
|
Simplified Boosted Regression Tree, support TMVA, lgbm, and xgboost. More...
#include <BDT.h>
Public Member Functions | |
BDT (TTree *tree) | |
Constructor. More... | |
BDT (std::unique_ptr< IForest > forest) | |
BDT ()=delete | |
BDT (const BDT &)=delete | |
BDT & | operator= (const BDT &)=delete |
BDT (BDT &&)=default | |
default move ctor, move assignment and dtor More... | |
BDT & | operator= (BDT &&)=default |
~BDT ()=default | |
unsigned int | GetNTrees () const |
Number of trees in the whole forest. More... | |
int | GetNVars () const |
Number of variables expected in the inputs. More... | |
float | GetOffset () const |
Get the offset to the whole forest. More... | |
float | GetResponse (const std::vector< float > &values) const |
Get response of the forest, for regression. More... | |
float | GetResponse (const std::vector< float * > &pointers) const |
float | GetResponse () const |
float | GetClassification (const std::vector< float > &values) const |
Get response of the forest, for classification. More... | |
float | GetClassification (const std::vector< float * > &pointers) const |
float | GetClassification () const |
float | GetGradBoostMVA (const std::vector< float > &values) const |
float | GetGradBoostMVA (const std::vector< float * > &pointers) const |
std::vector< float > | GetMultiResponse (const std::vector< float > &values, unsigned int numClasses) const |
Get response of the forest, for multiclassification (e.g. More... | |
std::vector< float > | GetMultiResponse (const std::vector< float * > &pointers, unsigned int numClasses) const |
std::vector< float > | GetMultiResponse (unsigned int numClasses) const |
std::vector< float > | GetValues () const |
Return the values corresponding to m_pointers (or an empty vector) More... | |
const std::vector< float * > & | GetPointers () const |
Return stored pointers (which are used by methods with no args) More... | |
void | SetPointers (const std::vector< float * > &pointers) |
Set the stored pointers so that one can use methods with no args. More... | |
TTree * | WriteTree (TString name="BDT") const |
Return a TTree representing the BDT: each entry is a binary tree, each element of the vectors is a node. More... | |
void | PrintForest () const |
for debugging, print out tree or forest to stdout More... | |
void | PrintTree (unsigned int itree) const |
float | GetTreeResponse (const std::vector< float > &values, MVAUtils::index_t index) const |
for debugging, return the response of a sigle tree given the index of its top node More... | |
float | GetTreeResponse (const std::vector< float * > &pointers, MVAUtils::index_t index) const |
Private Attributes | |
std::unique_ptr< IForest > | m_forest |
the implementation of the forest, doing the hard work More... | |
std::vector< float * > | m_pointers |
where vars to cut on can be set (but can also be passed) More... | |
Simplified Boosted Regression Tree, support TMVA, lgbm, and xgboost.
Holds a forest (vector of top nodes of each decision tree) and a constant offset or set of weights (not always used).
Each entry of the TTree represents a binary tree and each element of the vectors stored in the TTree represent a node.
The response can be evaluated from a vector of floats or a vector of pointers (to avoid creating vectors at each call) which can be stored internally (m_pointers)
|
explicit |
Constructor.
The input tree must be created with convertLGBMToRootTree.py (for lgbm training) or with convertXGBoostToRootTree.py (for xgboost training) or with convertXmlToRootTree (for tmva training)
|
inlineexplicit |
|
delete |
|
default |
default move ctor, move assignment and dtor
default move ctor, move assignment
|
default |
float MVAUtils::BDT::GetClassification | ( | ) | const |
float MVAUtils::BDT::GetClassification | ( | const std::vector< float * > & | pointers | ) | const |
float MVAUtils::BDT::GetClassification | ( | const std::vector< float > & | values | ) | const |
Get response of the forest, for classification.
float MVAUtils::BDT::GetGradBoostMVA | ( | const std::vector< float * > & | pointers | ) | const |
float MVAUtils::BDT::GetGradBoostMVA | ( | const std::vector< float > & | values | ) | const |
std::vector<float> MVAUtils::BDT::GetMultiResponse | ( | const std::vector< float * > & | pointers, |
unsigned int | numClasses | ||
) | const |
std::vector<float> MVAUtils::BDT::GetMultiResponse | ( | const std::vector< float > & | values, |
unsigned int | numClasses | ||
) | const |
Get response of the forest, for multiclassification (e.g.
b-tagging)
std::vector<float> MVAUtils::BDT::GetMultiResponse | ( | unsigned int | numClasses | ) | const |
unsigned int MVAUtils::BDT::GetNTrees | ( | ) | const |
Number of trees in the whole forest.
int MVAUtils::BDT::GetNVars | ( | ) | const |
Number of variables expected in the inputs.
float MVAUtils::BDT::GetOffset | ( | ) | const |
Get the offset to the whole forest.
const std::vector<float*>& MVAUtils::BDT::GetPointers | ( | ) | const |
Return stored pointers (which are used by methods with no args)
float MVAUtils::BDT::GetResponse | ( | ) | const |
float MVAUtils::BDT::GetResponse | ( | const std::vector< float * > & | pointers | ) | const |
float MVAUtils::BDT::GetResponse | ( | const std::vector< float > & | values | ) | const |
Get response of the forest, for regression.
float MVAUtils::BDT::GetTreeResponse | ( | const std::vector< float * > & | pointers, |
MVAUtils::index_t | index | ||
) | const |
float MVAUtils::BDT::GetTreeResponse | ( | const std::vector< float > & | values, |
MVAUtils::index_t | index | ||
) | const |
for debugging, return the response of a sigle tree given the index of its top node
std::vector<float> MVAUtils::BDT::GetValues | ( | ) | const |
Return the values corresponding to m_pointers (or an empty vector)
void BDT::PrintForest | ( | ) | const |
void BDT::PrintTree | ( | unsigned int | itree | ) | const |
void MVAUtils::BDT::SetPointers | ( | const std::vector< float * > & | pointers | ) |
Set the stored pointers so that one can use methods with no args.
TTree * BDT::WriteTree | ( | TString | name = "BDT" | ) | const |
|
private |
|
private |