48 fValidationSample(validationSample),
49 fValidationDataSet(
NULL),
54 if(qualityIndex ==
NULL) {
77 if(qualityIndex ==
NULL) {
111 std::ofstream outfile;
112 if (
fDebug) outfile.open(
"costcomplexity.log");
114 if (
fDebug) outfile <<
"ERROR: no validation sample, so cannot optimize pruning!" << std::endl;
116 if (
fDebug) outfile.close();
125 if(HaveStopCondition && alpha >
fAlpha)
break;
138 if (
fDebug) outfile << std::endl <<
"Caught trying to prune the root node!" << std::endl;
145 outfile <<
"===========================" << std::endl
146 <<
"Pruning branch listed below" << std::endl
147 <<
"===========================" << std::endl;
166 if(!HaveStopCondition) {
180 if(!HaveStopCondition) {
194 outfile << std::endl <<
"************ Summary **************" << std::endl
195 <<
"Number of trees in the sequence: " <<
fPruneSequence.size() << std::endl;
197 outfile <<
"Pruning strength parameters: [";
202 outfile <<
"Misclassification rates: [";
207 outfile <<
"Optimal index: " <<
fOptimalK+1 << std::endl;
218 std::vector<DecisionTreeNode*> optimalSequence;
224 return optimalSequence;
void Optimize()
determine the pruning sequence
std::vector< Float_t > fQualityIndexList
map of alpha -> pruning index
virtual void PrintRec(std::ostream &os) const
recursive printout of the node and its daughters
CCTreeNode * GetLeftDaughter()
const DataSet * fValidationDataSet
the event sample to select the optimally-pruned tree
Int_t fOptimalK
map of R(T) -> pruning index
void SetResubstitutionEstimate(Double_t R)
DecisionTree * fTree
flag indicates if fQualityIndex is owned by this
Bool_t fDebug
index of the optimal tree in the pruned tree sequence
Double_t GetResubstitutionEstimate() const
SeparationBase * fQualityIndex
the event sample to select the optimally-pruned tree
CCTreeNode * GetRightDaughter()
Int_t GetNLeafDaughters() const
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
std::vector< Event * > EventList
void SetNLeafDaughters(Int_t N)
void SetMinAlphaC(Double_t alpha)
const EventList * fValidationSample
regularization parameter in CC pruning
std::vector< TMVA::DecisionTreeNode * > GetOptimalPruneSequence() const
return the prune strength (=alpha) corresponding to the prune sequence
DecisionTreeNode * GetDTNode() const
void SetAlphaC(Double_t alpha)
Abstract ClassifierFactory template that handles arbitrary types.
Double_t GetAlphaC() const
CCPruner(DecisionTree *t_max, const EventList *validationSample, SeparationBase *qualityIndex=NULL)
constructor
Double_t GetMinAlphaC() const
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
Double_t GetNodeResubstitutionEstimate() const