Class UnaryOp<DomainType>
Provides outgoing messages for Random<DomainType>(Sampleable<DomainType>), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "Random<>", new Type[]{})]
[Quality(QualityBand.Mature)]
public static class UnaryOp<DomainType>
Type Parameters
Name | Description |
---|---|
DomainType | The type of the sampled variable. |
Methods
AverageLogFactor<T>(T, T)
Evidence message for VMP.
Declaration
public static double AverageLogFactor<T>(T random, T dist)
where T : CanGetAverageLog<T>
Parameters
Type | Name | Description |
---|---|---|
T | random | Incoming message from |
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
Double | Average of the factor's log-value across the given argument distributions. |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The formula for the result is sum_(random,dist) p(random,dist) log(factor(random,dist))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor<T>(DomainType, T)
Evidence message for VMP.
Declaration
public static double AverageLogFactor<T>(DomainType random, T dist)
where T : CanGetLogProb<DomainType>
Parameters
Type | Name | Description |
---|---|---|
DomainType | random | Incoming message from |
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
Double | Average of the factor's log-value across the given argument distributions. |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The formula for the result is sum_(random,dist) p(random,dist) log(factor(random,dist))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
LogAverageFactor<T>(T, T)
Evidence message for EP.
Declaration
public static double LogAverageFactor<T>(T random, T dist)
where T : CanGetLogAverageOf<T>
Parameters
Type | Name | Description |
---|---|---|
T | random | Incoming message from |
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The formula for the result is log(sum_(random,dist) p(random,dist) factor(random,dist))
.
LogAverageFactor<T>(DomainType, T)
Evidence message for EP.
Declaration
public static double LogAverageFactor<T>(DomainType random, T dist)
where T : CanGetLogProb<DomainType>
Parameters
Type | Name | Description |
---|---|---|
DomainType | random | Incoming message from |
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's average value across the given argument distributions. |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The formula for the result is log(sum_(random,dist) p(random,dist) factor(random,dist))
.
LogEvidenceRatio<T>(T, T)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<T>(T random, T dist)
Parameters
Type | Name | Description |
---|---|---|
T | random | Incoming message from |
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The formula for the result is log(sum_(random,dist) p(random,dist) factor(random,dist) / sum_random p(random) messageTo(random))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio<T>(DomainType, T)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio<T>(DomainType random, T dist)
where T : CanGetLogProb<DomainType>
Parameters
Type | Name | Description |
---|---|---|
DomainType | random | Incoming message from |
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The formula for the result is log(sum_(random,dist) p(random,dist) factor(random,dist) / sum_random p(random) messageTo(random))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
RandomAverageConditional<T>(T)
EP message to random
.
Declaration
public static T RandomAverageConditional<T>(T dist)
Parameters
Type | Name | Description |
---|---|---|
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
T | The outgoing EP message to the |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The outgoing message is a distribution matching the moments of random
as the random arguments are varied. The formula is proj[p(random) sum_(dist) p(dist) factor(random,dist)]/p(random)
.
RandomAverageLogarithm<T>(T)
VMP message to random
.
Declaration
public static T RandomAverageLogarithm<T>(T dist)
Parameters
Type | Name | Description |
---|---|---|
T | dist | Incoming message from |
Returns
Type | Description |
---|---|
T | The outgoing VMP message to the |
Type Parameters
Name | Description |
---|---|
T | The type of the distribution over the sampled variable. |
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except random
. The formula is exp(sum_(dist) p(dist) log(factor(random,dist)))
.
RandomMaxConditional(Bernoulli)
Declaration
public static Bernoulli RandomMaxConditional(Bernoulli dist)
Parameters
Type | Name | Description |
---|---|---|
Bernoulli | dist | Incoming message from |
Returns
Type | Description |
---|---|
Bernoulli |
Remarks
RandomMaxConditional(Discrete)
Declaration
public static UnnormalizedDiscrete RandomMaxConditional(Discrete dist)
Parameters
Type | Name | Description |
---|---|---|
Discrete | dist | Incoming message from |
Returns
Type | Description |
---|---|
UnnormalizedDiscrete |
Remarks
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|