Base class for BinarySearch and Decision Trees.
Definition at line 62 of file BinaryTree.h.
Public Member Functions | |
BinaryTree (void) | |
constructor for a yet "empty" tree. Needs to be filled afterwards | |
virtual | ~BinaryTree () |
destructor (deletes the nodes and "events" if owned by the tree | |
virtual void * | AddXMLTo (void *parent) const |
add attributes to XML | |
virtual const char * | ClassName () const =0 |
UInt_t | CountNodes (Node *n=nullptr) |
return the number of nodes in the tree. (make a new count --> takes time) | |
virtual Node * | CreateNode (UInt_t size=0) const =0 |
virtual BinaryTree * | CreateTree () const =0 |
Node * | GetLeftDaughter (Node *n) |
get left daughter node current node "n" | |
UInt_t | GetNNodes () const |
Node * | GetRightDaughter (Node *n) |
get right daughter node current node "n" | |
virtual Node * | GetRoot () const |
UInt_t | GetTotalTreeDepth () const |
virtual TClass * | IsA () const |
virtual void | Print (std::ostream &os) const |
recursively print the tree | |
virtual void | Read (std::istream &istr, UInt_t tmva_Version_Code=262657) |
Read the binary tree from an input stream. | |
virtual void | ReadXML (void *node, UInt_t tmva_Version_Code=262657) |
read attributes from XML | |
void | SetRoot (Node *r) |
void | SetTotalTreeDepth (Int_t depth) |
void | SetTotalTreeDepth (Node *n=nullptr) |
descend a tree to find all its leaf nodes, fill max depth reached in the tree at the same time. | |
virtual void | Streamer (TBuffer &) |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Protected Member Functions | |
void | DeleteNode (Node *) |
protected, recursive, function used by the class destructor and when Pruning | |
MsgLogger & | Log () const |
Protected Attributes | |
UInt_t | fDepth |
maximal depth in tree reached | |
UInt_t | fNNodes |
total number of nodes in the tree (counted) | |
Node * | fRoot |
the root node of the tree the tree only has it's root node, the "daughters" are taken care of by the "node" properties of the "root" | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const BinaryTree &tree) |
std::istream & | operator>> (std::istream &istr, BinaryTree &tree) |
#include <TMVA/BinaryTree.h>
TMVA::BinaryTree::BinaryTree | ( | void | ) |
constructor for a yet "empty" tree. Needs to be filled afterwards
Definition at line 55 of file BinaryTree.cxx.
|
virtual |
destructor (deletes the nodes and "events" if owned by the tree
Definition at line 65 of file BinaryTree.cxx.
|
virtual |
add attributes to XML
Definition at line 134 of file BinaryTree.cxx.
Definition at line 122 of file BinaryTree.h.
Implemented in TMVA::BinarySearchTree, and TMVA::DecisionTree.
UInt_t TMVA::BinaryTree::CountNodes | ( | TMVA::Node * | n = nullptr | ) |
return the number of nodes in the tree. (make a new count --> takes time)
Definition at line 103 of file BinaryTree.cxx.
Implemented in TMVA::BinarySearchTree, and TMVA::DecisionTree.
|
pure virtual |
Implemented in TMVA::BinarySearchTree, and TMVA::DecisionTree.
Definition at line 122 of file BinaryTree.h.
|
protected |
protected, recursive, function used by the class destructor and when Pruning
Definition at line 74 of file BinaryTree.cxx.
TMVA::Node * TMVA::BinaryTree::GetLeftDaughter | ( | Node * | n | ) |
get left daughter node current node "n"
Definition at line 87 of file BinaryTree.cxx.
|
inline |
Definition at line 86 of file BinaryTree.h.
TMVA::Node * TMVA::BinaryTree::GetRightDaughter | ( | Node * | n | ) |
get right daughter node current node "n"
Definition at line 95 of file BinaryTree.cxx.
Reimplemented in TMVA::DecisionTree.
Definition at line 83 of file BinaryTree.h.
|
inline |
Definition at line 93 of file BinaryTree.h.
Reimplemented in TMVA::BinarySearchTree, and TMVA::DecisionTree.
Definition at line 122 of file BinaryTree.h.
|
protected |
Definition at line 235 of file BinaryTree.cxx.
|
virtual |
recursively print the tree
Definition at line 125 of file BinaryTree.cxx.
|
virtual |
Read the binary tree from an input stream.
The input stream format depends on the tree type, it is defined be the node of the tree
Definition at line 169 of file BinaryTree.cxx.
|
virtual |
read attributes from XML
Definition at line 144 of file BinaryTree.cxx.
|
inline |
Definition at line 80 of file BinaryTree.h.
|
inline |
Definition at line 95 of file BinaryTree.h.
void TMVA::BinaryTree::SetTotalTreeDepth | ( | Node * | n = nullptr | ) |
descend a tree to find all its leaf nodes, fill max depth reached in the tree at the same time.
Definition at line 213 of file BinaryTree.cxx.
Reimplemented in TMVA::BinarySearchTree, and TMVA::DecisionTree.
|
inline |
Definition at line 122 of file BinaryTree.h.
|
friend |
|
friend |
|
protected |
maximal depth in tree reached
Definition at line 118 of file BinaryTree.h.
|
protected |
total number of nodes in the tree (counted)
Definition at line 117 of file BinaryTree.h.
|
protected |
the root node of the tree the tree only has it's root node, the "daughters" are taken care of by the "node" properties of the "root"
Definition at line 110 of file BinaryTree.h.