DTBPruning.cpp 999 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @file DTBPruning.cpp
  3. * @brief some additional pruning algorithms
  4. * @author Erik Rodner
  5. * @date 05/06/2008
  6. */
  7. #include <iostream>
  8. #include "DTBPruning.h"
  9. using namespace OBJREC;
  10. using namespace std;
  11. // refactor-nice.pl: check this substitution
  12. // old: using namespace ice;
  13. using namespace NICE;
  14. // refactor-nice.pl: check this substitution
  15. // old: DTBPruning::DTBPruning( const Config *conf, string section, DecisionTreeBuilder *_builder ) : builder(_builder)
  16. DTBPruning::DTBPruning( const Config *conf, std::string section, DecisionTreeBuilder *_builder ) : builder(_builder)
  17. {
  18. minimum_entropy = conf->gD(section, "minimum_entropy", 0.0 );
  19. }
  20. DTBPruning::~DTBPruning()
  21. {
  22. if ( builder != NULL )
  23. delete builder;
  24. }
  25. DecisionNode *DTBPruning::build ( const FeaturePool & fp,
  26. const Examples & examples, int maxClassNo )
  27. {
  28. DecisionNode *root = builder->build ( fp, examples, maxClassNo );
  29. DecisionTree::pruneTreeEntropy ( root, minimum_entropy );
  30. return root;
  31. }