Class GateEnterPartialTwoOp
Provides outgoing messages for EnterPartialTwo<T>(Boolean, Boolean, T, Int32[]), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Gate), "EnterPartialTwo<>", new Type[]{})]
[Quality(QualityBand.Mature)]
public static class GateEnterPartialTwoOp
Methods
AverageLogFactor()
Evidence message for VMP.
Declaration
public static double AverageLogFactor()
Returns
Type | Description |
---|---|
Double | Zero. |
Remarks
The formula for the result is log(factor(enterPartialTwo,case0,case1,value,indices))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
Case0AverageConditional(Bernoulli)
EP message to case0
.
Declaration
public static Bernoulli Case0AverageConditional(Bernoulli result)
Parameters
Type | Name | Description |
---|---|---|
Bernoulli | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Bernoulli |
|
Remarks
The outgoing message is the factor viewed as a function of case0
conditioned on the given values.
Case0AverageLogarithm<TValue>(IList<TValue>, TValue, Int32[], Bernoulli)
VMP message to case0
.
Declaration
public static Bernoulli Case0AverageLogarithm<TValue>(IList<TValue> enterPartialTwo, TValue value, int[] indices, Bernoulli result)
Parameters
Type | Name | Description |
---|---|---|
IList<TValue> | enterPartialTwo | Incoming message from |
TValue | value | Incoming message from |
Int32[] | indices | Constant value for |
Bernoulli | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Bernoulli |
|
Type Parameters
Name | Description |
---|---|
TValue | The type of the message from |
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except case0
. Because the factor is deterministic, enterPartialTwo
is integrated out before taking the logarithm. The formula is exp(sum_(value) p(value) log(sum_enterPartialTwo p(enterPartialTwo) factor(enterPartialTwo,case0,case1,value,indices)))
.
Case1AverageConditional(Bernoulli)
EP message to case1
.
Declaration
public static Bernoulli Case1AverageConditional(Bernoulli result)
Parameters
Type | Name | Description |
---|---|---|
Bernoulli | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Bernoulli |
|
Remarks
The outgoing message is the factor viewed as a function of case1
conditioned on the given values.
Case1AverageLogarithm<TValue>(IList<TValue>, TValue, Int32[], Bernoulli)
VMP message to case1
.
Declaration
public static Bernoulli Case1AverageLogarithm<TValue>(IList<TValue> enterPartialTwo, TValue value, int[] indices, Bernoulli result)
Parameters
Type | Name | Description |
---|---|---|
IList<TValue> | enterPartialTwo | Incoming message from |
TValue | value | Incoming message from |
Int32[] | indices | Constant value for |
Bernoulli | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Bernoulli |
|
Type Parameters
Name | Description |
---|---|
TValue | The type of the message from |
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except case1
. Because the factor is deterministic, enterPartialTwo
is integrated out before taking the logarithm. The formula is exp(sum_(value) p(value) log(sum_enterPartialTwo p(enterPartialTwo) factor(enterPartialTwo,case0,case1,value,indices)))
.
EnterPartialTwoAverageConditional<TValue, TResultList>(TValue, TResultList)
EP message to enterPartialTwo
.
Declaration
public static TResultList EnterPartialTwoAverageConditional<TValue, TResultList>(TValue value, TResultList result)
where TResultList : CanSetAllElementsTo<TValue>
Parameters
Type | Name | Description |
---|---|---|
TValue | value | Incoming message from |
TResultList | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TResultList |
|
Type Parameters
Name | Description |
---|---|
TValue | The type of the message from |
TResultList | The type of the outgoing message. |
Remarks
The outgoing message is a distribution matching the moments of enterPartialTwo
as the random arguments are varied. The formula is proj[p(enterPartialTwo) sum_(value) p(value) factor(enterPartialTwo,case0,case1,value,indices)]/p(enterPartialTwo)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
EnterPartialTwoAverageLogarithm<TValue, TResultList>(TValue, TResultList)
VMP message to enterPartialTwo
.
Declaration
public static TResultList EnterPartialTwoAverageLogarithm<TValue, TResultList>(TValue value, TResultList result)
where TResultList : CanSetAllElementsTo<TValue>
Parameters
Type | Name | Description |
---|---|---|
TValue | value | Incoming message from |
TResultList | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TResultList |
|
Type Parameters
Name | Description |
---|---|
TValue | The type of the message from |
TResultList | The type of the outgoing message. |
Remarks
The outgoing message is a distribution matching the moments of enterPartialTwo
as the random arguments are varied. The formula is proj[sum_(value) p(value) factor(enterPartialTwo,case0,case1,value,indices)]
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
LogAverageFactor()
Evidence message for EP.
Declaration
public static double LogAverageFactor()
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(enterPartialTwo,case0,case1,value,indices))
.
LogEvidenceRatio()
Evidence message for EP.
Declaration
public static double LogEvidenceRatio()
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(factor(enterPartialTwo,case0,case1,value,indices))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
ValueAverageConditional<TValue>(IList<TValue>, Bernoulli, Bernoulli, TValue, Int32[], TValue)
EP message to value
.
Declaration
public static TValue ValueAverageConditional<TValue>([SkipIfAllUniform] IList<TValue> enterPartialTwo, Bernoulli case0, Bernoulli case1, TValue value, int[] indices, TValue result)
where TValue : ICloneable, SettableToUniform, SettableToProduct<TValue>, SettableToRatio<TValue>, SettableToWeightedSum<TValue>, CanGetLogAverageOf<TValue>
Parameters
Type | Name | Description |
---|---|---|
IList<TValue> | enterPartialTwo | Incoming message from |
Bernoulli | case0 | Incoming message from |
Bernoulli | case1 | Incoming message from |
TValue | value | Incoming message from |
Int32[] | indices | Constant value for |
TValue | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TValue |
|
Type Parameters
Name | Description |
---|---|
TValue | The type of the message from |
Remarks
The outgoing message is a distribution matching the moments of value
as the random arguments are varied. The formula is proj[p(value) sum_(enterPartialTwo,case0,case1) p(enterPartialTwo,case0,case1) factor(enterPartialTwo,case0,case1,value,indices)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageConditional<TValue, TDomain>(IList<TValue>, Boolean, Boolean, Int32[], TValue)
EP message to value
.
Declaration
public static TValue ValueAverageConditional<TValue, TDomain>([SkipIfAllUniform] IList<TValue> enterPartialTwo, bool case1, bool case2, int[] indices, TValue result)
where TValue : IDistribution<TDomain>, SettableTo<TValue>
Parameters
Type | Name | Description |
---|---|---|
IList<TValue> | enterPartialTwo | Incoming message from |
Boolean | case1 | Constant value for |
Boolean | case2 | |
Int32[] | indices | Constant value for |
TValue | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TValue |
|
Type Parameters
Name | Description |
---|---|
TValue | The type of the message from |
TDomain | The type of the variable entering the gate. |
Remarks
The outgoing message is a distribution matching the moments of value
as the random arguments are varied. The formula is proj[p(value) sum_(enterPartialTwo) p(enterPartialTwo) factor(enterPartialTwo,case0,case1,value,indices)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageLogarithm<TValue>(IList<TValue>, Bernoulli, Bernoulli, Int32[], TValue)
VMP message to value
.
Declaration
public static TValue ValueAverageLogarithm<TValue>([SkipIfAllUniform] IList<TValue> enterPartialTwo, Bernoulli case0, Bernoulli case1, int[] indices, TValue result)
where TValue : ICloneable, SettableToProduct<TValue>, SettableToPower<TValue>
Parameters
Type | Name | Description |
---|---|---|
IList<TValue> | enterPartialTwo | Incoming message from |
Bernoulli | case0 | Incoming message from |
Bernoulli | case1 | Incoming message from |
Int32[] | indices | Constant value for |
TValue | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TValue |
|
Type Parameters
Name | Description |
---|---|
TValue | The type of the message from |
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except value
. Because the factor is deterministic, enterPartialTwo
is integrated out before taking the logarithm. The formula is exp(sum_(case0,case1) p(case0,case1) log(sum_enterPartialTwo p(enterPartialTwo) factor(enterPartialTwo,case0,case1,value,indices)))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|