Class GammaFromShapeAndRateOp_Laplace
Provides outgoing messages for GammaFromShapeAndRate(Double, Double), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "GammaFromShapeAndRate", new Type[]{}, Default = false)]
[Buffers(new string[]{"Q"})]
[Quality(QualityBand.Experimental)]
public class GammaFromShapeAndRateOp_Laplace : GammaFromShapeAndRateOpBase
Methods
LogAverageFactor(Gamma, Double, Gamma, Gamma)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Gamma sample, double shape, Gamma rate, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gamma | sample | Incoming message from |
Double | shape | Constant value for |
Gamma | rate | Incoming message from |
Gamma | q | Buffer |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Remarks
The formula for the result is log(sum_(sample,rate) p(sample,rate) factor(sample,shape,rate))
.
LogEvidenceRatio(Gamma, Double, Gamma, Gamma, Gamma)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Gamma sample, double shape, Gamma rate, Gamma to_sample, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gamma | sample | Incoming message from |
Double | shape | Constant value for |
Gamma | rate | Incoming message from |
Gamma | to_sample | Previous outgoing message to |
Gamma | q | Buffer |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(sum_(sample,rate) p(sample,rate) factor(sample,shape,rate) / sum_sample p(sample) messageTo(sample))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
Q(Gamma, Double, Gamma)
Update the buffer Q
.
Declaration
public static Gamma Q(Gamma sample, double shape, Gamma rate)
Parameters
Type | Name | Description |
---|---|---|
Gamma | sample | Incoming message from |
Double | shape | Constant value for |
Gamma | rate | Incoming message from |
Returns
Type | Description |
---|---|
Gamma | New value of buffer |
Remarks
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
QInit()
Initialize the buffer Q
.
Declaration
public static Gamma QInit()
Returns
Type | Description |
---|---|
Gamma | Initial value of buffer |
Remarks
RateAverageConditional(Gamma, Double, Gamma, Gamma)
EP message to rate
.
Declaration
public static Gamma RateAverageConditional(Gamma sample, double shape, Gamma rate, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gamma | sample | Incoming message from |
Double | shape | Constant value for |
Gamma | rate | Incoming message from |
Gamma | q | Buffer |
Returns
Type | Description |
---|---|
Gamma | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of rate
as the random arguments are varied. The formula is proj[p(rate) sum_(sample) p(sample) factor(sample,shape,rate)]/p(rate)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
SampleAverageConditional(Gamma, Double, Gamma, Gamma)
EP message to sample
.
Declaration
public static Gamma SampleAverageConditional(Gamma sample, double shape, Gamma rate, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gamma | sample | Incoming message from |
Double | shape | Constant value for |
Gamma | rate | Incoming message from |
Gamma | q | Buffer |
Returns
Type | Description |
---|---|
Gamma | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of sample
as the random arguments are varied. The formula is proj[p(sample) sum_(rate) p(rate) factor(sample,shape,rate)]/p(sample)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|