24 #ifndef ROOT_TMVA_CCTreeWrapper
25 #define ROOT_TMVA_CCTreeWrapper
40 typedef std::vector<Event*> EventList;
47 class CCTreeNode :
virtual public Node {
51 CCTreeNode( DecisionTreeNode* n = NULL );
52 virtual ~CCTreeNode( );
54 virtual Node* CreateNode()
const {
return new CCTreeNode(); }
57 inline void SetNLeafDaughters( Int_t N ) { fNLeafDaughters = (N > 0 ? N : 0); }
60 inline Int_t GetNLeafDaughters()
const {
return fNLeafDaughters; }
63 inline void SetNodeResubstitutionEstimate( Double_t R ) { fNodeResubstitutionEstimate = (R >= 0 ? R : 0.0); }
66 inline Double_t GetNodeResubstitutionEstimate( )
const {
return fNodeResubstitutionEstimate; }
70 inline void SetResubstitutionEstimate( Double_t R ) { fResubstitutionEstimate = (R >= 0 ? R : 0.0); }
73 inline Double_t GetResubstitutionEstimate( )
const {
return fResubstitutionEstimate; }
80 inline void SetAlphaC( Double_t alpha ) { fAlphaC = alpha; }
83 inline Double_t GetAlphaC( )
const {
return fAlphaC; }
86 inline void SetMinAlphaC( Double_t alpha ) { fMinAlphaC = alpha; }
89 inline Double_t GetMinAlphaC( )
const {
return fMinAlphaC; }
92 inline DecisionTreeNode* GetDTNode( )
const {
return fDTNode; }
95 inline CCTreeNode* GetLeftDaughter( ) {
return dynamic_cast<CCTreeNode*
>(GetLeft()); }
96 inline CCTreeNode* GetRightDaughter( ) {
return dynamic_cast<CCTreeNode*
>(GetRight()); }
97 inline CCTreeNode* GetMother( ) {
return dynamic_cast<CCTreeNode*
>(GetParent()); }
100 virtual void Print( std::ostream& os )
const;
103 virtual void PrintRec ( std::ostream& os )
const;
105 virtual void AddAttributesToNode(
void* node)
const;
106 virtual void AddContentToNode(std::stringstream& s)
const;
110 inline virtual Bool_t GoesRight(
const Event& e )
const {
return (GetDTNode() != NULL ?
111 GetDTNode()->GoesRight(e) :
false); }
114 inline virtual Bool_t GoesLeft (
const Event& e )
const {
return (GetDTNode() != NULL ?
115 GetDTNode()->GoesLeft(e) :
false); }
117 virtual void ReadAttributes(
void* node, UInt_t tmva_Version_Code = TMVA_VERSION_CODE);
118 virtual void ReadContent(std::stringstream& s);
119 virtual Bool_t ReadDataRecord( std::istream& in, UInt_t tmva_Version_Code = TMVA_VERSION_CODE );
123 Int_t fNLeafDaughters;
124 Double_t fNodeResubstitutionEstimate;
125 Double_t fResubstitutionEstimate;
128 DecisionTreeNode* fDTNode;
131 CCTreeWrapper( DecisionTree* T, SeparationBase* qualityIndex );
135 Double_t CheckEvent(
const TMVA::Event & e, Bool_t useYesNoLeaf =
false );
137 Double_t TestTreeQuality(
const EventList* validationSample );
138 Double_t TestTreeQuality(
const DataSet* validationSample );
141 void PruneNode( CCTreeNode* t );
143 void InitTree( CCTreeNode* t );
146 CCTreeNode* GetRoot() {
return fRoot; }
148 SeparationBase* fQualityIndex;
149 DecisionTree* fDTParent;