bool GP_Hedge::checkIfBest(vectord& best, 
			     std::string& name,
			     int& error_code)
  { 
    if (mIndex < mCriteriaList.size())
      {
	loss_(mIndex) = computeLoss(best);
	mBestLists.push_back(best);
	error_code = 0;
	++mIndex;
	if (mIndex < mCriteriaList.size())
	  mCurrentCriterium = mCriteriaList[mIndex];
	return false;
      }
    else
      {
	int optIndex = update_hedge();
	if (optIndex >= 0)
	  {
	    name = mCriteriaList[optIndex]->name();
      	    best = mBestLists[optIndex];
	    error_code = 0;
	  }
	else
	  {
	    name = mCriteriaList[0]->name();
      	    best = mBestLists[0];
	    FILE_LOG(logERROR) << "Error updating Hedge algorithm. Selecting " << name;
	    error_code = optIndex; 
	  }
	return true;	
      }

  };
示例#2
0
void GP_Hedge::pushResult(const vectord& prevResult)
{
    loss_(mIndex) = computeLoss(prevResult);
    mBestLists.push_back(prevResult);
};