DecisionTreeBuilder.cpp 933 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @file DecisionTreeBuilder.cpp
  3. * @brief build decision trees
  4. * @author Erik Rodner
  5. * @date 05/06/2008
  6. */
  7. #ifdef NOVISUAL
  8. #include <vislearning/nice_nonvis.h>
  9. #else
  10. #include <vislearning/nice.h>
  11. #endif
  12. #include <iostream>
  13. #include "vislearning/classifier/fpclassifier/randomforest/DecisionTreeBuilder.h"
  14. using namespace OBJREC;
  15. using namespace std;
  16. // refactor-nice.pl: check this substitution
  17. // old: using namespace ice;
  18. using namespace NICE;
  19. DecisionTreeBuilder::DecisionTreeBuilder()
  20. {
  21. }
  22. DecisionTreeBuilder::~DecisionTreeBuilder()
  23. {
  24. }
  25. void DecisionTreeBuilder::build ( DecisionTree & tree, const FeaturePool & fp,
  26. const Examples & examples, int maxClassNo )
  27. {
  28. DecisionNode *root = build ( fp, examples, maxClassNo );
  29. tree.setRoot(root);
  30. int depth, count;
  31. tree.statistics ( depth, count );
  32. fprintf (stderr, "DecisionTree: maximum depth = %d, number of nodes = %d\n", depth, count );
  33. }