Class DirichletOp
Provides outgoing messages for DirichletFromMeanAndTotalCount(Vector, Double), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "DirichletFromMeanAndTotalCount", new Type[]{})]
[Quality(QualityBand.Preview)]
public static class DirichletOp
Fields
damping
How much damping to use to prevent improper messages. Higher values result in more damping.
Declaration
public static double damping
Field Value
| Type | Description |
|---|---|
| Double |
Methods
AverageLogFactor(Dirichlet, Dirichlet, Gamma)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Dirichlet prob, Dirichlet mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | prob | Incoming message from |
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | 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_(prob,mean,totalCount) p(prob,mean,totalCount) log(factor(prob,mean,totalCount)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
AverageLogFactor(Dirichlet, Vector, Gamma)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Dirichlet prob, Vector mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | prob | Incoming message from |
| Vector | mean | Constant value for |
| Gamma | totalCount | 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_(prob,totalCount) p(prob,totalCount) log(factor(prob,mean,totalCount)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
AverageLogFactor(Vector, Dirichlet, Gamma)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Vector prob, Dirichlet mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | 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_(mean,totalCount) p(mean,totalCount) log(factor(prob,mean,totalCount)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
AverageLogFactor(Vector, Vector, Gamma)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Vector prob, Vector mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Vector | mean | Constant value for |
| Gamma | totalCount | 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_(totalCount) p(totalCount) log(factor(prob,mean,totalCount)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
AverageLogFactor(Vector, Vector, Double)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Vector prob, Vector mean, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Vector | mean | Constant value for |
| Double | totalCount | 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(prob,mean,totalCount)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
EvidenceMessageExpectations(Dirichlet, Gamma)
Perform the quadrature required for the VMP evidence message
Declaration
public static Vector EvidenceMessageExpectations(Dirichlet meanQ, Gamma totalCountQ)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | meanQ | Incoming message from m='mean'. |
| Gamma | totalCountQ | Incoming message from s='totalCount'. |
Returns
| Type | Description |
|---|---|
| Vector | Vector of E[ LogGamma(s*m_k)]. |
Remarks
The quadrature over 'totalCount' (which is Gamma-distributed) is peformed by a change of variable x=log(s) followed by Gauss-Hermite quadrature. The quadrature over m is performed using Gauss-Legendre.
LogAverageFactor(Dirichlet, Dirichlet, Gamma)
Evidence message for EP.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static double LogAverageFactor(Dirichlet prob, Dirichlet mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | prob | Incoming message from |
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | 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_(prob,mean,totalCount) p(prob,mean,totalCount) factor(prob,mean,totalCount)).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
| ImproperMessageException |
|
LogAverageFactor(Dirichlet, Dirichlet, Double)
Evidence message for EP.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static double LogAverageFactor(Dirichlet prob, Dirichlet mean, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | prob | Incoming message from |
| Dirichlet | mean | Incoming message from |
| Double | totalCount | 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(sum_(prob,mean) p(prob,mean) factor(prob,mean,totalCount)).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
LogAverageFactor(Dirichlet, Vector, Dirichlet, Double)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Dirichlet prob, Vector mean, Dirichlet to_prob, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | prob | Incoming message from |
| Vector | mean | Constant value for |
| Dirichlet | to_prob | Previous outgoing message to |
| Double | totalCount | 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(sum_(prob) p(prob) factor(prob,mean,totalCount)).
LogAverageFactor(Dirichlet, Vector, Gamma)
Evidence message for EP.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static double LogAverageFactor(Dirichlet prob, Vector mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | prob | Incoming message from |
| Vector | mean | Constant value for |
| Gamma | totalCount | 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_(prob,totalCount) p(prob,totalCount) factor(prob,mean,totalCount)).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
LogAverageFactor(Vector, Dirichlet, Gamma)
Evidence message for EP.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static double LogAverageFactor(Vector prob, Dirichlet mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | 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_(mean,totalCount) p(mean,totalCount) factor(prob,mean,totalCount)).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
LogAverageFactor(Vector, Dirichlet, Double)
Evidence message for EP.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static double LogAverageFactor(Vector prob, Dirichlet mean, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Dirichlet | mean | Incoming message from |
| Double | totalCount | 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(sum_(mean) p(mean) factor(prob,mean,totalCount)).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
LogAverageFactor(Vector, Vector, Gamma)
Evidence message for EP.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static double LogAverageFactor(Vector prob, Vector mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Vector | mean | Constant value for |
| Gamma | totalCount | 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_(totalCount) p(totalCount) factor(prob,mean,totalCount)).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
LogAverageFactor(Vector, Vector, Double)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Vector prob, Vector mean, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Vector | mean | Constant value for |
| Double | totalCount | 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(prob,mean,totalCount)).
LogEvidenceRatio(Vector, Vector, Double)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Vector prob, Vector mean, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | prob | Constant value for |
| Vector | mean | Constant value for |
| Double | totalCount | 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(prob,mean,totalCount)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.
MeanAverageConditional(Dirichlet, Gamma, Dirichlet, Dirichlet)
EP message to mean.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet MeanAverageConditional(Dirichlet mean, Gamma totalCount, Dirichlet prob, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | Incoming message from |
| Dirichlet | prob | 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 mean as the random arguments are varied. The formula is proj[p(mean) sum_(totalCount,prob) p(totalCount,prob) factor(prob,mean,totalCount)]/p(mean).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
| ImproperMessageException |
|
MeanAverageConditional(Dirichlet, Gamma, Vector, Dirichlet)
EP message to mean.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet MeanAverageConditional(Dirichlet mean, Gamma totalCount, Vector prob, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | Incoming message from |
| Vector | prob | 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 mean as the random arguments are varied. The formula is proj[p(mean) sum_(totalCount) p(totalCount) factor(prob,mean,totalCount)]/p(mean).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
MeanAverageConditional(Dirichlet, Double, Dirichlet, Dirichlet)
EP message to mean.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet MeanAverageConditional(Dirichlet mean, double totalCount, Dirichlet prob, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Double | totalCount | Constant value for |
| Dirichlet | prob | 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 mean as the random arguments are varied. The formula is proj[p(mean) sum_(prob) p(prob) factor(prob,mean,totalCount)]/p(mean).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
MeanAverageConditional(Dirichlet, Double, Vector, Dirichlet)
EP message to mean.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet MeanAverageConditional(Dirichlet mean, double totalCount, Vector prob, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Double | totalCount | Constant value for |
| Vector | prob | 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 mean conditioned on the given values.
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
MeanAverageLogarithm(Dirichlet, Gamma, Dirichlet, Dirichlet)
VMP message to mean.
Declaration
public static Dirichlet MeanAverageLogarithm(Dirichlet mean, Gamma totalCount, Dirichlet prob, Dirichlet to_mean)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | Incoming message from |
| Dirichlet | prob | Incoming message from |
| Dirichlet | to_mean | Previous outgoing message to |
Returns
| Type | Description |
|---|---|
| Dirichlet | The outgoing VMP message to the |
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except mean. The formula is exp(sum_(totalCount,prob) p(totalCount,prob) log(factor(prob,mean,totalCount))).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
MeanMessageExpectations(Vector, Gamma, out Double[], out Double[], out Double[])
Perform the quadrature required for the Nonconjugate VMP message to 'mean'
Declaration
public static void MeanMessageExpectations(Vector meanQPseudoCount, Gamma totalCountQ, out double[] EELogGamma, out double[] EELogMLogGamma, out double[] EELogOneMinusMLogGamma)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | meanQPseudoCount | Incoming message from 'mean'. |
| Gamma | totalCountQ | Incoming message from 'totalCount'. |
| Double[] | EELogGamma | Array to be filled with E[LogGamma(s*m_k)]. |
| Double[] | EELogMLogGamma | Array to be filled with E[Log(m_k)LogGamma(sm_k)]. |
| Double[] | EELogOneMinusMLogGamma | Array to be filled with E[Log(1-m_k)LogGamma(sm_k)]. |
Remarks
All three arrays are calculated simultaneously for efficiency. The quadrature over 'totalCount' (which is Gamma-distributed) is performed by a change of variable x=log(s) followed by Gauss-Hermite quadrature. The quadrature over m is performed using Gauss-Legendre.
ProbAverageConditional(Dirichlet, Gamma)
EP message to prob.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet ProbAverageConditional(Dirichlet mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | Incoming message from |
Returns
| Type | Description |
|---|---|
| Dirichlet | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of prob as the random arguments are varied. The formula is proj[p(prob) sum_(mean,totalCount) p(mean,totalCount) factor(prob,mean,totalCount)]/p(prob).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
ProbAverageConditional(Dirichlet, Double)
EP message to prob.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet ProbAverageConditional(Dirichlet mean, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Double | totalCount | Constant value for |
Returns
| Type | Description |
|---|---|
| Dirichlet | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of prob as the random arguments are varied. The formula is proj[p(prob) sum_(mean) p(mean) factor(prob,mean,totalCount)]/p(prob).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
ProbAverageConditional(Vector, Gamma)
EP message to prob.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet ProbAverageConditional(Vector mean, Gamma totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | Constant value for |
| Gamma | totalCount | Incoming message from |
Returns
| Type | Description |
|---|---|
| Dirichlet | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of prob as the random arguments are varied. The formula is proj[p(prob) sum_(totalCount) p(totalCount) factor(prob,mean,totalCount)]/p(prob).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
ProbAverageConditional(Vector, Double)
EP message to prob.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Dirichlet ProbAverageConditional(Vector mean, double totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | Constant value for |
| Double | totalCount | Constant value for |
Returns
| Type | Description |
|---|---|
| Dirichlet | The outgoing EP message to the |
Remarks
The outgoing message is the factor viewed as a function of prob conditioned on the given values.
ProbAverageConditional(Vector, Double, Dirichlet)
Declaration
public static Dirichlet ProbAverageConditional(Vector mean, double totalCount, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | |
| Double | totalCount | |
| Dirichlet | result |
Returns
| Type | Description |
|---|---|
| Dirichlet |
ProbAverageLogarithm(Dirichlet, Gamma, Dirichlet)
Declaration
public static Dirichlet ProbAverageLogarithm(Dirichlet mean, Gamma totalCount, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | |
| Gamma | totalCount | |
| Dirichlet | result |
Returns
| Type | Description |
|---|---|
| Dirichlet |
ProbAverageLogarithm(Dirichlet, Double, Dirichlet)
Declaration
public static Dirichlet ProbAverageLogarithm(Dirichlet mean, double totalCount, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | |
| Double | totalCount | |
| Dirichlet | result |
Returns
| Type | Description |
|---|---|
| Dirichlet |
ProbAverageLogarithm(Vector, Gamma, Dirichlet)
Declaration
public static Dirichlet ProbAverageLogarithm(Vector mean, Gamma totalCount, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | |
| Gamma | totalCount | |
| Dirichlet | result |
Returns
| Type | Description |
|---|---|
| Dirichlet |
ProbAverageLogarithm(Vector, Double, Dirichlet)
Declaration
public static Dirichlet ProbAverageLogarithm(Vector mean, double totalCount, Dirichlet result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | |
| Double | totalCount | |
| Dirichlet | result |
Returns
| Type | Description |
|---|---|
| Dirichlet |
TotalCountAverageConditional(Dirichlet, Gamma, Dirichlet, Gamma)
EP message to totalCount.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Gamma TotalCountAverageConditional(Dirichlet mean, Gamma totalCount, Dirichlet prob, Gamma result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | Incoming message from |
| Dirichlet | prob | Incoming message from |
| Gamma | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| Gamma |
|
Remarks
The outgoing message is a distribution matching the moments of totalCount as the random arguments are varied. The formula is proj[p(totalCount) sum_(mean,prob) p(mean,prob) factor(prob,mean,totalCount)]/p(totalCount).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
| ImproperMessageException |
|
TotalCountAverageConditional(Dirichlet, Gamma, Vector, Gamma)
EP message to totalCount.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Gamma TotalCountAverageConditional(Dirichlet mean, Gamma totalCount, Vector prob, Gamma result)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | Incoming message from |
| Vector | prob | Constant value for |
| Gamma | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| Gamma |
|
Remarks
The outgoing message is a distribution matching the moments of totalCount as the random arguments are varied. The formula is proj[p(totalCount) sum_(mean) p(mean) factor(prob,mean,totalCount)]/p(totalCount).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
TotalCountAverageConditional(Vector, Gamma, Dirichlet, Gamma)
EP message to totalCount.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Gamma TotalCountAverageConditional(Vector mean, Gamma totalCount, Dirichlet prob, Gamma result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | Constant value for |
| Gamma | totalCount | Incoming message from |
| Dirichlet | prob | Incoming message from |
| Gamma | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| Gamma |
|
Remarks
The outgoing message is a distribution matching the moments of totalCount as the random arguments are varied. The formula is proj[p(totalCount) sum_(prob) p(prob) factor(prob,mean,totalCount)]/p(totalCount).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
TotalCountAverageConditional(Vector, Gamma, Vector, Gamma)
EP message to totalCount.
Declaration
[NotSupported("Expectation Propagation does not currently support Dirichlet distributions with stochastic arguments")]
public static Gamma TotalCountAverageConditional(Vector mean, Gamma totalCount, Vector prob, Gamma result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | Constant value for |
| Gamma | totalCount | Incoming message from |
| Vector | prob | Constant value for |
| Gamma | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| Gamma |
|
Remarks
The outgoing message is the factor viewed as a function of totalCount conditioned on the given values.
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
TotalCountAverageLogarithm(Dirichlet, Gamma, Dirichlet, Gamma)
VMP message to totalCount.
Declaration
public static Gamma TotalCountAverageLogarithm(Dirichlet mean, Gamma totalCount, Dirichlet prob, Gamma to_totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Dirichlet | mean | Incoming message from |
| Gamma | totalCount | Incoming message from |
| Dirichlet | prob | Incoming message from |
| Gamma | to_totalCount | Previous outgoing message to |
Returns
| Type | Description |
|---|---|
| Gamma | The outgoing VMP message to the |
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except totalCount. The formula is exp(sum_(mean,prob) p(mean,prob) log(factor(prob,mean,totalCount))).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
TotalCountAverageLogarithm(Vector, Gamma, Dirichlet, Gamma)
VMP message to totalCount.
Declaration
public static Gamma TotalCountAverageLogarithm(Vector mean, Gamma totalCount, Dirichlet prob, Gamma to_totalCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | mean | Constant value for |
| Gamma | totalCount | Incoming message from |
| Dirichlet | prob | Incoming message from |
| Gamma | to_totalCount | Previous outgoing message to |
Returns
| Type | Description |
|---|---|
| Gamma | The outgoing VMP message to the |
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except totalCount. The formula is exp(sum_(prob) p(prob) log(factor(prob,mean,totalCount))).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
| ImproperMessageException |
|
TotalCountMessageExpectations(Vector, Gamma, out Double[], out Double[], out Double[])
Perform the quadrature required for the Nonconjugate VMP message to 'totalCount'
Declaration
public static void TotalCountMessageExpectations(Vector meanQPseudoCount, Gamma totalCountQ, out double[] EELogGamma, out double[] EELogSLogGamma, out double[] EEMSDigamma)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | meanQPseudoCount | Incoming message from 'mean'. |
| Gamma | totalCountQ | Incoming message from 'totalCount'. |
| Double[] | EELogGamma | Array to be filled with E[LogGamma(s*m_k)]. |
| Double[] | EELogSLogGamma | Array to be filled with E[Log(s)LogGamma(sm_k)]. |
| Double[] | EEMSDigamma | Array to be filled with E[sm_kDigamma(s*m_k)]. |
Remarks
All three arrays are calculated simultaneously for efficiency. The quadrature over 'totalCount' (which is Gamma-distributed) is peformed by a change of variable x=log(s) followed by Gauss-Hermite quadrature. The quadrature over m is performed using Gauss-Legendre.