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

std::vector<QuidTable*> Impala::Core::Table::AnnotationTable::MakeRandomFolds ( int  foldCount,
int  repetition 
) [inline]

Definition at line 474 of file AnnotationTable.h.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), GetAnnotatedQuids(), GetNegative(), GetPositive(), ILOG_DEBUG, ILOG_ERROR, and Impala::Core::Table::Table::Size().

Referenced by MakeEpisodeFolds(), and Impala::Core::Training::TrainDataSrc::MakeFolds().

00475     {
00476         if(foldCount <= 1)
00477         {
00478             ILOG_ERROR("we need at least 2 folds");
00479             return std::vector<QuidTable*>(1, GetAnnotatedQuids());
00480         }
00481 
00482         QuidTable* positive = GetPositive();
00483         QuidTable* negative = GetNegative();
00484         ILOG_DEBUG_NODE("make random folds: #annotations = " <<
00485                         positive->Size() + negative->Size());
00486 
00487         std::vector<QuidTable*> folds;
00488         for(int i=0 ; i<foldCount ; ++i)
00489             folds.push_back(new QuidTable(0));
00490 
00491         int lastFold=0;
00492         Util::QuasiRandomSequenceIterator pos(positive->Size(), repetition);
00493         for(int i=0 ; i<positive->Size() ; ++i)
00494         {
00495             folds[lastFold]->Add(positive->Get1(*pos));
00496             ++pos;
00497             ++lastFold;
00498             if(lastFold >= foldCount)
00499                 lastFold = 0;
00500         }
00501         for (int i=0 ; i<foldCount ; i++)
00502         {
00503             ILOG_DEBUG("fold "<< i <<" has "<< folds[i]->Size() <<" positives");
00504             if (folds[i]->Size() == 0)
00505                 ILOG_ERROR("fold "<< i <<" has NO positives");
00506         }
00507 
00508         Util::QuasiRandomSequenceIterator neg(negative->Size(), repetition);
00509         for(int i=0 ; i<negative->Size() ; ++i)
00510         {
00511             folds[lastFold]->Add(negative->Get1(*neg));
00512             ++neg;
00513             ++lastFold;
00514             if(lastFold >= foldCount)
00515                 lastFold = 0;
00516         }
00517 
00518         delete positive;
00519         delete negative;
00520         return folds;
00521     }

Here is the call graph for this function:


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