42 fValidationSample(validationSample),
43 fValidationDataSet(
NULL),
48 if(qualityIndex ==
NULL) {
65 fValidationSample(
NULL),
66 fValidationDataSet(validationSample),
71 if(qualityIndex ==
NULL) {
105 std::ofstream outfile;
106 if (
fDebug) outfile.open(
"costcomplexity.log");
108 if (
fDebug) outfile <<
"ERROR: no validation sample, so cannot optimize pruning!" << std::endl;
110 if (
fDebug) outfile.close();
119 if(HaveStopCondition && alpha >
fAlpha)
break;
132 if (
fDebug) outfile << std::endl <<
"Caught trying to prune the root node!" << std::endl;
139 outfile <<
"===========================" << std::endl
140 <<
"Pruning branch listed below" << std::endl
141 <<
"===========================" << std::endl;
160 if(!HaveStopCondition) {
174 if(!HaveStopCondition) {
188 outfile << std::endl <<
"************ Summary **************" << std::endl
189 <<
"Number of trees in the sequence: " <<
fPruneSequence.size() << std::endl;
191 outfile <<
"Pruning strength parameters: [";
196 outfile <<
"Misclassification rates: [";
201 outfile <<
"Optimal index: " <<
fOptimalK+1 << std::endl;
212 std::vector<DecisionTreeNode*> optimalSequence;
218 return optimalSequence;
void Optimize()
determine the pruning sequence
std::vector< Float_t > fQualityIndexList
map of alpha -> pruning index
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
CCTreeNode * GetLeftDaughter()
const DataSet * fValidationDataSet
the event sample to select the optimally-pruned tree
std::vector< TMVA::DecisionTreeNode * > GetOptimalPruneSequence() const
return the prune strength (=alpha) corresponding to the prune sequence
Double_t GetResubstitutionEstimate() const
Int_t fOptimalK
map of R(T) -> pruning index
Double_t GetAlphaC() const
void SetResubstitutionEstimate(Double_t R)
Double_t GetNodeResubstitutionEstimate() const
DecisionTree * fTree
flag indicates if fQualityIndex is owned by this
Bool_t fDebug
index of the optimal tree in the pruned tree sequence
DecisionTreeNode * GetDTNode() const
SeparationBase * fQualityIndex
the event sample to select the optimally-pruned tree
CCTreeNode * GetRightDaughter()
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Double_t TestTreeQuality(const EventList *validationSample)
return the misclassification rate of a pruned tree for a validation event sample using an EventList ...
Bool_t fOwnQIndex
the quality index used to calculate R(t), R(T) = sum[t in ~T]{ R(t) }
std::vector< TMVA::DecisionTreeNode * > fPruneSequence
(pruned) decision tree
virtual void PrintRec(std::ostream &os) const
recursive printout of the node and its daughters
std::vector< Event * > EventList
void SetNLeafDaughters(Int_t N)
void SetMinAlphaC(Double_t alpha)
const EventList * fValidationSample
regularization parameter in CC pruning
Double_t GetMinAlphaC() const
void SetAlphaC(Double_t alpha)
Abstract ClassifierFactory template that handles arbitrary types.
Int_t GetNLeafDaughters() const
CCPruner(DecisionTree *t_max, const EventList *validationSample, SeparationBase *qualityIndex=NULL)
constructor
void PruneNode(CCTreeNode *t)
remove the branch rooted at node t
std::vector< Float_t > fPruneStrengthList
map of weakest links (i.e., branches to prune) -> pruning index