A++ » TMVA » TMVA::DecisionTree

class TMVA::DecisionTree: public TMVA::BinaryTree


DecisionTree

Implementation of a Decision Tree


Function Members (Methods)

public:
virtual~DecisionTree()
virtual void*TMVA::BinaryTree::AddXMLTo(void* parent) const
voidApplyValidationSample(const TMVA::DecisionTree::EventConstList* validationSample) const
TMVA::BinaryTreeTMVA::BinaryTree::BinaryTree()
TMVA::BinaryTreeTMVA::BinaryTree::BinaryTree(const TMVA::BinaryTree&)
UInt_tBuildTree(const TMVA::DecisionTree::EventConstList& eventSample, TMVA::DecisionTreeNode* node = __null)
Double_tCheckEvent(const TMVA::Event*, Bool_t UseYesNoLeaf = kFALSE) const
voidCheckEventWithPrunedTree(const TMVA::Event*) const
static TClass*Class()
virtual const char*ClassName() const
UInt_tCleanTree(TMVA::DecisionTreeNode* node = __null)
voidClearTree()
UInt_tCountLeafNodes(TMVA::Node* n = __null)
UInt_tTMVA::BinaryTree::CountNodes(TMVA::Node* n = __null)
static TMVA::DecisionTree*CreateFromXML(void* node, UInt_t tmva_Version_Code = 262657)
virtual TMVA::DecisionTreeNode*CreateNode(UInt_t) const
virtual TMVA::BinaryTree*CreateTree() const
TMVA::DecisionTreeDecisionTree()
TMVA::DecisionTreeDecisionTree(const TMVA::DecisionTree& d)
TMVA::DecisionTreeDecisionTree(TMVA::SeparationBase* sepType, Float_t minSize, Int_t nCuts, TMVA::DataSetInfo* = __null, UInt_t cls = 0, Bool_t randomisedTree = kFALSE, Int_t useNvars = 0, Bool_t usePoissonNvars = kFALSE, UInt_t nMaxDepth = 9999999, Int_t iSeed = fgRandomSeed, Float_t purityLimit = 0.5, Int_t treeID = 0)
voidDescendTree(TMVA::Node* n = __null)
Bool_tDoRegression() const
voidFillEvent(const TMVA::Event& event, TMVA::DecisionTreeNode* node)
voidFillTree(const TMVA::DecisionTree::EventList& eventSample)
TMVA::Types::EAnalysisTypeGetAnalysisType()
TMVA::DecisionTreeNode*GetEventNode(const TMVA::Event& e) const
vector<Double_t>GetFisherCoefficients(const TMVA::DecisionTree::EventConstList& eventSample, UInt_t nFisherVars, UInt_t* mapVarInFisher)
TMVA::Node*TMVA::BinaryTree::GetLeftDaughter(TMVA::Node* n)
UInt_tTMVA::BinaryTree::GetNNodes() const
Int_tGetNNodesBeforePruning()
TMVA::Node*GetNode(ULong_t sequence, UInt_t depth)
Double_tGetNodePurityLimit() const
Double_tGetPruneStrength() const
voidGetRandomisedVariables(Bool_t* useVariable, UInt_t* variableMap, UInt_t& nVars)
TMVA::Node*TMVA::BinaryTree::GetRightDaughter(TMVA::Node* n)
virtual TMVA::DecisionTreeNode*GetRoot() const
Double_tGetSumWeights(const TMVA::DecisionTree::EventConstList* validationSample) const
UInt_tTMVA::BinaryTree::GetTotalTreeDepth() const
Int_tGetTreeID()
vector<Double_t>GetVariableImportance()
Double_tGetVariableImportance(UInt_t ivar)
virtual TClass*IsA() const
TMVA::DecisionTree&operator=(const TMVA::DecisionTree&)
virtual voidTMVA::BinaryTree::Print(ostream& os) const
voidPruneNode(TMVA::DecisionTreeNode* node)
voidPruneNodeInPlace(TMVA::DecisionTreeNode* node)
Double_tPruneTree(const TMVA::DecisionTree::EventConstList* validationSample = __null)
virtual voidTMVA::BinaryTree::Read(istream& istr, UInt_t tmva_Version_Code = 262657)
virtual voidTMVA::BinaryTree::ReadXML(void* node, UInt_t tmva_Version_Code = 262657)
voidSetAnalysisType(TMVA::Types::EAnalysisType t)
voidSetMinLinCorrForFisher(Double_t min)
voidSetNodePurityLimit(Double_t p)
voidSetNVars(Int_t n)
voidSetParentTreeInNodes(TMVA::Node* n = __null)
voidSetPruneMethod(TMVA::DecisionTree::EPruneMethod m = kCostComplexityPruning)
voidSetPruneStrength(Double_t p)
voidTMVA::BinaryTree::SetRoot(TMVA::Node* r)
voidTMVA::BinaryTree::SetTotalTreeDepth(Int_t depth)
voidTMVA::BinaryTree::SetTotalTreeDepth(TMVA::Node* n = __null)
voidSetTreeID(Int_t treeID)
voidSetUseExclusiveVars(Bool_t t = kTRUE)
voidSetUseFisherCuts(Bool_t t = kTRUE)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
Double_tTestPrunedTreeQuality(const TMVA::DecisionTreeNode* dt = __null, Int_t mode = 0) const
Double_tTrainNode(const TMVA::DecisionTree::EventConstList& eventSample, TMVA::DecisionTreeNode* node)
Double_tTrainNodeFast(const TMVA::DecisionTree::EventConstList& eventSample, TMVA::DecisionTreeNode* node)
Double_tTrainNodeFull(const TMVA::DecisionTree::EventConstList& eventSample, TMVA::DecisionTreeNode* node)
protected:
voidTMVA::BinaryTree::DeleteNode(TMVA::Node*)
TMVA::MsgLogger&TMVA::BinaryTree::Log() const
private:
Double_tSamplePurity(TMVA::DecisionTree::EventList eventSample)

