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

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

AP on judged elements only, i.e.

non-labeled quids are eliminated from the ranking. skipIsNegative indicates whether skips count as negative or are eliminated too. In case rank contains only a subset of relative to groundTruth, AP may be adjusted by setting apOfFoundOnly to true.

Assumes that the first column of T contains Quids.

Definition at line 50 of file AveragePrecision.h.

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

Referenced by Impala::Application::Util::DoScoreConcepts(), Impala::Application::Util::DoScoreConceptsVideo(), and Impala::Visualization::SimilarityTableSetRank::HandleUpdate().

00053 {
00054     ILOG_VAR(Impala.Core.Table.AveragePrecision);
00055     Real64 ap = 0;
00056     int positiveCount = 0;
00057     int curRank = 0;
00058     if (topN == -1)
00059         topN = rank->Size();
00060     for (int i=0 ; i<topN ; i++)
00061     {
00062         Quid q = rank->Get1(i);
00063         int qIndex = groundTruth->GetIndex(q);
00064         if (qIndex == groundTruth->Size()) // not annotated
00065             continue;
00066         if (groundTruth->IsPositive(qIndex))
00067         {
00068             positiveCount++;
00069             double precision = ((double)positiveCount)/((double)(curRank+1));
00070             ap += precision;
00071         }
00072         if (groundTruth->IsPositive(qIndex) || skipIsNegative
00073             || groundTruth->IsNegative(qIndex))
00074         {
00075             curRank++;
00076         }
00077     }
00078     int factor = (apOfFoundOnly) ? positiveCount : groundTruth->GetNrPositive();
00079     if (factor > 0)
00080         ap /= factor;
00081     return ap;
00082 }

Here is the call graph for this function:


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