71 fLogger(new
MsgLogger(
"CostComplexityPruneTool") )
123 Log() << kDEBUG <<
"Sum of weights in pruning validation sample: " << W <<
Endl;
124 Log() << kDEBUG <<
"Quality of tree prior to any pruning is " << Q/W <<
Endl;
131 catch(std::string error) {
132 Log() << kERROR <<
"Couldn't initialize the tree meta data because of error (" 133 << error <<
")" <<
Endl;
137 Log() << kDEBUG <<
"Automatic cost complexity pruning is " << (
IsAutomatic()?
"on":
"off") <<
"." <<
Endl;
142 catch(std::string error) {
143 Log() << kERROR <<
"Error optimizing pruning sequence (" 144 << error <<
")" <<
Endl;
148 Log() << kDEBUG <<
"Index of pruning sequence to stop at: " <<
fOptimalK <<
Endl;
158 Log() << kINFO <<
"no proper pruning could be calculated. Tree " 159 << dt->
GetTreeID() <<
" will not be pruned. Do not worry if this " 160 <<
" happens for a few trees " <<
Endl;
183 if( n ==
NULL )
return;
216 n->
SetAlpha(std::numeric_limits<double>::infinity( ));
269 Log() << kDEBUG <<
"\nCaught trying to prune the root node!" <<
Endl;
290 Log() << kDEBUG <<
"\nCaught trying to prune the root node!" <<
Endl;
316 Log() << kDEBUG <<
"after this pruning step I would have " << R->
GetNTerminal() <<
" remaining terminal nodes " <<
Endl;
352 Log() << kDEBUG <<
"\n************ Summary for Tree " << dt->
GetTreeID() <<
" *******" <<
Endl 355 Log() << kDEBUG <<
"Pruning strength parameters: [";
358 Log() << kDEBUG << fPruneStrengthList[fPruneStrengthList.size()-1] <<
"]" <<
Endl;
360 Log() << kDEBUG <<
"Misclassification rates: [";
363 Log() << kDEBUG << fQualityIndexList[fQualityIndexList.size()-1] <<
"]" <<
Endl;
void SetNTerminal(Int_t n)
Double_t PruneStrength
quality measure for a pruned subtree T of T_max
MsgLogger & Endl(MsgLogger &ml)
Double_t GetNodePurityLimit() const
virtual DecisionTreeNode * GetParent() const
std::vector< DecisionTreeNode * > PruneSequence
the regularization parameter for pruning
Double_t TestPrunedTreeQuality(const DecisionTreeNode *dt=NULL, Int_t mode=0) const
return the misclassification rate of a pruned tree a "pruned tree" may have set the variable "IsTermi...
Float_t GetNSigEvents(void) const
virtual DecisionTreeNode * GetRoot() const
Double_t GetSubTreeR() const
Float_t GetSeparationIndex(void) const
Float_t GetNBkgEvents(void) const
Double_t GetNodeR() const
Double_t GetSumWeights(const EventConstList *validationSample) const
calculate the normalization factor for a pruning validation sample
void SetNodeR(Double_t r)
void SetMinType(EMsgType minType)
void SetSubTreeR(Double_t r)
void SetAlpha(Double_t alpha)
Implementation of a Decision Tree.
An interface to calculate the "SeparationGain" for different separation criteria used in various trai...
void PruneNodeInPlace(TMVA::DecisionTreeNode *node)
prune a node temporarily (without actually deleting its descendants which allows testing the pruned t...
void ApplyValidationSample(const EventConstList *validationSample) const
run the validation sample through the (pruned) tree and fill in the nodes the variables NSValidation ...
virtual Double_t GetSeparationIndex(const Double_t s, const Double_t b)=0
Double_t GetAlphaMinSubtree() const
void SetAlphaMinSubtree(Double_t g)
void SetTerminal(Bool_t s=kTRUE)
ostringstream derivative to redirect and format output
Abstract ClassifierFactory template that handles arbitrary types.
Short_t Max(Short_t a, Short_t b)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual DecisionTreeNode * GetLeft() const
virtual DecisionTreeNode * GetRight() const
Double_t GetAlpha() const
Int_t GetNTerminal() const