本文整理汇总了C++中Factor::states方法的典型用法代码示例。如果您正苦于以下问题:C++ Factor::states方法的具体用法?C++ Factor::states怎么用?C++ Factor::states使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factor
的用法示例。
在下文中一共展示了Factor::states方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectSufficientStatistics
void SharedParameters::collectSufficientStatistics( InfAlg &alg ) {
for( std::map< FactorIndex, Permute >::iterator i = _perms.begin(); i != _perms.end(); ++i ) {
Permute &perm = i->second;
VarSet &vs = _varsets[i->first];
Factor b = alg.belief(vs);
Prob p( b.states(), 0.0 );
for( size_t entry = 0; entry < b.states(); ++entry )
p[entry] = b[perm.convertLinearIndex(entry)]; // apply inverse permutation
_estimation->addSufficientStatistics( p );
}
}
示例2: copyLabels_MSRC
void GI_libDAI::copyLabels_MSRC(vector<std::size_t>& labels,
labelType* nodeLabels,
BP& bp,
FactorGraph& fg)
{
labelType voidLabel = classIdxToLabel[0];
labelType moutainLabel = classIdxToLabel[4161600];
labelType horseLabel = classIdxToLabel[8323328];
INFERENCE_PRINT("[gi_libDAI] copyLabels_MSRC void=%d, moutain=%d, horse=%d\n",
(int)voidLabel, (int)moutainLabel, (int)horseLabel);
int label;
int n = slice->getNbSupernodes();
for(int sid = 0; sid < n; sid++) {
label = labels[sid];
//if(lossPerLabel == 0 && label > 20) // void label
if(label == voidLabel || label == moutainLabel || label == horseLabel) {
//Factor f = bp.beliefV(sid);
Factor f = bp.belief(fg.var(sid));
double maxProb = -1;
for(int i = 0; i < (int)f.states(); i++) {
if(i != voidLabel && i != moutainLabel && i != horseLabel)
if(maxProb < f[i]) {
maxProb = f[i];
label = i;
}
}
//INFERENCE_PRINT("label=%d\n", label);
}
nodeLabels[sid] = label;
}
}