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);
Int_t GetNLeafDaughters() const
void SetNLeafDaughters(Int_t N)
Double_t GetMinAlphaC() const
Double_t GetNodeResubstitutionEstimate() const
virtual void ReadContent(std::stringstream &s)
CCTreeNode(DecisionTreeNode *n=NULL)
constructor of the CCTreeNode
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 void PrintRec(std::ostream &os) const
recursive printout of the node and its daughters
virtual void AddContentToNode(std::stringstream &s) const
Double_t GetAlphaC() const
virtual Bool_t ReadDataRecord(std::istream &in, UInt_t tmva_Version_Code=TMVA_VERSION_CODE)
initialize a node from a data record
void SetAlphaC(Double_t alpha)
void SetNodeResubstitutionEstimate(Double_t R)
CCTreeNode * GetRightDaughter()
virtual ~CCTreeNode()
destructor of a CCTreeNode
virtual void ReadAttributes(void *node, UInt_t tmva_Version_Code=TMVA_VERSION_CODE)
virtual void Print(std::ostream &os) const
printout of the node (can be read in with ReadDataRecord)
SeparationBase * fQualityIndex
std::vector< Event * > EventList
DecisionTree * fDTParent
pointer to the used quality index calculator
CCTreeNode * fRoot
pointer to underlying DecisionTree
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
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
void SetCurrentType(Types::ETreeType type) const
Float_t GetNSigEvents(void) const
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
Float_t GetNBkgEvents(void) const
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...
void Print(std::ostream &os, const OptionType &opt)
static constexpr double s
create variable transformations