/// <summary> /// VMP message to 'a' /// </summary> /// <param name="Product">Incoming message from 'product'. Must be a proper distribution. If uniform, the result will be uniform.</param> /// <param name="B">Constant value for 'b'.</param> /// <returns>The outgoing VMP message to the 'a' argument</returns> /// <remarks><para> /// The outgoing message is the factor viewed as a function of 'a' with 'product' integrated out. /// The formula is <c>sum_product p(product) factor(product,a,b)</c>. /// </para></remarks> /// <exception cref="ImproperMessageException"><paramref name="Product"/> is not a proper distribution</exception> public static Gamma AAverageLogarithm([SkipIfUniform] Gamma Product, double B) { if (Product.IsPointMass) { return(AAverageLogarithm(Product.Point, B)); } return(GammaProductOp.AAverageConditional(Product, B)); }
/// <summary> /// VMP message to 'b' /// </summary> /// <param name="Product">Constant value for 'product'.</param> /// <param name="A">Constant value for 'a'.</param> /// <returns>The outgoing VMP message to the 'b' argument</returns> /// <remarks><para> /// The outgoing message is the factor viewed as a function of 'b' conditioned on the given values. /// </para></remarks> public static Gamma BAverageLogarithm(double Product, double A) { return(GammaProductOp.BAverageConditional(Product, A)); }
/// <summary> /// VMP message to 'a' /// </summary> /// <param name="ratio">Constant value for 'ratio'.</param> /// <param name="B">Constant value for 'b'.</param> /// <returns>The outgoing VMP message to the 'a' argument</returns> /// <remarks><para> /// The outgoing message is the factor viewed as a function of 'a' conditioned on the given values. /// </para></remarks> public static Gamma AAverageLogarithm(double ratio, double B) { return(GammaProductOp.ProductAverageConditional(ratio, B)); }
/// <summary> /// VMP message to 'a' /// </summary> /// <param name="ratio">Incoming message from 'ratio'. Must be a proper distribution. If uniform, the result will be uniform.</param> /// <param name="B">Constant value for 'b'.</param> /// <returns>The outgoing VMP message to the 'a' argument</returns> /// <remarks><para> /// The outgoing message is the factor viewed as a function of 'a' with 'ratio' integrated out. /// The formula is <c>sum_ratio p(ratio) factor(ratio,a,b)</c>. /// </para></remarks> public static Gamma AAverageLogarithm([SkipIfUniform] Gamma ratio, double B) { return(GammaProductOp.ProductAverageConditional(ratio, B)); }
/// <summary> /// VMP message to 'ratio' /// </summary> /// <param name="A">Incoming message from 'a'. Must be a proper distribution. If uniform, the result will be uniform.</param> /// <param name="B">Constant value for 'b'.</param> /// <returns>The outgoing VMP message to the 'ratio' argument</returns> /// <remarks><para> /// The outgoing message is a distribution matching the moments of 'ratio' as the random arguments are varied. /// The formula is <c>proj[sum_(a) p(a) factor(ratio,a,b)]</c>. /// </para></remarks> /// <exception cref="ImproperMessageException"><paramref name="A"/> is not a proper distribution</exception> public static Gamma RatioAverageLogarithm([SkipIfUniform] Gamma A, double B) { return(GammaProductOp.AAverageConditional(A, B)); }
/// <summary> /// Evidence message for EP /// </summary> /// <param name="ratio">Constant value for 'ratio'.</param> /// <param name="a">Incoming message from '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_(a) p(a) factor(ratio,a,b))</c>. /// </para></remarks> public static double LogAverageFactor(double ratio, Gamma a, double b) { Gamma to_ratio = GammaProductOp.AAverageConditional(a, b); return(to_ratio.GetLogProb(ratio)); }
/// <summary> /// Evidence message for EP /// </summary> /// <param name="product">Constant value for 'product'.</param> /// <param name="a">Incoming message from '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_(a) p(a) factor(product,a,b))</c>. /// </para></remarks> public static double LogAverageFactor(double product, Gamma a, double b) { Gamma to_product = GammaProductOp.ProductAverageConditional(a, b); return(to_product.GetLogProb(product)); }