#ifndef ROOT_TMVA_DecisionTree
#define ROOT_TMVA_DecisionTree
#include "TH2.h"
#ifndef ROOT_TMVA_DecisionTreeNode
#include "TMVA/DecisionTreeNode.h"
#endif
#ifndef ROOT_TMVA_BinarySearchTree
#include "TMVA/BinaryTree.h"
#endif
#ifndef ROOT_TMVA_BinarySearchTree
#include "TMVA/BinarySearchTree.h"
#endif
#ifndef ROOT_TMVA_SeparationBase
#include "TMVA/SeparationBase.h"
#endif
using std::vector;
namespace TMVA {
   
   class Event;
   
   class DecisionTree : public BinaryTree {
      
   public:
      
      
      DecisionTree( void );
      
      DecisionTree( DecisionTreeNode *n );
      
      DecisionTree( SeparationBase *sepType,Int_t minSize, 
                    Int_t nCuts, SeparationBase *qtype=NULL );
      
      DecisionTree (const DecisionTree &d);
      virtual ~DecisionTree( void );
      virtual Node * CreateNode() { return new DecisionTreeNode(); }
  
      
      Int_t BuildTree( vector<TMVA::Event*> & eventSample, 
                       DecisionTreeNode *node = NULL );
      
      Double_t TrainNode( vector<TMVA::Event*> & eventSample,  DecisionTreeNode *node );
      
      
      void FillTree( vector<TMVA::Event*> & eventSample);
      
      
      void FillEvent( TMVA::Event & event,  
                      TMVA::DecisionTreeNode *node  );
      
      Double_t CheckEvent( const TMVA::Event & , Bool_t UseYesNoLeaf = kFALSE ); 
      
      vector< Double_t > GetVariableImportance();
      Double_t GetVariableImportance(Int_t ivar);
      
      void ClearTree();
      
      enum EPruneMethod { kExpectedErrorPruning=0, kCostComplexityPruning, kMCC, kNoPruning };
      void SetPruneMethod( EPruneMethod m = kCostComplexityPruning ) { fPruneMethod = m; }
      
      void PruneTree();
      void SetPruneStrength( Double_t p ) { fPruneStrength = p; }
      Double_t GetCostComplexity( Double_t alpha );
      Double_t GetCostComplexityIfNextPruneStep( Double_t alpha );
      void DescendTree( DecisionTreeNode *n = NULL );
      void SetParentTreeInNodes( DecisionTreeNode *n = NULL );
      DecisionTreeNode* GetLeftDaughter( DecisionTreeNode *n );
      DecisionTreeNode* GetRightDaughter( DecisionTreeNode *n );
      
      
      
      DecisionTreeNode* GetNode( ULong_t sequence, UInt_t depth );
      TH2D* DrawTree( TString hname );
      void DrawNode( TH2D* h,  DecisionTreeNode *n, 
                     Double_t y, Double_t x, Double_t scale);
      UInt_t GetDepth() { return fDepth; }
      multimap<Double_t,TMVA::DecisionTreeNode* >& GetQualityGainMap() { return fQualityGainMap; }
      multimap<Double_t,TMVA::DecisionTreeNode* >& GetQualityMap()     { return fQualityMap; }
      void FillQualityMap(DecisionTreeNode* n=NULL); 
      void FillQualityGainMap(DecisionTreeNode* n=NULL); 
      void PruneTreeEEP(DecisionTreeNode *node);
      void PruneTreeCC();
      void PruneTreeMCC();
      DecisionTreeNode* FindCCPruneCandidate();
      void PruneNode(TMVA::DecisionTreeNode *node);
      TMVA::DecisionTreeNode* GetWeakestLink();
      void FillLinkStrengthMap(TMVA::DecisionTreeNode *n = NULL);
      multimap<Double_t,TMVA::DecisionTreeNode* >& GetLinkStrengthMap(){ return fLinkStrengthMap; }
      Double_t MisClassificationCostOfNode(TMVA::DecisionTreeNode *n);
      Double_t MisClassificationCostOfSubTree(TMVA::DecisionTreeNode *n = NULL);
      UInt_t CountLeafNodes(TMVA::DecisionTreeNode *n = NULL);
   private:
      Double_t GetNodeError(DecisionTreeNode *node);
      Double_t GetSubTreeError(DecisionTreeNode *node);
      
      
      
      
      void FindMinAndMax(vector<TMVA::Event*> & eventSample,
                         vector<Double_t> & min,
                         vector<Double_t> & max);
      
      
      void SetCutPoints(vector<Double_t> & cut_points,
                        Double_t xmin,
                        Double_t xmax,
                        Int_t num_gridpoints);
            
      
      
      
      
      Double_t SamplePurity(vector<Event*> eventSample);
      
      Int_t     fNvars;          
      Int_t     fNCuts;          
      SeparationBase *fSepType;  
      
      Double_t  fMinSize;        
      Double_t  fMinSepGain;     
      
      Bool_t    fUseSearchTree;  
      Double_t  fPruneStrength;  
      
      EPruneMethod fPruneMethod; 
      vector< Double_t > fVariableImportance; 
      
      UInt_t     fDepth;         
      SeparationBase *fQualityIndex;  
      multimap<Double_t,TMVA::DecisionTreeNode*> fQualityGainMap;  
      multimap<Double_t,TMVA::DecisionTreeNode*> fQualityMap;      
      multimap<Double_t,TMVA::DecisionTreeNode*> fLinkStrengthMap; 
      static const Int_t  fgDebugLevel = 0;     
      ClassDef(DecisionTree,0)                  
   };
} 
#endif 
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.