/** * @file SCInformationGain.h * @brief the information gain splitting criterion * @author Sven Sickert * @date 01/12/2017 */ #ifndef SCInformationGainINCLUDE #define SCInformationGainINCLUDE #include "SplittingCriterion.h" namespace OBJREC { class SCInformationGain : public SplittingCriterion { protected: double entropy_left, entropy_right, count_left, count_right; bool use_shannon_entropy; public: /* default constructor */ SCInformationGain(); /* simple constructor */ SCInformationGain( int _min_examples ); /** config constructor */ SCInformationGain( const NICE::Config *conf ); /** copy constructor */ SCInformationGain( const SCInformationGain &obj ); /* simple destructor */ virtual ~SCInformationGain(); /* cloning function */ virtual SplittingCriterion* clone(); /** * @brief evaluate the split and return if split is possible * @param values unsorted list of feature values of a certain dimension * @param threshold threshold for current feature dimension * @param distribution_left class distribution for left child node after splitting * @param distribution_right class distribution for right child node after splitting * @param maxClassNo maximum class number * @return possible split or not */ virtual bool evaluateSplit( const FeatureValuesUnsorted & values, double threshold, double* distribution_left, double* distribution_right, int maxClassNo ); /** * @brief compute purity based on given split * @return purity value */ double computePurity() const; }; } // namespace #endif