Class DiscreteUniform
Provides outgoing messages for DiscreteUniform(Int32), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "DiscreteUniform", new Type[]{})]
[Quality(QualityBand.Mature)]
public static class DiscreteUniform
Remarks
Factor is f(sample, size) = 1(sample < size)/size
Methods
AverageLogFactor(Discrete, Discrete)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Discrete sample, Discrete size)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Discrete | size | 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_(sample,size) p(sample,size) log(factor(sample,size))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Discrete, Int32)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Discrete sample, int size)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Int32 | size | 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 sum_(sample) p(sample) log(factor(sample,size))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Int32, Discrete)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, Discrete size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Discrete | size | 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_(size) p(size) log(factor(sample,size))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Int32, Int32)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, int size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Int32 | size | 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(sample,size))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
LogAverageFactor(Discrete, Discrete)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Discrete sample, Discrete to_sample)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Discrete | to_sample | Outgoing message to |
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_(sample) p(sample) factor(sample,size))
.
LogAverageFactor(Int32, Discrete)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, Discrete size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Discrete | size | 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_(size) p(size) factor(sample,size))
.
LogAverageFactor(Int32, Int32)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, int size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Int32 | size | 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(sample,size))
.
LogEvidenceRatio(Discrete, Discrete)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Discrete sample, Discrete size)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Discrete | size | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(sum_(sample,size) p(sample,size) factor(sample,size) / sum_sample p(sample) messageTo(sample))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
LogEvidenceRatio(Discrete, Int32)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Discrete sample, int size)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Int32 | size | 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(sum_(sample) p(sample) factor(sample,size) / sum_sample p(sample) messageTo(sample))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
LogEvidenceRatio(Int32, Discrete)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, Discrete size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Discrete | size | Incoming message from |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(sum_(size) p(size) factor(sample,size))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Int32)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, int size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Int32 | size | 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(sample,size))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
SampleAverageConditional(Discrete, Discrete)
EP message to sample
.
Declaration
public static Discrete SampleAverageConditional(Discrete size, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | size | Incoming message from |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is a distribution matching the moments of sample
as the random arguments are varied. The formula is proj[p(sample) sum_(size) p(size) factor(sample,size)]/p(sample)
.
SampleAverageConditional(Int32, Discrete)
EP message to sample
.
Declaration
public static Discrete SampleAverageConditional(int size, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | Constant value for |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of sample
conditioned on the given values.
SampleAverageConditionalInit(Discrete)
Declaration
public static Discrete SampleAverageConditionalInit(Discrete size)
Parameters
Type | Name | Description |
---|---|---|
Discrete | size | Incoming message from |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleAverageConditionalInit(Int32)
Declaration
public static Discrete SampleAverageConditionalInit(int size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | Constant value for |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleAverageLogarithm(Discrete, Discrete)
VMP message to sample
.
Declaration
public static Discrete SampleAverageLogarithm(Discrete size, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | size | Incoming message from |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except sample
. The formula is exp(sum_(size) p(size) log(factor(sample,size)))
.
SampleAverageLogarithm(Int32, Discrete)
VMP message to sample
.
Declaration
public static Discrete SampleAverageLogarithm(int size, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | Constant value for |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of sample
conditioned on the given values.
SampleAverageLogarithmInit(Discrete)
Declaration
public static Discrete SampleAverageLogarithmInit(Discrete size)
Parameters
Type | Name | Description |
---|---|---|
Discrete | size | Incoming message from |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleAverageLogarithmInit(Int32)
Declaration
public static Discrete SampleAverageLogarithmInit(int size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | Constant value for |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SizeAverageConditional(Discrete, Discrete)
EP message to size
.
Declaration
public static Discrete SizeAverageConditional(Discrete sample, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is a distribution matching the moments of size
as the random arguments are varied. The formula is proj[p(size) sum_(sample) p(sample) factor(sample,size)]/p(size)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
SizeAverageConditional(Int32, Discrete)
EP message to size
.
Declaration
public static Discrete SizeAverageConditional(int sample, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of size
conditioned on the given values.
SizeAverageLogarithm(Discrete, Discrete)
VMP message to size
.
Declaration
public static Discrete SizeAverageLogarithm(Discrete sample, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except size
. The formula is exp(sum_(sample) p(sample) log(factor(sample,size)))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
SizeAverageLogarithm(Int32, Discrete)
VMP message to size
.
Declaration
public static Discrete SizeAverageLogarithm(int sample, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Discrete | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Discrete |
|
Remarks
The outgoing message is the factor viewed as a function of size
conditioned on the given values.