/// <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(Gaussian sum, bool[] A, Vector B) { return(sum.GetLogProb(Factor.SumWhere(A, B))); }
/// <summary> /// Evidence message for EP /// </summary> /// <param name="sum">Constant value for '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(factor(Sum,A,B))</c>. /// </para></remarks> public static double LogAverageFactor(double sum, bool[] A, Vector B) { return((sum == Factor.SumWhere(A, B)) ? 0.0 : Double.NegativeInfinity); }