/// <summary> /// EP message to 'isBetween' /// </summary> /// <param name="X">Incoming message from 'x'. Must be a proper distribution. If uniform, the result will be uniform.</param> /// <param name="lowerBound">Incoming message from 'lowerBound'. Must be a proper distribution. If uniform, the result will be uniform.</param> /// <param name="upperBound">Incoming message from 'upperBound'.</param> /// <returns>The outgoing EP message to the 'isBetween' argument</returns> /// <remarks><para> /// The outgoing message is a distribution matching the moments of 'isBetween' as the random arguments are varied. /// The formula is <c>proj[p(isBetween) sum_(x,lowerBound,upperBound) p(x,lowerBound,upperBound) factor(isBetween,x,lowerBound,upperBound)]/p(isBetween)</c>. /// </para></remarks> /// <exception cref="ImproperMessageException"><paramref name="X"/> is not a proper distribution</exception> /// <exception cref="ImproperMessageException"><paramref name="lowerBound"/> is not a proper distribution</exception> public static Bernoulli IsBetweenAverageConditional([SkipIfUniform] Gaussian X, [SkipIfUniform] Gaussian lowerBound, Gaussian upperBound) { Bernoulli result = new Bernoulli(); result.SetLogProbTrue(LogProbBetween(X, lowerBound, upperBound)); return result; }