Data Members

public:
static TMVA::DecisionTree::EPruneMethodkCostComplexityPruning
static TMVA::DecisionTree::EPruneMethodkExpectedErrorPruning
static TMVA::DecisionTree::EPruneMethodkNoPruning
protected:
UInt_tTMVA::BinaryTree::fDepthmaximal depth in tree reached
UInt_tTMVA::BinaryTree::fNNodestotal number of nodes in the tree (counted)
TMVA::Node*TMVA::BinaryTree::fRootthe root node of the tree
private:
TMVA::Types::EAnalysisTypefAnalysisTypekClassification(=0=false) or kRegression(=1=true)
TMVA::DataSetInfo*fDataSetInfo
UInt_tfMaxDepthmax depth
Double_tfMinLinCorrForFisherthe minimum linear correlation between two variables demanded for use in fisher criterium in node splitting
Double_tfMinNodeSizemin fraction of training events in node
Double_tfMinSepGainmin number of separation gain to perform node splitting
Double_tfMinSizemin number of events in node
TRandom3*fMyTrandomrandom number generator for randomised trees
Int_tfNCutsnumber of grid point in variable cut scans
Int_tfNNodesBeforePruningremember this one (in case of pruning, it allows to monitor the before/after
Double_tfNodePurityLimitpurity limit to decide whether a node is signal
UInt_tfNvarsnumber of variables used to separate S and B
TMVA::DecisionTree::EPruneMethodfPruneMethodmethod used for prunig
Double_tfPruneStrengtha parameter to set the "amount" of pruning..needs to be adjusted
Bool_tfRandomisedTreechoose at each node splitting a random set of variables
TMVA::RegressionVariance*fRegTypethe separation crition used in Regression
TMVA::SeparationBase*fSepTypethe separation crition
UInt_tfSigClassclass which is treated as signal when building the tree
Int_tfTreeIDjust an ID number given to the tree.. makes debugging easier as tree knows who he is.
Bool_tfUseExclusiveVarsindividual variables already used in fisher criterium are not anymore analysed individually for node splitting
Bool_tfUseFisherCutsuse multivariate splits using the Fisher criterium
Int_tfUseNvarsthe number of variables used in randomised trees;
Bool_tfUsePoissonNvarsuse "fUseNvars" not as fixed number but as mean of a possion distr. in each split
Bool_tfUseSearchTreecut scan done with binary trees or simple event loop.
vector<Double_t>fVariableImportancethe relative importance of the different variables
static const Int_tfgDebugLeveldebug level determining some printout/control plots etc.
static const Int_tfgRandomSeedset nonzero for debugging and zero for random seeds

Class Charts

Inheritance Chart:
TMVA::BinaryTree
TMVA::DecisionTree

Function documentation

DecisionTree(const TMVA::DecisionTree& d)
 the constructur needed for the "reading" of the decision tree from weight files
DecisionTree(TMVA::SeparationBase* sepType, Float_t minSize, Int_t nCuts, TMVA::DataSetInfo* = __null, UInt_t cls = 0, Bool_t randomisedTree = kFALSE, Int_t useNvars = 0, Bool_t usePoissonNvars = kFALSE, UInt_t nMaxDepth = 9999999, Int_t iSeed = fgRandomSeed, Float_t purityLimit = 0.5, Int_t treeID = 0)
 the constructur needed for constructing the decision tree via training with events
virtual ~DecisionTree( void )
 copy constructor
DecisionTreeNode* GetRoot() const
 Retrieves the address of the root node
{ return dynamic_cast<TMVA::DecisionTreeNode*>(fRoot); }
DecisionTreeNode * CreateNode(UInt_t ) const
{ return new DecisionTreeNode(); }
BinaryTree* CreateTree() const
{ return new DecisionTree(); }
DecisionTree* CreateFromXML(void* node, UInt_t tmva_Version_Code = 262657)
const char* ClassName() const
{ return "DecisionTree"; }
UInt_t BuildTree(const TMVA::DecisionTree::EventConstList& eventSample, TMVA::DecisionTreeNode* node = __null)
 building of a tree by recursivly splitting the nodes
      UInt_t BuildTree( const EventList & eventSample,
                        DecisionTreeNode *node = NULL);
{ return TrainNodeFast( eventSample, node ); }
Double_t TrainNodeFast(const TMVA::DecisionTree::EventConstList& eventSample, TMVA::DecisionTreeNode* node)
 determine the way how a node is split (which variable, which cut value)
Double_t TrainNodeFull(const TMVA::DecisionTree::EventConstList& eventSample, TMVA::DecisionTreeNode* node)
void GetRandomisedVariables(Bool_t* useVariable, UInt_t* variableMap, UInt_t& nVars)
std::vector<Double_t> GetFisherCoefficients(const TMVA::DecisionTree::EventConstList& eventSample, UInt_t nFisherVars, UInt_t* mapVarInFisher)
void FillTree(const TMVA::DecisionTree::EventList& eventSample)
 fill at tree with a given structure already (just see how many signa/bkgr
 events end up in each node
void FillEvent(const TMVA::Event& event, TMVA::DecisionTreeNode* node)
 fill the existing the decision tree structure by filling event
 in from the top node and see where they happen to end up
TMVA::DecisionTreeNode* GetEventNode(const TMVA::Event& e) const
 returns: 1 = Signal (right),  -1 = Bkg (left)
std::vector< Double_t > GetVariableImportance()
 return the individual relative variable importance
Double_t GetVariableImportance(UInt_t ivar)
void ClearTree()
 clear the tree nodes (their S/N, Nevents etc), just keep the structure of the tree
void SetPruneMethod(TMVA::DecisionTree::EPruneMethod m = kCostComplexityPruning)
{ fPruneMethod = m; }
Double_t PruneTree(const TMVA::DecisionTree::EventConstList* validationSample = __null)
 recursive pruning of the tree, validation sample required for automatic pruning
void SetPruneStrength(Double_t p)
 manage the pruning strength parameter (iff < 0 -> automate the pruning process)
Double_t GetPruneStrength() const
{ return fPruneStrength; }
void ApplyValidationSample(const TMVA::DecisionTree::EventConstList* validationSample) const
 apply pruning validation sample to a decision tree
Double_t TestPrunedTreeQuality(const TMVA::DecisionTreeNode* dt = __null, Int_t mode = 0) const
 return the misclassification rate of a pruned tree
void CheckEventWithPrunedTree(const TMVA::Event* ) const
 pass a single validation event throught a pruned decision tree
Double_t GetSumWeights(const TMVA::DecisionTree::EventConstList* validationSample) const
 calculate the normalization factor for a pruning validation sample
void SetNodePurityLimit(Double_t p)
Double_t GetNodePurityLimit() const
{ return fNodePurityLimit; }
void DescendTree(TMVA::Node* n = __null)
void SetParentTreeInNodes(TMVA::Node* n = __null)
Node* GetNode(ULong_t sequence, UInt_t depth)
 retrieve node from the tree. Its position (up to a maximal tree depth of 64)
 is coded as a sequence of left-right moves starting from the root, coded as
 0-1 bit patterns stored in the "long-integer" together with the depth
UInt_t CleanTree(TMVA::DecisionTreeNode* node = __null)
void PruneNode(TMVA::DecisionTreeNode* node)
void PruneNodeInPlace(TMVA::DecisionTreeNode* node)
 prune a node from the tree without deleting its descendants; allows one to
 effectively prune a tree many times without making deep copies
Int_t GetNNodesBeforePruning()
UInt_t CountLeafNodes(TMVA::Node* n = __null)
void SetTreeID(Int_t treeID)
{fTreeID = treeID;}
Int_t GetTreeID()
{return fTreeID;}
Bool_t DoRegression() const
{ return fAnalysisType == Types::kRegression; }
void SetAnalysisType(TMVA::Types::EAnalysisType t)
Types::EAnalysisType GetAnalysisType( void )
{ return fAnalysisType;}
void SetUseFisherCuts(Bool_t t = kTRUE)
void SetMinLinCorrForFisher(Double_t min)
void SetUseExclusiveVars(Bool_t t = kTRUE)
void SetNVars(Int_t n)
{fNvars = n;}
Double_t SamplePurity(TMVA::DecisionTree::EventList eventSample)
 utility functions
 calculate the Purity out of the number of sig and bkg events collected
 from individual samples.
 calculates the purity S/(S+B) of a given event sample