Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

double Impala::Core::Feature::Gain ( const AnnotatedFeatureTable *  data,
int  nrClasses,
bool *  left,
bool *  right 
)

according to Jasper: The Gain is defined as in [Shotton08], taken again from Lepetit, CVPR 2005

Definition at line 68 of file MakeRandomTree.h.

References Impala::Util::Count(), Impala::Core::Histogram::Entropy(), MakeHistogram(), and Impala::Core::Table::Table::Size().

Referenced by Impala::Core::Feature::TestMakeRandomTree::testFindSplitWithSeed(), Impala::Core::Feature::TestMakeRandomTree::testGain(), and TryRandomSplit().

00069 {
00070     int size = data->Size();
00071     double nrL = Util::Count(left, size);
00072     double nrR = Util::Count(right, size);
00073     double total = nrL+nrR;
00074     if(total==0)
00075         return 0;
00076     Histogram::Histogram1dTem<int>* histL = MakeHistogram(data, nrClasses, left);
00077     Histogram::Histogram1dTem<int>* histR = MakeHistogram(data, nrClasses, right);
00078     double gain = - (nrL / total) * Entropy(histL) - (nrR / total) * Entropy(histR);
00079     delete histL;
00080     delete histR;
00081     return gain;
00082 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:08:18 2010 for ImpalaSrc by  doxygen 1.5.1