Class GaussianOp_Laplace
Provides outgoing messages for the following factors:
, given random arguments to the function.Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Gaussian), "Sample", new Type[]{typeof(double), typeof(double)}, Default = false)]
[FactorMethod(new string[]{"sample", "mean", "precision"}, typeof(Factor), "Gaussian", new Type[]{}, Default = false)]
[Buffers(new string[]{"Q"})]
[Quality(QualityBand.Experimental)]
public class GaussianOp_Laplace : GaussianOpBase
Fields
modified
Declaration
public static bool modified
Field Value
Type | Description |
---|---|
Boolean |
modified2
Declaration
public static bool modified2
Field Value
Type | Description |
---|---|
Boolean |
Methods
dlogfs(Double, Double, Double)
Derivatives of the factor wrt precision
Declaration
public static double[] dlogfs(double x, double m, double v)
Parameters
Type | Name | Description |
---|---|---|
Double | x | |
Double | m | |
Double | v |
Returns
Type | Description |
---|---|
Double[] |
dlogfxs(Double, Gamma)
Declaration
public static double[] dlogfxs(double x, Gamma precision)
Parameters
Type | Name | Description |
---|---|---|
Double | x | |
Gamma | precision |
Returns
Type | Description |
---|---|
Double[] |
LaplaceMoments(Gamma, Double[], Double[], out Double, out Double)
Approximate the mean and variance of a function g(x) where x is distributed according to a Gamma times f(x).
Declaration
public static void LaplaceMoments(Gamma q, double[] g, double[] dlogf, out double m, out double v)
Parameters
Type | Name | Description |
---|---|---|
Gamma | q | The Gamma distribution that multiplies f |
Double[] | g | g[0] = g(xhat), g[1] = g'(xhat), g[2] = g''(xhat), and so on. |
Double[] | dlogf | dlogf[0] = (logf)'(xhat), dlogf[1] = (logf)''(xhat), and so on. |
Double | m | |
Double | v |
LaplaceMoments(Gaussian, Double[], out Double, out Double)
Declaration
public static void LaplaceMoments(Gaussian q, double[] dlogfx, out double m, out double v)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | q | |
Double[] | dlogfx | |
Double | m | |
Double | v |
LaplaceMoments2(Gamma, Double[], Double[], out Double, out Double)
Declaration
public static void LaplaceMoments2(Gamma q, double[] xg, double[] xdlogf, out double m, out double v)
Parameters
Type | Name | Description |
---|---|---|
Gamma | q | |
Double[] | xg | |
Double[] | xdlogf | |
Double | m | |
Double | v |
LogAverageFactor(Gaussian, Gaussian, Gamma, Gamma)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Gaussian sample, Gaussian mean, Gamma precision, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | Incoming message from |
Gaussian | mean | Incoming message from |
Gamma | precision | 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,mean,precision) p(sample,mean,precision) factor(sample,mean,precision))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
LogEvidenceRatio(Gaussian, Gaussian, Gamma, Gaussian, Gamma)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Gaussian sample, Gaussian mean, Gamma precision, Gaussian to_sample, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | Incoming message from |
Gaussian | mean | Incoming message from |
Gamma | precision | Incoming message from |
Gaussian | to_sample | 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,mean,precision) p(sample,mean,precision) factor(sample,mean,precision) / sum_sample p(sample) messageTo(sample))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
ImproperMessageException |
|
LogEvidenceRatio(Double, Gaussian, Gamma, Gamma)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(double sample, Gaussian mean, Gamma precision, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Double | sample | Constant value for |
Gaussian | mean | Incoming message from |
Gamma | precision | Incoming message from |
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_(mean,precision) p(mean,precision) factor(sample,mean,precision))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
MeanAverageConditional(Gaussian, Gaussian, Gamma, Gamma)
EP message to mean
.
Declaration
public static Gaussian MeanAverageConditional(Gaussian sample, Gaussian mean, Gamma precision, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | Incoming message from |
Gaussian | mean | Incoming message from |
Gamma | precision | Incoming message from |
Gamma | q | Buffer |
Returns
Type | Description |
---|---|
Gaussian | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of mean
as the random arguments are varied. The formula is proj[p(mean) sum_(sample,precision) p(sample,precision) factor(sample,mean,precision)]/p(mean)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
PrecisionAverageConditional(Gaussian, Gaussian, Gamma, Gamma)
EP message to precision
.
Declaration
public static Gamma PrecisionAverageConditional(Gaussian sample, Gaussian mean, Gamma precision, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | Incoming message from |
Gaussian | mean | Incoming message from |
Gamma | precision | 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 precision
as the random arguments are varied. The formula is proj[p(precision) sum_(sample,mean) p(sample,mean) factor(sample,mean,precision)]/p(precision)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
ImproperMessageException |
|
PrecisionAverageConditional_slow(Gaussian, Gaussian, Gamma)
Declaration
public static Gamma PrecisionAverageConditional_slow(Gaussian sample, Gaussian mean, Gamma precision)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | |
Gaussian | mean | |
Gamma | precision |
Returns
Type | Description |
---|---|
Gamma |
Q(Gaussian, Gaussian, Gamma, Gamma)
Update the buffer Q
.
Declaration
public static Gamma Q(Gaussian sample, Gaussian mean, Gamma precision, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | Incoming message from |
Gaussian | mean | Incoming message from |
Gamma | precision | Incoming message from |
Gamma | q | Buffer |
Returns
Type | Description |
---|---|
Gamma | New value of buffer |
Remarks
Q_Slow(Gaussian, Gaussian, Gamma)
Declaration
public static Gamma Q_Slow(Gaussian sample, Gaussian mean, Gamma precision)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | |
Gaussian | mean | |
Gamma | precision |
Returns
Type | Description |
---|---|
Gamma |
QInit()
Initialize the buffer Q
.
Declaration
public static Gamma QInit()
Returns
Type | Description |
---|---|
Gamma | Initial value of buffer |
Remarks
Qx(Gaussian, Gamma, Gaussian)
Declaration
public static Gaussian Qx(Gaussian y, Gamma precision, Gaussian qx)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | y | |
Gamma | precision | |
Gaussian | qx |
Returns
Type | Description |
---|---|
Gaussian |
SampleAverageConditional(Gaussian, Gaussian, Gamma, Gamma)
EP message to sample
.
Declaration
public static Gaussian SampleAverageConditional(Gaussian sample, Gaussian mean, Gamma precision, Gamma q)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sample | Incoming message from |
Gaussian | mean | Incoming message from |
Gamma | precision | Incoming message from |
Gamma | q | Buffer |
Returns
Type | Description |
---|---|
Gaussian | 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_(mean,precision) p(mean,precision) factor(sample,mean,precision)]/p(sample)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
xdlogfs(Double, Double, Double)
Derivatives of the factor wrt precision, times powers of x
Declaration
public static double[] xdlogfs(double x, double m, double v)
Parameters
Type | Name | Description |
---|---|---|
Double | x | |
Double | m | |
Double | v |
Returns
Type | Description |
---|---|
Double[] |