#ifndef ROOT_TMVA_DecisionTree
#define ROOT_TMVA_DecisionTree
#include "TH2.h"
#include "TRandom.h"
#include "TRandom2.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,
Bool_t randomisedTree=kFALSE, Int_t useNvars=0, Int_t iSeed=0);
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 ) { return TrainNodeFast( eventSample, node ); }
Double_t TrainNodeFast( vector<TMVA::Event*> & eventSample, DecisionTreeNode *node );
Double_t TrainNodeFull( 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, kNoPruning };
void SetPruneMethod( EPruneMethod m = kCostComplexityPruning ) { fPruneMethod = m; }
void PruneTree();
void SetPruneStrength( Double_t p ) { fPruneStrength = p; }
void SetNodePurityLimit( Double_t p ) { fNodePurityLimit = p; }
Double_t GetNodePurityLimit( ) const { return fNodePurityLimit; }
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 );
void CleanTree(DecisionTreeNode *node=NULL);
void PruneTreeEEP(DecisionTreeNode *node);
void PruneTreeCC();
void PruneNode(TMVA::DecisionTreeNode *node);
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;
Double_t fNodePurityLimit;
Bool_t fRandomisedTree;
Int_t fUseNvars;
TRandom2 *fMyTrandom;
std::vector< Double_t > fVariableImportance;
SeparationBase *fQualityIndex;
static const Int_t fgDebugLevel = 0;
ClassDef(DecisionTree,0)
};
}
#endif
Last change: Sat Nov 1 10:21:33 2008
Last generated: 2008-11-01 10:21
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.