42 fNodeResubstitutionEstimate(-1.0),
43 fResubstitutionEstimate(-1.0),
48 if (
n != NULL &&
n->GetRight() != NULL &&
n->GetLeft() != NULL ) {
60 if(GetLeft() != NULL)
delete GetLeftDaughter();
61 if(GetRight() != NULL)
delete GetRightDaughter();
68 std::string header, title;
70 in >> title; in >> fNLeafDaughters;
71 in >> title; in >> fNodeResubstitutionEstimate;
72 in >> title; in >> fResubstitutionEstimate;
73 in >> title; in >> fAlphaC;
74 in >> title; in >> fMinAlphaC;
82 os <<
"----------------------" << std::endl
83 <<
"|~T_t| " << fNLeafDaughters << std::endl
84 <<
"R(t): " << fNodeResubstitutionEstimate << std::endl
85 <<
"R(T_t): " << fResubstitutionEstimate << std::endl
86 <<
"g(t): " << fAlphaC << std::endl
87 <<
"G(t): " << fMinAlphaC << std::endl;
95 if(this->GetLeft() != NULL && this->GetRight() != NULL) {
96 this->GetLeft()->PrintRec(os);
97 this->GetRight()->PrintRec(os);
152 t->
SetAlphaC(std::numeric_limits<double>::infinity( ));
153 t->
SetMinAlphaC(std::numeric_limits<double>::infinity( ));
168 t->
SetAlphaC( std::numeric_limits<double>::infinity( ) );
169 t->
SetMinAlphaC( std::numeric_limits<double>::infinity( ) );
175 std::cout <<
" ERROR in CCTreeWrapper::PruneNode: you try to prune a leaf node.. that does not make sense " << std::endl;
186 for (
UInt_t ievt=0; ievt < validationSample->size(); ievt++) {
187 Bool_t isSignalType = (CheckEvent(*(*validationSample)[ievt]) > fDTParent->GetNodePurityLimit() ) ? 1 : 0;
189 if (isSignalType == ((*validationSample)[ievt]->GetClass() == 0)) {
190 ncorrect += (*validationSample)[ievt]->GetWeight();
193 nfalse += (*validationSample)[ievt]->GetWeight();
196 return ncorrect / (ncorrect + nfalse);
211 Bool_t isSignalType = (CheckEvent(*ev) > fDTParent->GetNodePurityLimit() ) ? 1 : 0;
213 if (isSignalType == (ev->
GetClass() == 0)) {
220 return ncorrect / (ncorrect + nfalse);
246 if (useYesNoLeaf)
return (current->
GetPurity() > fDTParent->GetNodePurityLimit() ? 1.0 : -1.0);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
void Print(GNN_Data &d, std::string txt="")
Int_t GetNLeafDaughters() const
void SetNLeafDaughters(Int_t N)
virtual void ReadAttributes(void *node, UInt_t tmva_Version_Code=262657)
Double_t GetMinAlphaC() const
Double_t GetNodeResubstitutionEstimate() const
virtual void ReadContent(std::stringstream &s)
virtual void AddAttributesToNode(void *node) const
void SetMinAlphaC(Double_t alpha)
DecisionTreeNode * GetDTNode() const
void SetResubstitutionEstimate(Double_t R)
CCTreeNode * GetLeftDaughter()
Double_t GetResubstitutionEstimate() const
virtual Bool_t ReadDataRecord(std::istream &in, UInt_t tmva_Version_Code=262657)
initialize a node from a data record
virtual void PrintRec(std::ostream &os) const
recursive printout of the node and its daughters
virtual void AddContentToNode(std::stringstream &s) const
CCTreeNode(DecisionTreeNode *n=nullptr)
constructor of the CCTreeNode
Double_t GetAlphaC() const
void SetAlphaC(Double_t alpha)
void SetNodeResubstitutionEstimate(Double_t R)
CCTreeNode * GetRightDaughter()
virtual ~CCTreeNode()
destructor of a CCTreeNode
virtual void Print(std::ostream &os) const
printout of the node (can be read in with ReadDataRecord)
SeparationBase * fQualityIndex
! pointer to the used quality index calculator
std::vector< Event * > EventList
DecisionTree * fDTParent
! pointer to underlying DecisionTree
CCTreeNode * fRoot
! the root node of the (wrapped) decision Tree
Double_t TestTreeQuality(const EventList *validationSample)
return the misclassification rate of a pruned tree for a validation event sample using an EventList
~CCTreeWrapper()
destructor
void InitTree(CCTreeNode *t)
initialize the node t and all its descendants
void PruneNode(CCTreeNode *t)
remove the branch rooted at node t
CCTreeWrapper(DecisionTree *T, SeparationBase *qualityIndex)
constructor
Double_t CheckEvent(const TMVA::Event &e, Bool_t useYesNoLeaf=false)
return the decision tree output for an event
Class that contains all the data information.
const Event * GetEvent() const
returns event without transformations
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
void SetCurrentType(Types::ETreeType type) const
Float_t GetNSigEvents(void) const
return the sum of the signal weights in the node, or -1 if traininfo undefined
virtual Bool_t GoesRight(const Event &) const
test event if it descends the tree at this node to the right
Float_t GetPurity(void) const
return S/(S+B) (purity) at this node (from training)
Float_t GetNBkgEvents(void) const
return the sum of the backgr weights in the node, or -1 if traininfo undefined
Implementation of a Decision Tree.
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not.
Node for the BinarySearch or Decision Trees.
virtual Node * GetLeft() const
virtual void SetRight(Node *r)
virtual void SetLeft(Node *l)
virtual void SetParent(Node *p)
virtual Node * GetRight() const
An interface to calculate the "SeparationGain" for different separation criteria used in various trai...
@ kValidation
these are placeholders... currently not used, but could be moved "forward" if
create variable transformations