Class GateEnterOp<T>
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(Gate), "Enter<>", new Type[]{null, typeof(bool), null})]
[FactorMethod(typeof(Gate), "Enter<>", new Type[]{null, typeof(int), null})]
[Quality(QualityBand.Mature)]
public static class GateEnterOp<T>
Type Parameters
Name | Description |
---|---|
T |
Fields
ForceProper
Force proper messages
Declaration
public static bool ForceProper
Field Value
Type | Description |
---|---|
Boolean |
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(enter,selector,value))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
EnterAverageConditional<TValue>(TValue, TValue[])
EP message to enter
.
Declaration
public static TValue[] EnterAverageConditional<TValue>(TValue value, TValue[] result)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | Incoming message from |
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 enter
as the random arguments are varied. The formula is proj[p(enter) sum_(value) p(value) factor(enter,selector,value)]/p(enter)
.
EnterAverageConditional<TValue, TResultList>(TValue, TResultList)
EP message to enter
.
Declaration
public static TResultList EnterAverageConditional<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 enter
as the random arguments are varied. The formula is proj[p(enter) sum_(value) p(value) factor(enter,selector,value)]/p(enter)
.
EnterAverageLogarithm<TValue>(TValue, TValue[])
VMP message to enter
.
Declaration
public static TValue[] EnterAverageLogarithm<TValue>(TValue value, TValue[] result)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | Incoming message from |
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 enter
as the random arguments are varied. The formula is proj[sum_(value) p(value) factor(enter,selector,value)]
.
EnterAverageLogarithm<TValue, TResultList>(TValue, TResultList)
VMP message to enter
.
Declaration
public static TResultList EnterAverageLogarithm<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 enter
as the random arguments are varied. The formula is proj[sum_(value) p(value) factor(enter,selector,value)]
.
EnterInit<TValue, TArray>(Discrete, TValue, IArrayFactory<TValue, TArray>)
Initialize the buffer enter
.
Declaration
public static TArray EnterInit<TValue, TArray>(Discrete selector, TValue value, IArrayFactory<TValue, TArray> factory)
where TValue : ICloneable
Parameters
Type | Name | Description |
---|---|---|
Discrete | selector | Incoming message from |
TValue | value | Incoming message from |
IArrayFactory<TValue, TArray> | factory |
Returns
Type | Description |
---|---|
TArray | Initial value of buffer |
Type Parameters
Name | Description |
---|---|
TValue | The type of the incoming message from |
TArray | The type of an array that can be produced by |
Remarks
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(enter,selector,value))
.
LogEvidenceRatio<TDist>(IList<TDist>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<TDist>(IList<TDist> enter)
where TDist : IDistribution<T>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enter | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Type Parameters
Name | Description |
---|---|
TDist |
Remarks
The formula for the result is log(sum_(enter) p(enter) factor(enter,selector,value) / sum_enter p(enter) messageTo(enter))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
SelectorAverageConditional(Discrete)
EP message to selector
.
Declaration
public static Discrete SelectorAverageConditional(Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of selector
conditioned on the given values.
SelectorAverageLogarithm(Discrete)
VMP message to selector
.
Declaration
public static Discrete SelectorAverageLogarithm(Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of selector
conditioned on the given values.
ValueAverageConditional<TDist>(IList<TDist>, Discrete, TDist, TDist)
EP message to value
.
Declaration
public static TDist ValueAverageConditional<TDist>([SkipIfAllUniform] IList<TDist> enter, Discrete selector, TDist value, TDist result)
where TDist : IDistribution<T>, SettableToProduct<TDist>, SettableToRatio<TDist>, SettableToWeightedSum<TDist>, CanGetLogAverageOf<TDist>, SettableToPower<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enter | Incoming message from |
Discrete | selector | Incoming message from |
TDist | value | Incoming message from |
TDist | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TDist |
|
Type Parameters
Name | Description |
---|---|
TDist | The type of the distribution over 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_(enter,selector) p(enter,selector) factor(enter,selector,value)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageConditional<TDist>(IList<TDist>, Int32, TDist)
EP message to value
.
Declaration
public static TDist ValueAverageConditional<TDist>([SkipIfAllUniform] IList<TDist> enter, int selector, TDist result)
where TDist : IDistribution<T>, SettableTo<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enter | Incoming message from |
Int32 | selector | Incoming message from |
TDist | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TDist |
|
Type Parameters
Name | Description |
---|---|
TDist | The type of the distribution over 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_(enter,selector) p(enter,selector) factor(enter,selector,value)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageLogarithm<TDist>(IList<TDist>, Discrete, TDist)
VMP message to value
.
Declaration
public static TDist ValueAverageLogarithm<TDist>([SkipIfAllUniform] IList<TDist> enter, Discrete selector, TDist result)
where TDist : IDistribution<T>, SettableToProduct<TDist>, SettableToPower<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enter | Incoming message from |
Discrete | selector | Incoming message from |
TDist | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TDist |
|
Type Parameters
Name | Description |
---|---|
TDist | The type of the distribution over the variable entering the gate. |
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, enter
is integrated out before taking the logarithm. The formula is exp(sum_(selector) p(selector) log(sum_enter p(enter) factor(enter,selector,value)))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|