32#ifndef ROOT_TMVA_DecisionTree
33#define ROOT_TMVA_DecisionTree
98 virtual const char*
ClassName()
const {
return "DecisionTree"; }
#define ClassDef(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char mode
#define TMVA_VERSION_CODE
Base class for BinarySearch and Decision Trees.
Node * fRoot
the root node of the tree the tree only has it's root node, the "daughters" are taken care of by the ...
Class that contains all the data information.
Implementation of a Decision Tree.
Bool_t DoRegression() const
Int_t fNNodesBeforePruning
remember this one (in case of pruning, it allows to monitor the before/after
void SetAnalysisType(Types::EAnalysisType t)
Double_t fMinSize
min number of events in node
void SetUseExclusiveVars(Bool_t t=kTRUE)
UInt_t BuildTree(const EventConstList &eventSample, DecisionTreeNode *node=nullptr)
building the decision tree by recursively calling the splitting of one (root-) node into two daughter...
Double_t GetNodePurityLimit() const
void FillTree(const EventList &eventSample)
fill the existing the decision tree structure by filling event in from the top node and see where the...
Double_t fMinNodeSize
min fraction of training events in node
void PruneNode(TMVA::DecisionTreeNode *node)
prune away the subtree below the node
TRandom3 * fMyTrandom
random number generator for randomised trees
void SetPruneMethod(EPruneMethod m=kCostComplexityPruning)
Int_t fTreeID
just an ID number given to the tree.. makes debugging easier as tree knows who he is.
void ApplyValidationSample(const EventConstList *validationSample) const
run the validation sample through the (pruned) tree and fill in the nodes the variables NSValidation ...
Double_t TrainNodeFull(const EventConstList &eventSample, DecisionTreeNode *node)
train a node by finding the single optimal cut for a single variable that best separates signal and b...
EPruneMethod fPruneMethod
method used for pruning
Bool_t fUseSearchTree
cut scan done with binary trees or simple event loop.
std::vector< TMVA::Event * > EventList
virtual DecisionTreeNode * GetRoot() const
TMVA::DecisionTreeNode * GetEventNode(const TMVA::Event &e) const
get the pointer to the leaf node where a particular event ends up in... (used in gradient boosting)
static const Int_t fgDebugLevel
debug level determining some printout/control plots etc.
SeparationBase * fSepType
the separation criteria
void SetUseFisherCuts(Bool_t t=kTRUE)
UInt_t fMaxDepth
max depth
virtual const char * ClassName() const
void SetNodePurityLimit(Double_t p)
void GetRandomisedVariables(Bool_t *useVariable, UInt_t *variableMap, UInt_t &nVars)
Int_t fUseNvars
the number of variables used in randomised trees;
void SetParentTreeInNodes(Node *n=nullptr)
descend a tree to find all its leaf nodes, fill max depth reached in the tree at the same time.
void DescendTree(Node *n=nullptr)
descend a tree to find all its leaf nodes
virtual DecisionTreeNode * CreateNode(UInt_t) const
virtual BinaryTree * CreateTree() const
Double_t fPruneStrength
a parameter to set the "amount" of pruning..needs to be adjusted
static DecisionTree * CreateFromXML(void *node, UInt_t tmva_Version_Code=262657)
re-create a new tree (decision tree or search tree) from XML
UInt_t fSigClass
class which is treated as signal when building the tree
void SetPruneStrength(Double_t p)
Double_t TrainNode(const EventConstList &eventSample, DecisionTreeNode *node)
std::vector< const TMVA::Event * > EventConstList
Bool_t fUseFisherCuts
use multivariate splits using the Fisher criterium
Double_t fNodePurityLimit
purity limit to decide whether a node is signal
Double_t CheckEvent(const TMVA::Event *, Bool_t UseYesNoLeaf=kFALSE) const
the event e is put into the decision tree (starting at the root node) and the output is NodeType (sig...
Bool_t fUseExclusiveVars
individual variables already used in fisher criterium are not anymore analysed individually for node ...
static const Int_t fgRandomSeed
Int_t fNCuts
number of grid point in variable cut scans
void SetTreeID(Int_t treeID)
UInt_t CleanTree(DecisionTreeNode *node=nullptr)
remove those last splits that result in two leaf nodes that are both of the type (i....
Double_t fMinLinCorrForFisher
the minimum linear correlation between two variables demanded for use in fisher criterium in node spl...
UInt_t fNvars
number of variables used to separate S and B
Bool_t fRandomisedTree
choose at each node splitting a random set of variables
virtual ~DecisionTree(void)
destructor
Types::EAnalysisType fAnalysisType
kClassification(=0=false) or kRegression(=1=true)
std::vector< Double_t > GetVariableImportance()
Return the relative variable importance, normalized to all variables together having the importance 1...
void CheckEventWithPrunedTree(const TMVA::Event *) const
pass a single validation event through a pruned decision tree on the way down the tree,...
void PruneNodeInPlace(TMVA::DecisionTreeNode *node)
prune a node temporarily (without actually deleting its descendants which allows testing the pruned t...
Double_t fMinSepGain
min number of separation gain to perform node splitting
Double_t TestPrunedTreeQuality(const DecisionTreeNode *dt=nullptr, Int_t mode=0) const
return the misclassification rate of a pruned tree a "pruned tree" may have set the variable "IsTermi...
std::vector< Double_t > fVariableImportance
the relative importance of the different variables
Double_t PruneTree(const EventConstList *validationSample=nullptr)
prune (get rid of internal nodes) the Decision tree to avoid overtraining several different pruning m...
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 the...
Int_t GetNNodesBeforePruning()
DataSetInfo * fDataSetInfo
void ClearTree()
clear the tree nodes (their S/N, Nevents etc), just keep the structure of the tree
Double_t SamplePurity(EventList eventSample)
calculates the purity S/(S+B) of a given event sample
Node * GetNode(ULong_t sequence, UInt_t depth)
retrieve node from the tree.
std::vector< Double_t > GetFisherCoefficients(const EventConstList &eventSample, UInt_t nFisherVars, UInt_t *mapVarInFisher)
calculate the fisher coefficients for the event sample and the variables used
UInt_t CountLeafNodes(TMVA::Node *n=nullptr)
return the number of terminal nodes in the sub-tree below Node n
Double_t TrainNodeFast(const EventConstList &eventSample, DecisionTreeNode *node)
Decide how to split a node using one of the variables that gives the best separation of signal/backgr...
Types::EAnalysisType GetAnalysisType(void)
Bool_t fUsePoissonNvars
use "fUseNvars" not as fixed number but as mean of a poisson distr. in each split
void SetMinLinCorrForFisher(Double_t min)
RegressionVariance * fRegType
the separation criteria used in Regression
DecisionTree(void)
default constructor using the GiniIndex as separation criterion, no restrictions on minium number of ...
Double_t GetSumWeights(const EventConstList *validationSample) const
calculate the normalization factor for a pruning validation sample
Double_t GetPruneStrength() const
Node for the BinarySearch or Decision Trees.
Calculate the "SeparationGain" for Regression analysis separation criteria used in various training a...
An interface to calculate the "SeparationGain" for different separation criteria used in various trai...
Random number generator class based on M.
create variable transformations