Example #1
0
 /// <summary>
 /// Evidence message for EP.
 /// </summary>
 /// <param name="and">Incoming message from 'and'.</param>
 /// <param name="a">Constant value for 'a'.</param>
 /// <param name="b">Constant value for 'b'.</param>
 /// <returns>Logarithm of the factor's average value across the given argument distributions.</returns>
 /// <remarks><para>
 /// The formula for the result is <c>log(sum_(and) p(and) factor(and,a,b))</c>.
 /// </para></remarks>
 public static double LogAverageFactor(Bernoulli and, bool a, bool b)
 {
     return(and.GetLogProb(Factor.And(a, b)));
 }
Example #2
0
 /// <summary>
 /// Evidence message for EP.
 /// </summary>
 /// <param name="and">Constant value for 'and'.</param>
 /// <param name="a">Constant value for 'a'.</param>
 /// <param name="b">Constant value for 'b'.</param>
 /// <returns>Logarithm of the factor's average value across the given argument distributions.</returns>
 /// <remarks><para>
 /// The formula for the result is <c>log(sum_() p() factor(and,a,b))</c>.
 /// </para></remarks>
 public static double LogAverageFactor(bool and, bool a, bool b)
 {
     return((and == Factor.And(a, b)) ? 0.0 : Double.NegativeInfinity);
 }