// GammaPower = GammaPower ^ y ///////////////////////////////////////////////////////// /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="PowerOp"]/message_doc[@name="LogAverageFactor(GammaPower, GammaPower, double)"]/*'/> public static double LogAverageFactor(GammaPower pow, GammaPower x, double y) { // GetLogAverageOf = // gammaln(shape1+shape2-power) - (shape1+shape2-power)*log(rate1+rate2) - log(|power|) // -gammaln(shape1) + shape1 * log(rate1) // -gammaln(shape2) + shape2 * log(rate2) // d/dshape2 = digamma(shape1+shape2-power) - digamma(shape2) - log(rate1/rate2 + 1) // d/drate2 = -(shape1+shape2-power)/(rate1+rate2) + shape2/rate2 GammaPower toPow = PowAverageConditional(x, y, pow); return(toPow.GetLogAverageOf(pow)); }
/// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="GammaPowerProductOp_Laplace"]/message_doc[@name="LogEvidenceRatio(GammaPower, GammaPower, GammaPower, GammaPower, Gamma)"]/*'/> public static double LogEvidenceRatio([SkipIfUniform] GammaPower product, GammaPower A, GammaPower B, GammaPower to_product, Gamma q) { //if (double.IsPositiveInfinity(product.Rate)) return double.NegativeInfinity; return(LogAverageFactor(product, A, B, q) - to_product.GetLogAverageOf(product)); }
/// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="GammaProductOp"]/message_doc[@name="LogAverageFactor(GammaPower, GammaPower, double)"]/*'/> public static double LogAverageFactor(GammaPower product, GammaPower a, double b) { GammaPower to_product = GammaProductOp.ProductAverageConditional(a, b); return(to_product.GetLogAverageOf(product)); }
public static double LogAverageFactor([SkipIfUniform] GammaPower sum, [SkipIfUniform] GammaPower a, [SkipIfUniform] GammaPower b) { GammaPower toSum = SumAverageConditional(a, b, sum); return(toSum.GetLogAverageOf(sum)); }