public static double LogAverageFactor(double max, double a, double b)
 {
     return((max == Factor.Max(a, b)) ? 0.0 : Double.NegativeInfinity);
 }
 public static double LogAverageFactor(bool isPositive, double x)
 {
     return((isPositive == Factor.IsPositive(x)) ? 0.0 : Double.NegativeInfinity);
 }
Example #3
0
 /// <summary>
 /// Evidence message for EP
 /// </summary>
 /// <param name="sum">Incoming message from 'Sum'.</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_(Sum) p(Sum) factor(Sum,A,B))</c>.
 /// </para></remarks>
 public static double LogAverageFactor(Discrete sum, int a, int b)
 {
     return(sum.GetLogProb(Factor.Plus(a, b)));
 }