Class BinomialOp
Provides outgoing messages for Binomial(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", "trialCount", "p"}, typeof(Rand), "Binomial", new Type[]{typeof(int), typeof(double)})]
[Quality(QualityBand.Preview)]
public static class BinomialOp
Remarks
The factor is f(sample,n,p) = choose(n,sample) p^sample (1-p)^(n-sample)
Methods
AverageLogFactor(Int32, Beta, Discrete)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, Beta p, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | Incoming message from |
Discrete | trialCount | 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_(p,n) p(p,n) log(factor(binomial,n,p))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Int32, Beta, Int32)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, Beta p, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | Incoming message from |
Int32 | trialCount | 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_(p) p(p) log(factor(binomial,n,p))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Int32, Double, Discrete)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, double p, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | Constant value for |
Discrete | trialCount | 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_(n) p(n) log(factor(binomial,n,p))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Int32, Double, Int32)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(int sample, double p, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | Constant value for |
Int32 | trialCount | 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(binomial,n,p))
. 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_(binomial) p(binomial) factor(binomial,n,p))
.
LogAverageFactor(Int32, Beta, Discrete)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, Beta p, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | Incoming message from |
Discrete | trialCount | 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_(p,n) p(p,n) factor(binomial,n,p))
.
LogAverageFactor(Int32, Beta, Int32)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, Beta p, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | Incoming message from |
Int32 | trialCount | 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_(p) p(p) factor(binomial,n,p))
.
LogAverageFactor(Int32, Double, Discrete)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, double p, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | Constant value for |
Discrete | trialCount | 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_(n) p(n) factor(binomial,n,p))
.
LogAverageFactor(Int32, Double, Int32)
Evidence message for EP.
Declaration
public static double LogAverageFactor(int sample, double p, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | Constant value for |
Int32 | trialCount | 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(binomial,n,p))
.
LogEvidenceRatio(Discrete)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Discrete sample)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | 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_(binomial) p(binomial) factor(binomial,n,p) / sum_binomial p(binomial) messageTo(binomial))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Beta, Discrete)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, Beta p, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | Incoming message from |
Discrete | trialCount | 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_(p,n) p(p,n) factor(binomial,n,p))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Beta, Int32)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, Beta p, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | Incoming message from |
Int32 | trialCount | 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_(p) p(p) factor(binomial,n,p))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Double, Discrete)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, double p, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | Constant value for |
Discrete | trialCount | 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_(n) p(n) factor(binomial,n,p))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Int32, Double, Int32)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(int sample, double p, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | Constant value for |
Int32 | trialCount | 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(binomial,n,p))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
PAverageConditional(Discrete, Int32)
EP message to p
.
Declaration
public static Beta PAverageConditional(Discrete sample, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Int32 | trialCount | Constant value for |
Returns
Type | Description |
---|---|
Beta | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of p
as the random arguments are varied. The formula is proj[p(p) sum_(binomial) p(binomial) factor(binomial,n,p)]/p(p)
.
PAverageConditional(Int32, Discrete, Beta)
EP message to p
.
Declaration
public static Beta PAverageConditional(int sample, Discrete trialCount, Beta p)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Discrete | trialCount | Incoming message from |
Beta | p | Incoming message from |
Returns
Type | Description |
---|---|
Beta | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of p
as the random arguments are varied. The formula is proj[p(p) sum_(n) p(n) factor(binomial,n,p)]/p(p)
.
PAverageConditional(Int32, Int32)
EP message to p
.
Declaration
public static Beta PAverageConditional(int sample, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Int32 | trialCount | Constant value for |
Returns
Type | Description |
---|---|
Beta | The outgoing EP message to the |
Remarks
The outgoing message is the factor viewed as a function of p
conditioned on the given values.
PAverageLogarithm(Discrete, Discrete)
VMP message to p
.
Declaration
public static Beta PAverageLogarithm(Discrete sample, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Discrete | trialCount | Incoming message from |
Returns
Type | Description |
---|---|
Beta | 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 p
. The formula is exp(sum_(binomial,n) p(binomial,n) log(factor(binomial,n,p)))
.
PAverageLogarithm(Discrete, Int32)
VMP message to p
.
Declaration
public static Beta PAverageLogarithm(Discrete sample, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Int32 | trialCount | Constant value for |
Returns
Type | Description |
---|---|
Beta | 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 p
. The formula is exp(sum_(binomial) p(binomial) log(factor(binomial,n,p)))
.
PAverageLogarithm(Int32, Discrete)
VMP message to p
.
Declaration
public static Beta PAverageLogarithm(int sample, Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Discrete | trialCount | Incoming message from |
Returns
Type | Description |
---|---|
Beta | 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 p
. The formula is exp(sum_(n) p(n) log(factor(binomial,n,p)))
.
PAverageLogarithm(Int32, Int32)
VMP message to p
.
Declaration
public static Beta PAverageLogarithm(int sample, int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Int32 | trialCount | Constant value for |
Returns
Type | Description |
---|---|
Beta | The outgoing VMP message to the |
Remarks
The outgoing message is the factor viewed as a function of p
conditioned on the given values.
SampleAverageConditional(Beta, Discrete, Discrete)
EP message to binomial
.
Declaration
public static Discrete SampleAverageConditional(Beta p, Discrete trialCount, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Beta | p | Incoming message from |
Discrete | trialCount | 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 binomial
as the random arguments are varied. The formula is proj[p(binomial) sum_(p,n) p(p,n) factor(binomial,n,p)]/p(binomial)
.
SampleAverageConditional(Beta, Int32, Discrete)
EP message to binomial
.
Declaration
public static Discrete SampleAverageConditional(Beta p, int trialCount, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Beta | p | Incoming message from |
Int32 | trialCount | 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 binomial
as the random arguments are varied. The formula is proj[p(binomial) sum_(p) p(p) factor(binomial,n,p)]/p(binomial)
.
SampleAverageConditional(Double, Discrete, Discrete)
EP message to binomial
.
Declaration
public static Discrete SampleAverageConditional(double p, Discrete trialCount, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Double | p | Constant value for |
Discrete | trialCount | 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 binomial
as the random arguments are varied. The formula is proj[p(binomial) sum_(n) p(n) factor(binomial,n,p)]/p(binomial)
.
SampleAverageConditional(Double, Poisson)
EP message to binomial
.
Declaration
public static Poisson SampleAverageConditional(double p, Poisson trialCount)
Parameters
Type | Name | Description |
---|---|---|
Double | p | Constant value for |
Poisson | trialCount | Incoming message from |
Returns
Type | Description |
---|---|
Poisson | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of binomial
as the random arguments are varied. The formula is proj[p(binomial) sum_(n) p(n) factor(binomial,n,p)]/p(binomial)
.
SampleAverageConditional(Double, Int32, Discrete)
EP message to binomial
.
Declaration
public static Discrete SampleAverageConditional(double p, int trialCount, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Double | p | Constant value for |
Int32 | trialCount | 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 binomial
conditioned on the given values.
SampleAverageConditionalInit(Discrete)
Declaration
public static Discrete SampleAverageConditionalInit(Discrete trialCount)
Parameters
Type | Name | Description |
---|---|---|
Discrete | trialCount | Incoming message from |
Returns
Type | Description |
---|---|
Discrete |
Remarks
SampleAverageConditionalInit(Int32)
Declaration
public static Discrete SampleAverageConditionalInit(int trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | trialCount | Constant value for |
Returns
Type | Description |
---|---|
Discrete |
Remarks
TrialCountAverageConditional(Discrete, Beta, Discrete)
EP message to n
.
Declaration
public static Discrete TrialCountAverageConditional(Discrete sample, Beta p, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Beta | p | 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 n
as the random arguments are varied. The formula is proj[p(n) sum_(binomial,p) p(binomial,p) factor(binomial,n,p)]/p(n)
.
TrialCountAverageConditional(Discrete, Double, Discrete)
EP message to n
.
Declaration
public static Discrete TrialCountAverageConditional(Discrete sample, double p, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Discrete | sample | Incoming message from |
Double | p | 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 n
as the random arguments are varied. The formula is proj[p(n) sum_(binomial) p(binomial) factor(binomial,n,p)]/p(n)
.
TrialCountAverageConditional(Poisson, Double)
EP message to n
.
Declaration
public static Poisson TrialCountAverageConditional(Poisson sample, double p)
Parameters
Type | Name | Description |
---|---|---|
Poisson | sample | Incoming message from |
Double | p | Constant value for |
Returns
Type | Description |
---|---|
Poisson | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of n
as the random arguments are varied. The formula is proj[p(n) sum_(binomial) p(binomial) factor(binomial,n,p)]/p(n)
.
TrialCountAverageConditional(Int32, Beta, Discrete)
EP message to n
.
Declaration
public static Discrete TrialCountAverageConditional(int sample, Beta p, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | 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 n
as the random arguments are varied. The formula is proj[p(n) sum_(p) p(p) factor(binomial,n,p)]/p(n)
.
TrialCountAverageConditional(Int32, Double, Discrete)
EP message to n
.
Declaration
public static Discrete TrialCountAverageConditional(int sample, double p, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | 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 n
conditioned on the given values.
TrialCountAverageConditional(Int32, Double, Poisson)
EP message to n
.
Declaration
public static Poisson TrialCountAverageConditional(int sample, double p, Poisson trialCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | Constant value for |
Poisson | trialCount | Incoming message from |
Returns
Type | Description |
---|---|
Poisson | The outgoing EP message to the |
Remarks
The outgoing message is the factor viewed as a function of n
conditioned on the given values.
TrialCountAverageLogarithm(Int32, Beta, Discrete)
VMP message to n
.
Declaration
public static Discrete TrialCountAverageLogarithm(int sample, Beta p, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Beta | p | 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 n
. The formula is exp(sum_(p) p(p) log(factor(binomial,n,p)))
.
TrialCountAverageLogarithm(Int32, Double, Discrete)
VMP message to n
.
Declaration
public static Discrete TrialCountAverageLogarithm(int sample, double p, Discrete result)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sample | Constant value for |
Double | p | 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 n
conditioned on the given values.