1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /**
- * @file SCGiniIndex.h
- * @brief the Gini index splitting criterion
- * @author Sven Sickert
- * @date 01/16/2017
- */
- #ifndef SCGiniIndexINCLUDE
- #define SCGiniIndexINCLUDE
- #include "SplittingCriterion.h"
- namespace OBJREC {
- class SCGiniIndex : public SplittingCriterion
- {
- protected:
- double gini_left,
- gini_right,
- count_left,
- count_right;
- /**
- * @brief computation of Gini index
- * @param distribution given distribution
- * @param count amount of samples
- * @param maxClassNo maximum class number
- * @return computed Gini index
- */
- double computeGiniIndex(
- const double* distribution,
- const double count ,
- const int maxClassNo );
- public:
- /* default constructor */
- SCGiniIndex();
- /* simple constructor */
- SCGiniIndex( int _min_examples );
- /** config constructor */
- SCGiniIndex( const NICE::Config *conf );
- /** copy constructor */
- SCGiniIndex( const SCGiniIndex &obj );
- /* simple destructor */
- virtual ~SCGiniIndex();
- /* 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
|