annotate toolboxes/FullBNT-1.0.7/bnt/inference/static/@belprop_inf_engine/loopy_converged.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function niter = loopy_converged(engine)
wolffd@0 2 % LOOPY_CONVERGED Did loopy belief propagation converge? 0 means no, eles we return the num. iterations.
wolffd@0 3 % function niter = loopy_converged(engine)
wolffd@0 4 %
wolffd@0 5 % We use a simple heuristic: we say convergence occurred if the number of iterations
wolffd@0 6 % used was less than the maximum allowed.
wolffd@0 7
wolffd@0 8 if engine.niter == engine.max_iter
wolffd@0 9 niter = 0;
wolffd@0 10 else
wolffd@0 11 niter = engine.niter;
wolffd@0 12 end
wolffd@0 13 %conv = (strcmp(engine.protocol, 'tree') | (engine.niter < engine.max_iter));