本文整理汇总了C++中OutputInfo::outputBalancedError方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputInfo::outputBalancedError方法的具体用法?C++ OutputInfo::outputBalancedError怎么用?C++ OutputInfo::outputBalancedError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputInfo
的用法示例。
在下文中一共展示了OutputInfo::outputBalancedError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeResults
// Returns the results into ptRes
void AdaBoostMHClassifier::computeResults(InputData* pData, vector<BaseLearner*>& weakHypotheses,
vector< ExampleResults* >& results, int numIterations)
{
assert( !weakHypotheses.empty() );
const int numClasses = pData->getNumClasses();
const int numExamples = pData->getNumExamples();
// Initialize the output info
OutputInfo* pOutInfo = NULL;
if ( !_outputInfoFile.empty() )
pOutInfo = new OutputInfo(_outputInfoFile);
// Creating the results structures. See file Structures.h for the
// PointResults structure
results.clear();
results.reserve(numExamples);
for (int i = 0; i < numExamples; ++i)
results.push_back( new ExampleResults(i, numClasses) );
// iterator over all the weak hypotheses
vector<BaseLearner*>::const_iterator whyIt;
int t;
if ( pOutInfo )
pOutInfo->initialize( pData );
// for every feature: 1..T
for (whyIt = weakHypotheses.begin(), t = 0;
whyIt != weakHypotheses.end() && t < numIterations; ++whyIt, ++t)
{
BaseLearner* currWeakHyp = *whyIt;
float alpha = currWeakHyp->getAlpha();
// for every point
for (int i = 0; i < numExamples; ++i)
{
// a reference for clarity and speed
vector<float>& currVotesVector = results[i]->getVotesVector();
// for every class
for (int l = 0; l < numClasses; ++l)
currVotesVector[l] += alpha * currWeakHyp->classify(pData, i, l);
}
// if needed output the step-by-step information
if ( pOutInfo )
{
pOutInfo->outputIteration(t);
pOutInfo->outputError(pData, currWeakHyp);
pOutInfo->outputBalancedError(pData, currWeakHyp);
if ( ( t % 1 ) == 0 ) {
pOutInfo->outputROC(pData, currWeakHyp);
}
// Margins and edge requires an update of the weight,
// therefore I keep them out for the moment
//outInfo.outputMargins(pData, currWeakHyp);
//outInfo.outputEdge(pData, currWeakHyp);
pOutInfo->endLine();
}
}
if (pOutInfo)
delete pOutInfo;
}