The probability of variable

template<class GM, class ACC>
00250 InferenceTermination
00251 Inference::modeFromFactorMarginal(
00252    std::vector& conf
00253 ) const
00254 {
00255    const GM& gm = graphicalModel();
00256    std::vector knownVariables;
00257    std::vector knownStates;
00258    IndependentFactorType out;
00259    for(size_t node=0; nodeif(NORMAL != term) {
00262          return term;
00263       }
00264       ValueType value = out(0);
00265       size_t state = 0;
00266       bool unique = true;
00267       for(size_t i=1; i//ValueType q = out(i)/value;
00270          //if(q<1.001 && q>0.999) {
00271          //   unique=false;
00272          //}
00273          if(fabs(out(i) - value)<0.00001) {
00274             unique=false;
00275          }
00276          else if(ACC::bop(out(i), value)) {
00277             value = out(i);
00278             state = i;
00279             unique=true;
00280          }
00281       }
00282       if(unique) {
00283          knownVariables.push_back(node);
00284          knownStates.push_back(state);
00285       }
00286    }
00287    return constrainedOptimum( knownVariables, knownStates, conf);
00288 }

你可能感兴趣的:(Linux)