36 fNodeResubstitutionEstimate(-1.0),
37 fResubstitutionEstimate(-1.0),
54 if(GetLeft() !=
NULL)
delete GetLeftDaughter();
55 if(GetRight() !=
NULL)
delete GetRightDaughter();
62 std::string header, title;
64 in >> title; in >> fNLeafDaughters;
65 in >> title; in >> fNodeResubstitutionEstimate;
66 in >> title; in >> fResubstitutionEstimate;
67 in >> title; in >> fAlphaC;
68 in >> title; in >> fMinAlphaC;
76 os <<
"----------------------" << std::endl
77 <<
"|~T_t| " << fNLeafDaughters << std::endl
78 <<
"R(t): " << fNodeResubstitutionEstimate << std::endl
79 <<
"R(T_t): " << fResubstitutionEstimate << std::endl
80 <<
"g(t): " << fAlphaC << std::endl
81 <<
"G(t): " << fMinAlphaC << std::endl;
89 if(this->GetLeft() !=
NULL && this->GetRight() !=
NULL) {
90 this->GetLeft()->PrintRec(os);
91 this->GetRight()->PrintRec(os);
169 std::cout <<
" ERROR in CCTreeWrapper::PruneNode: you try to prune a leaf node.. that does not make sense " << std::endl;
180 for (
UInt_t ievt=0; ievt < validationSample->size(); ievt++) {
181 Bool_t isSignalType = (CheckEvent(*(*validationSample)[ievt]) > fDTParent->GetNodePurityLimit() ) ? 1 : 0;
183 if (isSignalType == ((*validationSample)[ievt]->
GetClass() == 0)) {
184 ncorrect += (*validationSample)[ievt]->GetWeight();
187 nfalse += (*validationSample)[ievt]->GetWeight();
190 return ncorrect / (ncorrect + nfalse);
205 Bool_t isSignalType = (CheckEvent(*ev) > fDTParent->GetNodePurityLimit() ) ? 1 : 0;
207 if (isSignalType == (ev->
GetClass() == 0)) {
214 return ncorrect / (ncorrect + nfalse);
240 if (useYesNoLeaf)
return (current->
GetPurity() > fDTParent->GetNodePurityLimit() ? 1.0 : -1.0);
virtual ~CCTreeNode()
destructor of a CCTreeNode
CCTreeNode * fRoot
pointer to underlying DecisionTree
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
CCTreeNode * GetLeftDaughter()
virtual DecisionTreeNode * GetRight() const
virtual void SetRight(Node *r)
Double_t GetResubstitutionEstimate() const
virtual DecisionTreeNode * GetLeft() const
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not...
Double_t GetAlphaC() const
virtual DecisionTreeNode * GetRoot() const
void SetResubstitutionEstimate(Double_t R)
void InitTree(CCTreeNode *t)
initialize the node t and all its descendants
Double_t CheckEvent(const TMVA::Event &e, Bool_t useYesNoLeaf=false)
return the decision tree output for an event
virtual void SetLeft(Node *l)
CCTreeWrapper(DecisionTree *T, SeparationBase *qualityIndex)
constructor
Double_t GetNodeResubstitutionEstimate() const
Float_t GetPurity(void) const
DecisionTreeNode * GetDTNode() const
virtual void ReadContent(std::stringstream &s)
Float_t GetNBkgEvents(void) const
DecisionTree * fDTParent
pointer to the used quality index calculator
CCTreeNode * GetRightDaughter()
std::vector< Event * > EventList
Double_t TestTreeQuality(const EventList *validationSample)
return the misclassification rate of a pruned tree for a validation event sample using an EventList ...
SeparationBase * fQualityIndex
virtual void PrintRec(std::ostream &os) const
recursive printout of the node and its daughters
virtual void AddAttributesToNode(void *node) const
void SetNodeResubstitutionEstimate(Double_t R)
void SetNLeafDaughters(Int_t N)
virtual void AddContentToNode(std::stringstream &s) const
void SetMinAlphaC(Double_t alpha)
virtual Bool_t ReadDataRecord(std::istream &in, UInt_t tmva_Version_Code=TMVA_VERSION_CODE)
initialize a node from a data record
virtual void SetParent(Node *p)
virtual void Print(std::ostream &os) const
printout of the node (can be read in with ReadDataRecord)
const Event * GetEvent() const
void SetCurrentType(Types::ETreeType type) const
void Print(std::ostream &os, const OptionType &opt)
Double_t GetMinAlphaC() const
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
virtual Node * GetRight() const
void SetAlphaC(Double_t alpha)
Abstract ClassifierFactory template that handles arbitrary types.
virtual void ReadAttributes(void *node, UInt_t tmva_Version_Code=TMVA_VERSION_CODE)
Int_t GetNLeafDaughters() const
Float_t GetNSigEvents(void) const
~CCTreeWrapper()
destructor
CCTreeNode(DecisionTreeNode *n=NULL)
constructor of the CCTreeNode
void PruneNode(CCTreeNode *t)
remove the branch rooted at node t
virtual Bool_t GoesRight(const Event &) const
test event if it decends the tree at this node to the right
virtual Node * GetLeft() const