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

template<class T>
Real64 Impala::Core::Table::AveragePrecision ( T *  rank,
AnnotationTable *  groundTruth,
int  topN = -1 
) [inline]

Original definition of AP, i.e.

take only positives into account. Assumes that the first column of T contains Quids.

Definition at line 19 of file AveragePrecision.h.

References Impala::Core::Table::AnnotationTable::GetNrPositive(), ILOG_VAR, Impala::Core::Table::AnnotationTable::IsPositive(), and Impala::Application::DemoCamera2d::precision.

Referenced by Impala::Application::Util::DoAPConfusion(), Impala::Application::Util::DoScoreConcepts(), Impala::Application::Util::DoScoreConceptsVideo(), and Impala::Core::Training::MakeEvaluation().

00020 {
00021     ILOG_VAR(Impala.Core.Table.AveragePrecision);
00022     Real64 ap = 0;
00023     int positiveCount = 0;
00024     if (topN == -1)
00025         topN = rank->Size();
00026     for (int i=0 ; i<topN ; i++)
00027     {
00028         Quid q = rank->Get1(i);
00029         if (groundTruth->IsPositive(q))
00030         {
00031             positiveCount++;
00032             double precision = ((double)positiveCount)/((double)(i+1));
00033             ap += precision;
00034         }
00035     }
00036     if (groundTruth->GetNrPositive() > 0)
00037         ap /= groundTruth->GetNrPositive();
00038     return ap;
00039 }

Here is the call graph for this function:


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