Class DiscreteFromDirichletOp
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(Discrete), "Sample", new Type[]{typeof(Vector)})]
[FactorMethod(new string[]{"sample", "probs"}, typeof(Factor), "Discrete", new Type[]{typeof(Vector)})]
[FactorMethod(typeof(EnumSupport), "DiscreteEnum<>", new Type[]{})]
[Quality(QualityBand.Mature)]
public static class DiscreteFromDirichletOp
Methods
AverageLogFactor(Discrete, Dirichlet)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Discrete sample, Dirichlet probs)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Dirichlet | probs | Incoming message from |
Returns
Type | Description |
---|---|
Double | Average of the factor's log-value across the given argument distributions. |
Remarks
The formula for the result is sum_(sample,probs) p(sample,probs) log(factor(sample,probs))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
AverageLogFactor(Discrete, Vector)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Discrete sample, Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Vector | probs | Constant value for |
Returns
Type | Description |
---|---|
Double | Average of the factor's log-value across the given argument distributions. |
Remarks
The formula for the result is sum_(sample) p(sample) log(factor(sample,probs))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Int32, Dirichlet)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, Dirichlet probs)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Dirichlet | probs | Incoming message from |
Returns
Type | Description |
---|---|
Double | Average of the factor's log-value across the given argument distributions. |
Remarks
The formula for the result is sum_(probs) p(probs) log(factor(sample,probs))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
AverageLogFactor(Int32, Vector)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Vector | probs | Constant value for |
Returns
Type | Description |
---|---|
Double | Average of the factor's log-value across the given argument distributions. |
Remarks
The formula for the result is log(factor(sample,probs))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
LogAverageFactor(Discrete, Discrete)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Discrete sample, Discrete to_sample)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Discrete | to_sample | Outgoing message to |
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) p(sample) factor(sample,probs))
.
LogAverageFactor(Int32, Dirichlet)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, Dirichlet probs)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Dirichlet | probs | Incoming message from |
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_(probs) p(probs) factor(sample,probs))
.
LogAverageFactor(Int32, Vector)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Vector | probs | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Remarks
The formula for the result is log(factor(sample,probs))
.
LogEvidenceRatio(Discrete, Dirichlet)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Discrete sample, Dirichlet probs)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Dirichlet | probs | 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_(sample,probs) p(sample,probs) factor(sample,probs) / sum_sample p(sample) messageTo(sample))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Discrete, Vector)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Discrete sample, Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Vector | probs | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(sum_(sample) p(sample) factor(sample,probs) / sum_sample p(sample) messageTo(sample))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Dirichlet)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, Dirichlet probs)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Dirichlet | probs | 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_(probs) p(probs) factor(sample,probs))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Vector)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Vector | probs | Constant value for |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(factor(sample,probs))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
ProbsAverageConditional(Discrete, Dirichlet, Dirichlet)
EP message to probs
.
Declaration
public static Dirichlet ProbsAverageConditional(Discrete sample, Dirichlet probs, Dirichlet result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Dirichlet | probs | Incoming message from |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Remarks
The outgoing message is a distribution matching the moments of probs
as the random arguments are varied. The formula is proj[p(probs) sum_(sample) p(sample) factor(sample,probs)]/p(probs)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ProbsAverageConditional(Discrete, Vector, Dirichlet)
EP message to probs
.
Declaration
public static Dirichlet ProbsAverageConditional(Discrete sample, Vector probs, Dirichlet result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Vector | probs | Constant value for |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Remarks
The outgoing message is a distribution matching the moments of probs
as the random arguments are varied. The formula is proj[p(probs) sum_(sample) p(sample) factor(sample,probs)]/p(probs)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ProbsAverageConditional(Int32, Dirichlet)
EP message to probs
.
Declaration
public static Dirichlet ProbsAverageConditional(int sample, Dirichlet result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Remarks
The outgoing message is the factor viewed as a function of probs
conditioned on the given values.
ProbsAverageLogarithm(Discrete, Dirichlet)
VMP message to probs
.
Declaration
public static Dirichlet ProbsAverageLogarithm(Discrete sample, Dirichlet result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except probs
. The formula is exp(sum_(sample) p(sample) log(factor(sample,probs)))
.
ProbsAverageLogarithm(Int32, Dirichlet)
VMP message to probs
.
Declaration
public static Dirichlet ProbsAverageLogarithm(int sample, Dirichlet result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Remarks
The outgoing message is the factor viewed as a function of probs
conditioned on the given values.
ProbsConditional(Int32, Dirichlet)
Gibbs message to probs
.
Declaration
public static Dirichlet ProbsConditional(int sample, Dirichlet result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Remarks
The outgoing message is the factor viewed as a function of probs
conditioned on the given values.
SampleAverageConditional(Dirichlet, Discrete)
EP message to sample
.
Declaration
public static Discrete SampleAverageConditional(Dirichlet probs, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Dirichlet | probs | Incoming message from |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
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_(probs) p(probs) factor(sample,probs)]/p(sample)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
SampleAverageConditional(Vector, Discrete)
EP message to sample
.
Declaration
public static Discrete SampleAverageConditional(Vector probs, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Vector | probs | Constant value for |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of sample
conditioned on the given values.
SampleAverageConditionalInit(Dirichlet)
Declaration
public static Discrete SampleAverageConditionalInit(Dirichlet probs)
Parameters
Type | Name | Description |
---|---|---|
Dirichlet | probs | Incoming message from |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleAverageConditionalInit(Vector)
Declaration
public static Discrete SampleAverageConditionalInit(Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Vector | probs | Constant value for |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleAverageLogarithm(Dirichlet, Discrete)
VMP message to sample
.
Declaration
public static Discrete SampleAverageLogarithm(Dirichlet probs, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Dirichlet | probs | Incoming message from |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except sample
. The formula is exp(sum_(probs) p(probs) log(factor(sample,probs)))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
SampleAverageLogarithm(Vector, Discrete)
VMP message to sample
.
Declaration
public static Discrete SampleAverageLogarithm(Vector probs, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Vector | probs | Constant value for |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of sample
conditioned on the given values.
SampleAverageLogarithmInit(Dirichlet)
Declaration
public static Discrete SampleAverageLogarithmInit(Dirichlet probs)
Parameters
Type | Name | Description |
---|---|---|
Dirichlet | probs | Incoming message from |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleAverageLogarithmInit(Vector)
Declaration
public static Discrete SampleAverageLogarithmInit(Vector probs)
Parameters
Type | Name | Description |
---|---|---|
Vector | probs | Constant value for |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleConditional(Vector, Discrete)
Gibbs message to sample
.
Declaration
public static Discrete SampleConditional(Vector probs, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Vector | probs | Constant value for |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of sample
conditioned on the given values.