/// <summary>VMP message to <c>probTrue</c>.</summary> /// <param name="sample">Constant value for <c>sample</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the factor viewed as a function of <c>probTrue</c> conditioned on the given values.</para> /// </remarks> public static SparseBetaList ProbTrueAverageLogarithm(IList <int> sample, SparseBetaList result) { result.SetToFunction(BernoulliIntegerSubset.SubsetToList(sample, result.Count), s => BernoulliFromBetaOp.ProbTrueAverageLogarithm(s)); return(result); }
/// <summary>VMP message to <c>probTrue</c>.</summary> /// <param name="sample">Incoming message from <c>sample</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except <c>probTrue</c>. The formula is <c>exp(sum_(sample) p(sample) log(factor(sample,probTrue)))</c>.</para> /// </remarks> public static SparseBetaList ProbTrueAverageLogarithm(SparseBernoulliList sample, SparseBetaList result) { result.SetToFunction(sample, s => BernoulliFromBetaOp.ProbTrueAverageLogarithm(s)); return(result); }