Class GateEnterPartialOp<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), "EnterPartial<>", new Type[]{null, typeof(int), null, typeof(int[])})]
[FactorMethod(typeof(Gate), "EnterPartial<>", new Type[]{null, typeof(bool), null, typeof(int[])})]
[Quality(QualityBand.Mature)]
public static class GateEnterPartialOp<T>
Type Parameters
Name | Description |
---|---|
T | The type of the variable entering the gate. |
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(enterPartial,selector,value,indices))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
EnterPartialAverageConditional<TValue>(TValue, TValue[])
EP message to enterPartial
.
Declaration
public static TValue[] EnterPartialAverageConditional<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 enterPartial
as the random arguments are varied. The formula is proj[p(enterPartial) sum_(value) p(value) factor(enterPartial,selector,value,indices)]/p(enterPartial)
.
EnterPartialAverageConditional<TValue, TResultList>(TValue, TResultList)
EP message to enterPartial
.
Declaration
public static TResultList EnterPartialAverageConditional<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 enterPartial
as the random arguments are varied. The formula is proj[p(enterPartial) sum_(value) p(value) factor(enterPartial,selector,value,indices)]/p(enterPartial)
.
EnterPartialAverageLogarithm<TValue>(TValue, TValue[])
VMP message to enterPartial
.
Declaration
public static TValue[] EnterPartialAverageLogarithm<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 enterPartial
as the random arguments are varied. The formula is proj[sum_(value) p(value) factor(enterPartial,selector,value,indices)]
.
EnterPartialAverageLogarithm<TValue, TResultList>(TValue, TResultList)
VMP message to enterPartial
.
Declaration
public static TResultList EnterPartialAverageLogarithm<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 enterPartial
as the random arguments are varied. The formula is proj[sum_(value) p(value) factor(enterPartial,selector,value,indices)]
.
EnterPartialInit<TValue, TArray>(TValue, Int32[], IArrayFactory<TValue, TArray>)
Initialize the buffer enterPartial
.
Declaration
public static TArray EnterPartialInit<TValue, TArray>(TValue value, int[] indices, IArrayFactory<TValue, TArray> factory)
where TValue : ICloneable
Parameters
Type | Name | Description |
---|---|---|
TValue | value | Incoming message from |
Int32[] | indices | Constant value for |
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(enterPartial,selector,value,indices))
.
LogEvidenceRatio<TDist>(IList<TDist>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<TDist>(IList<TDist> enterPartial)
where TDist : IDistribution<T>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | 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_(enterPartial) p(enterPartial) factor(enterPartial,selector,value,indices) / sum_enterPartial p(enterPartial) messageTo(enterPartial))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
SelectorAverageConditional(Bernoulli)
EP message to selector
.
Declaration
public static Bernoulli SelectorAverageConditional(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 selector
conditioned on the given values.
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(Bernoulli)
VMP message to selector
.
Declaration
public static Bernoulli SelectorAverageLogarithm(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 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>, Bernoulli, TDist, Int32[], TDist)
EP message to value
.
Declaration
public static TDist ValueAverageConditional<TDist>(IList<TDist> enterPartial, Bernoulli selector, TDist value, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableToProduct<TDist>, SettableToRatio<TDist>, SettableToWeightedSum<TDist>, CanGetLogAverageOf<TDist>, SettableToPower<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Bernoulli | selector | Incoming message from |
TDist | value | Incoming message from |
Int32[] | indices | Constant value for |
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_(enterPartial,selector) p(enterPartial,selector) factor(enterPartial,selector,value,indices)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
ImproperMessageException |
|
ValueAverageConditional<TDist>(IList<TDist>, Discrete, TDist, Int32[], TDist)
EP message to value
.
Declaration
public static TDist ValueAverageConditional<TDist>(IList<TDist> enterPartial, Discrete selector, TDist value, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableToProduct<TDist>, SettableToRatio<TDist>, SettableToWeightedSum<TDist>, CanGetLogAverageOf<TDist>, SettableToPower<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Discrete | selector | Incoming message from |
TDist | value | Incoming message from |
Int32[] | indices | Constant value for |
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_(enterPartial,selector) p(enterPartial,selector) factor(enterPartial,selector,value,indices)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
ImproperMessageException |
|
ValueAverageConditional<TDist>(IList<TDist>, Boolean, Int32[], TDist)
EP message to value
.
Declaration
public static TDist ValueAverageConditional<TDist>([SkipIfAllUniform] IList<TDist> enterPartial, bool selector, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableTo<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Boolean | selector | Incoming message from |
Int32[] | indices | Constant value for |
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_(enterPartial,selector) p(enterPartial,selector) factor(enterPartial,selector,value,indices)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageConditional<TDist>(IList<TDist>, Int32, Int32[], TDist)
EP message to value
.
Declaration
public static TDist ValueAverageConditional<TDist>([SkipIfAllUniform] IList<TDist> enterPartial, int selector, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableTo<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Int32 | selector | Constant value for |
Int32[] | indices | Constant value for |
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_(enterPartial) p(enterPartial) factor(enterPartial,selector,value,indices)]/p(value)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageConditional<TDist>(IList<T>, Boolean, Int32[], TDist)
EP message to value
.
Declaration
public static TDist ValueAverageConditional<TDist>(IList<T> enterPartial, bool selector, int[] indices, TDist result)
where TDist : IDistribution<T>
Parameters
Type | Name | Description |
---|---|---|
IList<T> | enterPartial | Incoming message from |
Boolean | selector | Incoming message from |
Int32[] | indices | Constant value for |
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_(enterPartial,selector) p(enterPartial,selector) factor(enterPartial,selector,value,indices)]/p(value)
.
ValueAverageLogarithm<TDist>(IList<TDist>, Bernoulli, Int32[], TDist)
VMP message to value
.
Declaration
public static TDist ValueAverageLogarithm<TDist>([SkipIfAllUniform] IList<TDist> enterPartial, Bernoulli selector, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableToProduct<TDist>, SettableToPower<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Bernoulli | selector | Incoming message from |
Int32[] | indices | Constant value for |
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, enterPartial
is integrated out before taking the logarithm. The formula is exp(sum_(selector) p(selector) log(sum_enterPartial p(enterPartial) factor(enterPartial,selector,value,indices)))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageLogarithm<TDist>(IList<TDist>, Discrete, Int32[], TDist)
VMP message to value
.
Declaration
public static TDist ValueAverageLogarithm<TDist>([SkipIfAllUniform] IList<TDist> enterPartial, Discrete selector, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableToProduct<TDist>, SettableToPower<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Discrete | selector | Incoming message from |
Int32[] | indices | Constant value for |
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, enterPartial
is integrated out before taking the logarithm. The formula is exp(sum_(selector) p(selector) log(sum_enterPartial p(enterPartial) factor(enterPartial,selector,value,indices)))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageLogarithm<TDist>(IList<TDist>, Boolean, Int32[], TDist)
VMP message to value
.
Declaration
public static TDist ValueAverageLogarithm<TDist>([SkipIfAllUniform] IList<TDist> enterPartial, bool selector, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableTo<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Boolean | selector | Incoming message from |
Int32[] | indices | Constant value for |
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, enterPartial
is integrated out before taking the logarithm. The formula is exp(sum_(selector) p(selector) log(sum_enterPartial p(enterPartial) factor(enterPartial,selector,value,indices)))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ValueAverageLogarithm<TDist>(IList<TDist>, Int32, Int32[], TDist)
VMP message to value
.
Declaration
public static TDist ValueAverageLogarithm<TDist>([SkipIfAllUniform] IList<TDist> enterPartial, int selector, int[] indices, TDist result)
where TDist : IDistribution<T>, SettableTo<TDist>
Parameters
Type | Name | Description |
---|---|---|
IList<TDist> | enterPartial | Incoming message from |
Int32 | selector | Constant value for |
Int32[] | indices | Constant value for |
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 factor viewed as a function of value
with enterPartial
integrated out. The formula is sum_enterPartial p(enterPartial) factor(enterPartial,selector,value,indices)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|