48 if (
n != NULL &&
n->GetRight() != NULL &&
n->GetLeft() != NULL ) {
49 SetRight( new CCTreeNode( ((DecisionTreeNode*) n->GetRight()) ) );
50 GetRight()->SetParent(this);
51 SetLeft( new CCTreeNode( ((DecisionTreeNode*) n->GetLeft()) ) );
52 GetLeft()->SetParent(this);
68 std::string header, title;
82 os <<
"----------------------" << std::endl
86 <<
"g(t): " <<
fAlphaC << std::endl
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++) {
189 if (isSignalType == ((*validationSample)[ievt]->GetClass() == 0)) {
190 ncorrect += (*validationSample)[ievt]->GetWeight();
193 nfalse += (*validationSample)[ievt]->GetWeight();
196 return ncorrect / (ncorrect + nfalse);
213 if (isSignalType == (ev->
GetClass() == 0)) {
220 return ncorrect / (ncorrect + nfalse);
246 if (useYesNoLeaf)
return (current->
GetPurity() >
fDTParent->GetNodePurityLimit() ? 1.0 : -1.0);
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
Double_t fMinAlphaC
! G(t), minimum critical point of t and its descendants
Int_t GetNLeafDaughters() const
void SetNLeafDaughters(Int_t N)
void ReadContent(std::stringstream &s) override
void PrintRec(std::ostream &os) const override
recursive printout of the node and its daughters
Double_t GetMinAlphaC() const
Double_t GetNodeResubstitutionEstimate() const
Double_t fNodeResubstitutionEstimate
! R(t) = misclassification rate for node t
void SetMinAlphaC(Double_t alpha)
DecisionTreeNode * GetDTNode() const
void SetResubstitutionEstimate(Double_t R)
CCTreeNode * GetLeftDaughter()
Double_t fAlphaC
! critical point, g(t) = alpha_c(t)
void AddContentToNode(std::stringstream &s) const override
Double_t GetResubstitutionEstimate() const
Double_t fResubstitutionEstimate
! R(T_t) = sum[t' in ~T_t]{ R(t) }
DecisionTreeNode * fDTNode
! pointer to wrapped node in the decision tree
Bool_t ReadDataRecord(std::istream &in, UInt_t tmva_Version_Code=262657) override
initialize a node from a data record
CCTreeNode(DecisionTreeNode *n=nullptr)
constructor of the CCTreeNode
Double_t GetAlphaC() const
void SetAlphaC(Double_t alpha)
void ReadAttributes(void *node, UInt_t tmva_Version_Code=262657) override
void Print(std::ostream &os) const override
printout of the node (can be read in with ReadDataRecord)
void SetNodeResubstitutionEstimate(Double_t R)
CCTreeNode * GetRightDaughter()
virtual ~CCTreeNode()
destructor of a CCTreeNode
Int_t fNLeafDaughters
! number of terminal descendants
void AddAttributesToNode(void *node) const override
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
Bool_t GoesRight(const Event &) const override
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.
virtual Node * GetLeft() const
virtual void SetRight(Node *r)
virtual void SetLeft(Node *l)
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