/** 
* @file DTBPruning.cpp
* @brief some additional pruning algorithms
* @author Erik Rodner
* @date 05/06/2008

*/
#include <iostream>

#include "DTBPruning.h"

using namespace OBJREC;

using namespace std;
// refactor-nice.pl: check this substitution
// old: using namespace ice;
using namespace NICE;



// refactor-nice.pl: check this substitution
// old: DTBPruning::DTBPruning( const Config *conf, string section, DecisionTreeBuilder *_builder ) : builder(_builder)
DTBPruning::DTBPruning( const Config *conf, std::string section, DecisionTreeBuilder *_builder ) : builder(_builder)
{
    minimum_entropy = conf->gD(section, "minimum_entropy", 0.0 );
}

DTBPruning::~DTBPruning()
{
    if ( builder != NULL )
	delete builder;
}

DecisionNode *DTBPruning::build ( const FeaturePool & fp, 
		     const Examples & examples, int maxClassNo )
{
    DecisionNode *root = builder->build ( fp, examples, maxClassNo );
    DecisionTree::pruneTreeEntropy ( root, minimum_entropy );
    return root;
}
