Class CountTrueOp
Provides outgoing messages for CountTrue(Boolean[]), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "CountTrue", new Type[]{})]
[Quality(QualityBand.Preview)]
[Buffers(new string[]{"PoissonBinomialTable"})]
public static class CountTrueOp
Methods
ArrayAverageConditional<TBernoulliArray>(TBernoulliArray, Discrete, Double[,], TBernoulliArray)
EP message to array
.
Declaration
public static TBernoulliArray ArrayAverageConditional<TBernoulliArray>(TBernoulliArray array, Discrete count, double[, ] poissonBinomialTable, TBernoulliArray result)
where TBernoulliArray : IList<Bernoulli>
Parameters
Type | Name | Description |
---|---|---|
TBernoulliArray | array | Incoming message from |
Discrete | count | Incoming message from |
Double[,] | poissonBinomialTable | Buffer |
TBernoulliArray | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TBernoulliArray |
|
Type Parameters
Name | Description |
---|---|
TBernoulliArray | The type of messages from/to 'array'. |
Remarks
The outgoing message is a distribution matching the moments of array
as the random arguments are varied. The formula is proj[p(array) sum_(count) p(count) factor(count,array)]/p(array)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageConditional<TBernoulliArray>(TBernoulliArray, Int32, Double[,], TBernoulliArray)
EP message to array
.
Declaration
public static TBernoulliArray ArrayAverageConditional<TBernoulliArray>(TBernoulliArray array, int count, double[, ] poissonBinomialTable, TBernoulliArray result)
where TBernoulliArray : IList<Bernoulli>
Parameters
Type | Name | Description |
---|---|---|
TBernoulliArray | array | Incoming message from |
Int32 | count | Constant value for |
Double[,] | poissonBinomialTable | Buffer |
TBernoulliArray | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
TBernoulliArray |
|
Type Parameters
Name | Description |
---|---|
TBernoulliArray | The type of messages from/to 'array'. |
Remarks
The outgoing message is the factor viewed as a function of array
conditioned on the given values.
CountAverageConditional(Double[,])
EP message to count
.
Declaration
public static Discrete CountAverageConditional(double[, ] poissonBinomialTable)
Parameters
Type | Name | Description |
---|---|---|
Double[,] | poissonBinomialTable | Buffer |
Returns
Type | Description |
---|---|
Discrete | The outgoing EP message to the |
Remarks
The outgoing message is the factor viewed as a function of count
conditioned on the given values.
LogEvidenceRatio(Discrete)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Discrete count)
Parameters
Type | Name | Description |
---|---|---|
Discrete | count | 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_(count) p(count) factor(count,array) / sum_count p(count) messageTo(count))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
LogEvidenceRatio(Int32, Boolean[])
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int count, bool[] array)
Parameters
Type | Name | Description |
---|---|---|
Int32 | count | Constant value for |
Boolean[] | array | 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(count,array))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Double[,])
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int count, double[, ] poissonBinomialTable)
Parameters
Type | Name | Description |
---|---|---|
Int32 | count | Constant value for |
Double[,] | poissonBinomialTable | Buffer |
Returns
Type | Description |
---|---|
Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(factor(count,array))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
PoissonBinomialTable(IList<Bernoulli>)
Update the buffer PoissonBinomialTable
.
Declaration
public static double[, ] PoissonBinomialTable(IList<Bernoulli> array)
Parameters
Type | Name | Description |
---|---|---|
IList<Bernoulli> | array | Incoming message from |
Returns
Type | Description |
---|---|
Double[,] | New value of buffer |
Remarks
PoissonBinomialTableInit(IList<Bernoulli>)
Initialize the buffer PoissonBinomialTable
.
Declaration
public static double[, ] PoissonBinomialTableInit(IList<Bernoulli> array)
Parameters
Type | Name | Description |
---|---|---|
IList<Bernoulli> | array | Incoming message from |
Returns
Type | Description |
---|---|
Double[,] | Initial value of buffer |
Remarks