Class PlusGammaOp
Provides outgoing messages for Plus(Double, Double), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "Plus", new Type[]{typeof(double), typeof(double)}, Default = true)]
[Quality(QualityBand.Experimental)]
public static class PlusGammaOp
Methods
AAverageConditional(GammaPower, GammaPower, GammaPower, GammaPower, GammaPower)
Declaration
public static GammaPower AAverageConditional(GammaPower sum, GammaPower a, GammaPower b, GammaPower to_a, GammaPower to_b)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | |
GammaPower | a | |
GammaPower | b | |
GammaPower | to_a | |
GammaPower | to_b |
Returns
Type | Description |
---|---|
GammaPower |
AAverageConditional(GammaPower, Double)
EP message to A
.
Declaration
public static GammaPower AAverageConditional(GammaPower sum, double b)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | Incoming message from |
Double | b | Constant value for |
Returns
Type | Description |
---|---|
GammaPower | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of A
as the random arguments are varied. The formula is proj[p(A) sum_(Sum) p(Sum) factor(Sum,A,B)]/p(A)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
AAverageConditional2(GammaPower, GammaPower, GammaPower, GammaPower)
Declaration
public static GammaPower AAverageConditional2(GammaPower sum, GammaPower a, GammaPower b, GammaPower result)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | |
GammaPower | a | |
GammaPower | b | |
GammaPower | result |
Returns
Type | Description |
---|---|
GammaPower |
BAverageConditional(GammaPower, GammaPower, GammaPower, GammaPower, GammaPower)
Declaration
public static GammaPower BAverageConditional(GammaPower sum, GammaPower a, GammaPower b, GammaPower to_a, GammaPower to_b)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | |
GammaPower | a | |
GammaPower | b | |
GammaPower | to_a | |
GammaPower | to_b |
Returns
Type | Description |
---|---|
GammaPower |
BAverageConditional(GammaPower, Double)
EP message to B
.
Declaration
public static GammaPower BAverageConditional(GammaPower sum, double a)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | Incoming message from |
Double | a | Constant value for |
Returns
Type | Description |
---|---|
GammaPower | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of B
as the random arguments are varied. The formula is proj[p(B) sum_(Sum) p(Sum) factor(Sum,A,B)]/p(B)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
BAverageConditional2(GammaPower, GammaPower, GammaPower, GammaPower)
Declaration
public static GammaPower BAverageConditional2(GammaPower sum, GammaPower a, GammaPower b, GammaPower result)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | |
GammaPower | a | |
GammaPower | b | |
GammaPower | result |
Returns
Type | Description |
---|---|
GammaPower |
GammaPowerFromDerivLogZ(GammaPower, Double, Double)
Declaration
public static GammaPower GammaPowerFromDerivLogZ(GammaPower a, double dlogZ, double ddlogZ)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | a | |
Double | dlogZ | |
Double | ddlogZ |
Returns
Type | Description |
---|---|
GammaPower |
GetDerivLogZ(GammaPower, GammaPower, Double, Double, Double, Double, out Double, out Double)
Gets the derivatives of the function that converts gamma parameters of toSum into the integral with sum.
Declaration
public static void GetDerivLogZ(GammaPower sum, GammaPower toSum, double ds, double dds, double dr, double ddr, out double dlogZ, out double ddlogZ)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | |
GammaPower | toSum | |
Double | ds | |
Double | dds | |
Double | dr | |
Double | ddr | |
Double | dlogZ | |
Double | ddlogZ |
GetGammaDerivs(Double, Double, Double, Double, Double, Double, out Double, out Double, out Double, out Double)
Gets the derivatives of the function that converts moments into gamma parameters.
Declaration
public static void GetGammaDerivs(double mean, double dmean, double ddmean, double variance, double dvariance, double ddvariance, out double ds, out double dds, out double dr, out double ddr)
Parameters
Type | Name | Description |
---|---|---|
Double | mean | |
Double | dmean | |
Double | ddmean | |
Double | variance | |
Double | dvariance | |
Double | ddvariance | |
Double | ds | |
Double | dds | |
Double | dr | |
Double | ddr |
GetGammaMomentDerivs(GammaPower, out Double, out Double, out Double, out Double, out Double, out Double)
Gets first and second derivatives of the moments with respect to the rate parameter of the distribution.
Declaration
public static void GetGammaMomentDerivs(GammaPower gammaPower, out double mean, out double dmean, out double ddmean, out double variance, out double dvariance, out double ddvariance)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | gammaPower | |
Double | mean | |
Double | dmean | |
Double | ddmean | |
Double | variance | |
Double | dvariance | |
Double | ddvariance |
GetInverseGammaDerivs(Double, Double, Double, Double, Double, Double, out Double, out Double, out Double, out Double)
Gets the derivatives of the function that converts moments into gamma parameters.
Declaration
public static void GetInverseGammaDerivs(double mean, double dmean, double ddmean, double variance, double dvariance, double ddvariance, out double ds, out double dds, out double dr, out double ddr)
Parameters
Type | Name | Description |
---|---|---|
Double | mean | |
Double | dmean | |
Double | ddmean | |
Double | variance | |
Double | dvariance | |
Double | ddvariance | |
Double | ds | |
Double | dds | |
Double | dr | |
Double | ddr |
GetInverseGammaMomentDerivs(GammaPower, out Double, out Double, out Double, out Double, out Double, out Double)
Gets first and second derivatives of the moments with respect to the rate parameter of the distribution.
Declaration
public static void GetInverseGammaMomentDerivs(GammaPower gammaPower, out double mean, out double dmean, out double ddmean, out double variance, out double dvariance, out double ddvariance)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | gammaPower | |
Double | mean | |
Double | dmean | |
Double | ddmean | |
Double | variance | |
Double | dvariance | |
Double | ddvariance |
GetPosteriorMeanAndVariance(Gamma, Double, Double, out Double, out Double)
Declaration
public static void GetPosteriorMeanAndVariance(Gamma prior, double dlogZ, double ddlogZ, out double mean, out double variance)
Parameters
Type | Name | Description |
---|---|---|
Gamma | prior | |
Double | dlogZ | |
Double | ddlogZ | |
Double | mean | |
Double | variance |
LogAverageFactor(GammaPower, GammaPower, GammaPower)
Declaration
public static double LogAverageFactor(GammaPower sum, GammaPower a, GammaPower b)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | |
GammaPower | a | |
GammaPower | b |
Returns
Type | Description |
---|---|
Double |
LogEvidenceRatio(GammaPower, GammaPower, GammaPower)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(GammaPower sum, GammaPower a, GammaPower b)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | sum | Incoming message from |
GammaPower | a | Incoming message from |
GammaPower | b | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(sum_(Sum,A,B) p(Sum,A,B) factor(Sum,A,B) / sum_Sum p(Sum) messageTo(Sum))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
ImproperMessageException |
|
SumAverageConditional(GammaPower, GammaPower, GammaPower)
Declaration
public static GammaPower SumAverageConditional(GammaPower a, GammaPower b, GammaPower result)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | a | |
GammaPower | b | |
GammaPower | result |
Returns
Type | Description |
---|---|
GammaPower |
SumAverageConditional(GammaPower, Double)
EP message to Sum
.
Declaration
public static GammaPower SumAverageConditional(GammaPower a, double b)
Parameters
Type | Name | Description |
---|---|---|
GammaPower | a | Incoming message from |
Double | b | Constant value for |
Returns
Type | Description |
---|---|
GammaPower | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of Sum
as the random arguments are varied. The formula is proj[p(Sum) sum_(A) p(A) factor(Sum,A,B)]/p(Sum)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
SumAverageConditional(Double, GammaPower)
EP message to Sum
.
Declaration
public static GammaPower SumAverageConditional(double a, GammaPower b)
Parameters
Type | Name | Description |
---|---|---|
Double | a | Constant value for |
GammaPower | b | Incoming message from |
Returns
Type | Description |
---|---|
GammaPower | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of Sum
as the random arguments are varied. The formula is proj[p(Sum) sum_(B) p(B) factor(Sum,A,B)]/p(Sum)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|