SCInformationGain.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /**
  2. * @file SCInformationGain.h
  3. * @brief the information gain splitting criterion
  4. * @author Sven Sickert
  5. * @date 01/12/2017
  6. */
  7. #ifndef SCInformationGainINCLUDE
  8. #define SCInformationGainINCLUDE
  9. #include "SplittingCriterion.h"
  10. namespace OBJREC {
  11. class SCInformationGain : public SplittingCriterion
  12. {
  13. protected:
  14. double entropy_left,
  15. entropy_right,
  16. count_left,
  17. count_right;
  18. bool use_shannon_entropy;
  19. public:
  20. /* default constructor */
  21. SCInformationGain();
  22. /* simple constructor */
  23. SCInformationGain( int _min_examples );
  24. /** config constructor */
  25. SCInformationGain( const NICE::Config *conf );
  26. /** copy constructor */
  27. SCInformationGain( const SCInformationGain &obj );
  28. /* simple destructor */
  29. virtual ~SCInformationGain();
  30. /* cloning function */
  31. virtual SplittingCriterion* clone();
  32. /**
  33. * @brief evaluate the split and return if split is possible
  34. * @param values unsorted list of feature values of a certain dimension
  35. * @param threshold threshold for current feature dimension
  36. * @param distribution_left class distribution for left child node after splitting
  37. * @param distribution_right class distribution for right child node after splitting
  38. * @param maxClassNo maximum class number
  39. * @return possible split or not
  40. */
  41. virtual bool evaluateSplit(
  42. const FeatureValuesUnsorted & values,
  43. double threshold,
  44. double* distribution_left,
  45. double* distribution_right,
  46. int maxClassNo );
  47. /**
  48. * @brief compute purity based on given split
  49. * @return purity value
  50. */
  51. double computePurity() const;
  52. };
  53. } // namespace
  54. #endif