/// <summary> /// VMP message to 'probsTrue' /// </summary> /// <param name="sample">Incoming message from 'sample'. Must be a proper distribution. If any element is uniform, the result will be uniform.</param> /// <returns>The outgoing VMP message to the 'probsTrue' argument</returns> /// <remarks><para> /// The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except 'probsTrue'. /// The formula is <c>exp(sum_(sample) p(sample) log(factor(sample,probsTrue)))</c>. /// </para></remarks> /// <exception cref="ImproperMessageException"><paramref name="sample"/> is not a proper distribution</exception> public static SparseBetaList ProbsTrueAverageLogarithm([Proper] BernoulliIntegerSubset sample) { return(SparseBernoulliFromBetaOp.ProbsTrueAverageLogarithm(sample)); }
/// <summary> /// Evidence message for VMP /// </summary> /// <param name="sample">Incoming message from 'sample'. Must be a proper distribution. If any element is uniform, the result will be uniform.</param> /// <param name="probsTrue">Constant value 'probsTrue'.</param> /// <param name="MeanLog"></param> /// <param name="MeanLogOneMinus"></param> /// <returns>Average of the factor's log-value across the given argument distributions</returns> /// <remarks><para> /// The formula for the result is <c>sum_(probsTrue) p(probsTrue) log(factor(sample,probsTrue))</c>. /// Adding up these values across all factors and variables gives the log-evidence estimate for VMP. /// </para></remarks> /// <exception cref="ImproperMessageException"><paramref name="probsTrue"/> is not a proper distribution</exception> public static double AverageLogFactor([Proper] BernoulliIntegerSubset sample, SparseVector probsTrue, SparseVector MeanLog, SparseVector MeanLogOneMinus) { return(SparseBernoulliFromBetaOp.AverageLogFactor(sample, probsTrue, MeanLog, MeanLogOneMinus)); }