Skip to main content

Posts

Showing posts with the label measure of impurity

Computing Gini Index of an image (measure of Impurity)

Using my previous posts Class file and this reference: http://people.revoledu.com/kardi/tutorial/DecisionTree/how-to-measure-impurity.htm float computeGiniIndex(Mat r, Mat g, Mat b)     {         float giniIndex = 0.0;         float frequency = getFrequencyOfBin(r);         for( int i = 1; i < histSize; i++ )         {             float Hc = abs(getHistogramBinValue(r,i));             giniIndex += Hc*Hc;         }         frequency = getFrequencyOfBin(g);         for( int i = 1; i < histSize; i++ )         {             float Hc = abs(getHistogramBinValue(g,i));  ...