#include <BDT.h>
Public Member Functions | |
BDT (TTree *tree) | |
BDT (TMVA::MethodBDT *bdt) | |
void | newTree (const std::vector< int > &vars, const std::vector< float > &values) |
void | newTree (const TMVA::DecisionTreeNode *node) |
unsigned int | GetNTrees () const |
float | GetOffset () const |
float | GetResponse (const std::vector< float > &values) const |
float | GetResponse (const std::vector< float * > &pointers) const |
float | GetResponse () 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 |
std::vector< float > | GetMultiResponse (const std::vector< float * > &pointers, unsigned int numClasses) const |
std::vector< float > | GetValues () const |
std::vector< float * > | GetPointers () const |
void | SetPointers (std::vector< float * > &pointers) |
TTree * | WriteTree (TString name="BDT") |
void | PrintForest () const |
void | PrintTree (Node::index_t index) const |
Simplified Boosted Regression Tree, based on TMVA::DecisionTree. Holds a forest (vector of top nodes of each decision tree) and a constant offset (not always used). The response is given by in one of two ways: offset + the sum of the response of each tree, or 2.0/(1.0+exp(-2.0*sum))-1, with no offset. Additionally, there's a special return when the BDTs are trained with multiple classes.
Can be constructed from TMVA::MethodBDT or a TTree. 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)
BDT::BDT | ( | TTree * | tree | ) |
c-tor from TTree
BDT::BDT | ( | TMVA::MethodBDT * | bdt | ) |
c-tor from TMVA::MethodBDT
float BDT::GetGradBoostMVA | ( | const std::vector< float * > & | pointers | ) | const |
Return 2.0/(1.0+exp(-2.0*sum))-1, with no offset
float BDT::GetGradBoostMVA | ( | const std::vector< float > & | values | ) | const |
Return 2.0/(1.0+exp(-2.0*sum))-1, with no offset
std::vector< float > BDT::GetMultiResponse | ( | const std::vector< float * > & | pointers, | |
unsigned int | numClasses | |||
) | const |
special function when there are mutliple classes (for b-tagging)
std::vector< float > BDT::GetMultiResponse | ( | const std::vector< float > & | values, | |
unsigned int | numClasses | |||
) | const |
special function when there are mutliple classes (for b-tagging)
unsigned int MVAUtils::BDT::GetNTrees | ( | ) | const [inline] |
return the number of trees in the forest
float MVAUtils::BDT::GetOffset | ( | ) | const [inline] |
return the offset that is added to the response
std::vector<float*> MVAUtils::BDT::GetPointers | ( | ) | const [inline] |
Return stored pointers (which are used by GetResponse with no args)
float MVAUtils::BDT::GetResponse | ( | ) | const [inline] |
Return offset + the sum of the response of each tree, using saved pointers
float BDT::GetResponse | ( | const std::vector< float * > & | pointers | ) | const |
Return offset + the sum of the response of each tree
float BDT::GetResponse | ( | const std::vector< float > & | values | ) | const |
Return offset + the sum of the response of each tree
std::vector< float > BDT::GetValues | ( | ) | const |
Return the values corresponding to m_pointers (or an empty vector)
void BDT::newTree | ( | const TMVA::DecisionTreeNode * | node | ) |
Creates the full tree structure from TMVA::DecisionTree node.
void BDT::newTree | ( | const std::vector< int > & | vars, | |
const std::vector< float > & | values | |||
) |
Creates the full tree structure from what is stored in root file
void BDT::PrintForest | ( | ) | const |
For debugging only: print the forest
void BDT::PrintTree | ( | Node::index_t | index | ) | const |
For debugging only: Print the tree in a way that can compare implementations Using pre-order search for now
void MVAUtils::BDT::SetPointers | ( | std::vector< float * > & | pointers | ) | [inline] |
Set the stored pointers so that one can use GetResponse with no args
TTree * BDT::WriteTree | ( | TString | name = "BDT" |
) |
Return a TTree representing the BDT: each entry is a binary tree, each element of the vectors is a node