Definition at line 555 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(). 00556 { 00557 if(foldCount <= 1) 00558 { 00559 ILOG_ERROR("we need at least 2 folds"); 00560 return std::vector<QuidTable*>(1, GetAnnotatedQuids()); 00561 } 00562 00563 QuidTable* positive = GetPositive(); 00564 QuidTable* negative = GetNegative(); 00565 ILOG_DEBUG_NODE("make random folds: #annotations = " << 00566 positive->Size() + negative->Size()); 00567 00568 std::vector<QuidTable*> folds; 00569 for(int i=0 ; i<foldCount ; ++i) 00570 folds.push_back(new QuidTable(0)); 00571 00572 int lastFold=0; 00573 Util::QuasiRandomSequenceIterator pos(positive->Size(), repetition); 00574 for(int i=0 ; i<positive->Size() ; ++i) 00575 { 00576 folds[lastFold]->Add(positive->Get1(*pos)); 00577 ++pos; 00578 ++lastFold; 00579 if(lastFold >= foldCount) 00580 lastFold = 0; 00581 } 00582 for (int i=0 ; i<foldCount ; i++) 00583 { 00584 ILOG_DEBUG("fold "<< i <<" has "<< folds[i]->Size() <<" positives"); 00585 if (folds[i]->Size() == 0) 00586 ILOG_ERROR("fold "<< i <<" has NO positives"); 00587 } 00588 00589 Util::QuasiRandomSequenceIterator neg(negative->Size(), repetition); 00590 for(int i=0 ; i<negative->Size() ; ++i) 00591 { 00592 folds[lastFold]->Add(negative->Get1(*neg)); 00593 ++neg; 00594 ++lastFold; 00595 if(lastFold >= foldCount) 00596 lastFold = 0; 00597 } 00598 00599 delete positive; 00600 delete negative; 00601 return folds; 00602 }
Here is the call graph for this function:
|