Class BernoulliFromDiscreteOp
Provides outgoing messages for BernoulliFromDiscrete(Int32, Double[]), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(new string[]{"sample", "index", "probTrue"}, typeof(Factor), "BernoulliFromDiscrete", new Type[]{})]
public static class BernoulliFromDiscreteOp
Methods
IndexAverageConditional(Bernoulli, Double[], Discrete)
EP message to index.
Declaration
public static Discrete IndexAverageConditional(Bernoulli sample, double[] ProbTrue, Discrete result)
Parameters
| Type | Name | Description |
|---|---|---|
| Bernoulli | sample | Incoming message from |
| Double[] | ProbTrue | Constant value for |
| Discrete | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| Discrete |
|
Remarks
The outgoing message is a distribution matching the moments of index as the random arguments are varied. The formula is proj[p(index) sum_(sample) p(sample) factor(sample,index,probTrue)]/p(index).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
IndexAverageConditional(Boolean, Double[], Discrete)
EP message to index.
Declaration
public static Discrete IndexAverageConditional(bool sample, double[] ProbTrue, Discrete result)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | sample | Constant value for |
| Double[] | ProbTrue | 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 index conditioned on the given values.
IndexAverageLogarithm(Bernoulli, Double[], Discrete)
VMP message to index.
Declaration
public static Discrete IndexAverageLogarithm(Bernoulli sample, double[] ProbTrue, Discrete result)
Parameters
| Type | Name | Description |
|---|---|---|
| Bernoulli | sample | Incoming message from |
| Double[] | ProbTrue | Constant value for |
| 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 index. The formula is exp(sum_(sample) p(sample) log(factor(sample,index,probTrue))).
IndexAverageLogarithm(Boolean, Double[], Discrete)
VMP message to index.
Declaration
public static Discrete IndexAverageLogarithm(bool sample, double[] ProbTrue, Discrete result)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | sample | Constant value for |
| Double[] | ProbTrue | 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 index conditioned on the given values.
IndexConditional(Boolean, Double[], Discrete)
Gibbs message to index.
Declaration
public static Discrete IndexConditional(bool sample, double[] ProbTrue, Discrete result)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | sample | Constant value for |
| Double[] | ProbTrue | 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 index conditioned on the given values.
LogAverageFactor(Boolean, Discrete, Double[])
Evidence message for EP.
Declaration
public static double LogAverageFactor(bool sample, Discrete index, double[] probTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | sample | Constant value for |
| Discrete | index | Incoming message from |
| Double[] | probTrue | 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(sum_(index) p(index) factor(sample,index,probTrue)).
LogEvidenceRatio(Boolean, Discrete, Double[])
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(bool sample, Discrete index, double[] probTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | sample | Constant value for |
| Discrete | index | Incoming message from |
| Double[] | probTrue | 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_(index) p(index) factor(sample,index,probTrue)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.
SampleAverageConditional(Discrete, Double[])
EP message to sample.
Declaration
public static Bernoulli SampleAverageConditional(Discrete index, double[] ProbTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| Discrete | index | Incoming message from |
| Double[] | ProbTrue | Constant value for |
Returns
| Type | Description |
|---|---|
| Bernoulli | The outgoing EP message to the |
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_(index) p(index) factor(sample,index,probTrue)]/p(sample).
SampleAverageConditional(Int32, Double[])
EP message to sample.
Declaration
public static Bernoulli SampleAverageConditional(int index, double[] ProbTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | Constant value for |
| Double[] | ProbTrue | Constant value for |
Returns
| Type | Description |
|---|---|
| Bernoulli | The outgoing EP message to the |
Remarks
The outgoing message is the factor viewed as a function of sample conditioned on the given values.
SampleAverageLogarithm(Discrete, Double[])
VMP message to sample.
Declaration
public static Bernoulli SampleAverageLogarithm(Discrete index, double[] ProbTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| Discrete | index | Incoming message from |
| Double[] | ProbTrue | Constant value for |
Returns
| Type | Description |
|---|---|
| Bernoulli | The outgoing VMP message to the |
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_(index) p(index) log(factor(sample,index,probTrue))).
SampleAverageLogarithm(Int32, Double[])
VMP message to sample.
Declaration
public static Bernoulli SampleAverageLogarithm(int index, double[] ProbTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | Constant value for |
| Double[] | ProbTrue | Constant value for |
Returns
| Type | Description |
|---|---|
| Bernoulli | The outgoing VMP message to the |
Remarks
The outgoing message is the factor viewed as a function of sample conditioned on the given values.
SampleConditional(Int32, Double[])
Gibbs message to sample.
Declaration
public static Bernoulli SampleConditional(int index, double[] ProbTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | Constant value for |
| Double[] | ProbTrue | Constant value for |
Returns
| Type | Description |
|---|---|
| Bernoulli | The outgoing Gibbs message to the |
Remarks
The outgoing message is the factor viewed as a function of sample conditioned on the given values.