![]() |
ATLAS Offline Software
|
Simplified Boosted Regression Tree, support TMVA, lgbm, and xgboost. More...
#include <BDT.h>
Public Member Functions | |
| BDT (TTree *tree) | |
| Constructor. | |
| 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 | |
| BDT & | operator= (BDT &&)=default |
| ~BDT ()=default | |
| unsigned int | GetNTrees () const |
| Number of trees in the whole forest. | |
| int | GetNVars () const |
| Number of variables expected in the inputs. | |
| float | GetOffset () const |
| Get the offset to the whole forest. | |
| float | GetResponse (const std::vector< float > &values) const |
| Get response of the forest, for regression. | |
| 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. | |
| 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. | |
| 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). | |
| const std::vector< float * > & | GetPointers () const |
| Return stored pointers (which are used by methods with no args). | |
| void | SetPointers (const std::vector< float * > &pointers) |
| Set the stored pointers so that one can use methods with no args. | |
| 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. | |
| void | PrintForest () const |
| for debugging, print out tree or forest to stdout | |
| 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 | |
| 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 | |
| std::vector< float * > | m_pointers |
| where vars to cut on can be set (but can also be passed) | |
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)
Definition at line 34 of file Reconstruction/MVAUtils/MVAUtils/BDT.h.
|
explicit |
Constructor.
c-tor from TTree
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)
Definition at line 57 of file BDT.cxx.
|
inlineexplicit |
Definition at line 44 of file Reconstruction/MVAUtils/MVAUtils/BDT.h.
|
delete |
|
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 |
the implementation of the forest, doing the hard work
Definition at line 107 of file Reconstruction/MVAUtils/MVAUtils/BDT.h.
|
private |
where vars to cut on can be set (but can also be passed)
Definition at line 108 of file Reconstruction/MVAUtils/MVAUtils/BDT.h.