Class FastSumOp
Provides outgoing messages for Sum(IList<Double>), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "Sum", new Type[]{typeof(double[])}, Default = true)]
[Quality(QualityBand.Mature)]
public static class FastSumOp
Methods
ArrayAverageConditional(Gaussian, Gaussian, Gaussian[], Gaussian[])
EP message to array
.
Declaration
public static Gaussian[] ArrayAverageConditional(Gaussian sum, Gaussian to_sum, Gaussian[] array, Gaussian[] result)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | Incoming message from |
Gaussian | to_sum | Outgoing message to |
Gaussian[] | array | Incoming message from |
Gaussian[] | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Gaussian[] |
|
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_(sum) p(sum) factor(sum,array)]/p(array)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageConditional<GaussianList>(Gaussian, Gaussian, IList<Gaussian>, GaussianList)
EP message to array
.
Declaration
public static GaussianList ArrayAverageConditional<GaussianList>(Gaussian sum, Gaussian to_sum, IList<Gaussian> array, GaussianList result)
where GaussianList : IList<Gaussian>, SettableToUniform
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | Incoming message from |
Gaussian | to_sum | Outgoing message to |
IList<Gaussian> | array | Incoming message from |
GaussianList | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
GaussianList |
|
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the outgoing message. |
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_(sum) p(sum) factor(sum,array)]/p(array)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageConditional<GaussianList>(Double, IList<Gaussian>, GaussianList)
EP message to array
.
Declaration
public static GaussianList ArrayAverageConditional<GaussianList>(double sum, IList<Gaussian> array, GaussianList result)
where GaussianList : IList<Gaussian>, SettableToUniform
Parameters
Type | Name | Description |
---|---|---|
Double | sum | Constant value for |
IList<Gaussian> | array | Incoming message from |
GaussianList | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
GaussianList |
|
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the outgoing message. |
Remarks
The outgoing message is the factor viewed as a function of array
conditioned on the given values.
ArrayAverageLogarithm<GaussianList>(Gaussian, IList<Gaussian>, GaussianList)
VMP message to array
.
Declaration
public static GaussianList ArrayAverageLogarithm<GaussianList>(Gaussian sum, IList<Gaussian> array, GaussianList to_array)
where GaussianList : IList<Gaussian>, ICloneable
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | Incoming message from |
IList<Gaussian> | array | Incoming message from |
GaussianList | to_array | Previous outgoing message to |
Returns
Type | Description |
---|---|
GaussianList | The outgoing VMP message to the |
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the outgoing message. |
Remarks
The outgoing message is the factor viewed as a function of array
with sum
integrated out. The formula is sum_sum p(sum) factor(sum,array)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
ArrayAverageLogarithm<GaussianList>(Double, IList<Gaussian>, GaussianList)
VMP message to array
.
Declaration
public static GaussianList ArrayAverageLogarithm<GaussianList>(double sum, IList<Gaussian> array, GaussianList result)
where GaussianList : IList<Gaussian>, ICloneable
Parameters
Type | Name | Description |
---|---|---|
Double | sum | Constant value for |
IList<Gaussian> | array | Incoming message from |
GaussianList | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
GaussianList |
|
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the outgoing message. |
Remarks
The outgoing message is the factor viewed as a function of array
conditioned on the given values.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageLogarithm1<GaussianList>(Gaussian, IList<Gaussian>, GaussianList)
VMP message to 'array'
Declaration
public static GaussianList ArrayAverageLogarithm1<GaussianList>(Gaussian sum, IList<Gaussian> array, GaussianList to_array)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | Incoming message from 'sum'. Must be a proper distribution. If uniform, the result will be uniform. |
IList<Gaussian> | array | Incoming message from 'array'. |
GaussianList | to_array | Previous outgoing message to 'array'. |
Returns
Type | Description |
---|---|
GaussianList | The outgoing VMP message to the 'array' argument |
Type Parameters
Name | Description |
---|---|
GaussianList |
Remarks
The outgoing message is the factor viewed as a function of 'array' with 'sum' integrated out.
The formula is sum_sum p(sum) factor(sum,array)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageLogarithm2<GaussianList>(Gaussian, IList<Gaussian>, GaussianList)
VMP message to 'array'
Declaration
public static GaussianList ArrayAverageLogarithm2<GaussianList>(Gaussian sum, IList<Gaussian> array, GaussianList to_array)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | Incoming message from 'sum'. Must be a proper distribution. If uniform, the result will be uniform. |
IList<Gaussian> | array | Incoming message from 'array'. |
GaussianList | to_array | Previous outgoing message to 'array'. |
Returns
Type | Description |
---|---|
GaussianList | The outgoing VMP message to the 'array' argument |
Type Parameters
Name | Description |
---|---|
GaussianList |
Remarks
The outgoing message is the factor viewed as a function of 'array' with 'sum' integrated out.
The formula is sum_sum p(sum) factor(sum,array)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ArrayAverageLogarithm3<GaussianList>(Gaussian, IList<Gaussian>, GaussianList)
Declaration
public static GaussianList ArrayAverageLogarithm3<GaussianList>(Gaussian sum, IList<Gaussian> array, GaussianList to_array)
where GaussianList : IList<Gaussian>, ICloneable
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | |
IList<Gaussian> | array | |
GaussianList | to_array |
Returns
Type | Description |
---|---|
GaussianList |
Type Parameters
Name | Description |
---|---|
GaussianList |
ArrayAverageLogarithm4<GaussianList>(Gaussian, IList<Gaussian>, GaussianList)
Declaration
public static GaussianList ArrayAverageLogarithm4<GaussianList>(Gaussian sum, IList<Gaussian> array, GaussianList to_array)
where GaussianList : IList<Gaussian>, ICloneable
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | |
IList<Gaussian> | array | |
GaussianList | to_array |
Returns
Type | Description |
---|---|
GaussianList |
Type Parameters
Name | Description |
---|---|
GaussianList |
ArrayAverageLogarithm5<GaussianList>(Gaussian, IList<Gaussian>, GaussianList)
Declaration
public static GaussianList ArrayAverageLogarithm5<GaussianList>(Gaussian sum, IList<Gaussian> array, GaussianList result)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | |
IList<Gaussian> | array | |
GaussianList | result |
Returns
Type | Description |
---|---|
GaussianList |
Type Parameters
Name | Description |
---|---|
GaussianList |
ArrayAverageLogarithm6<GaussianList>(Gaussian, IList<Gaussian>, IList<Gaussian>, GaussianList)
Declaration
public static GaussianList ArrayAverageLogarithm6<GaussianList>(Gaussian sum, IList<Gaussian> array, IList<Gaussian> array_deriv, GaussianList to_array)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | |
IList<Gaussian> | array | |
IList<Gaussian> | array_deriv | |
GaussianList | to_array |
Returns
Type | Description |
---|---|
GaussianList |
Type Parameters
Name | Description |
---|---|
GaussianList |
ArrayAverageLogarithm7(Gaussian, IList<Gaussian>, Int32)
Declaration
public static Gaussian ArrayAverageLogarithm7(Gaussian sum, IList<Gaussian> array, int resultIndex)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | |
IList<Gaussian> | array | |
Int32 | resultIndex |
Returns
Type | Description |
---|---|
Gaussian |
AverageLogFactor()
Evidence message for VMP.
Declaration
public static double AverageLogFactor()
Returns
Type | Description |
---|---|
Double | Zero. |
Remarks
The formula for the result is log(factor(sum,array))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Double, IList<Double>)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(double sum, IList<double> array)
Parameters
Type | Name | Description |
---|---|---|
Double | sum | Constant value for |
IList<Double> | array | Constant value for |
Returns
Type | Description |
---|---|
Double | Zero. |
Remarks
The formula for the result is log(factor(sum,array))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
LogAverageFactor(Gaussian, Gaussian)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Gaussian sum, Gaussian to_sum)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | Incoming message from |
Gaussian | to_sum | 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_(sum) p(sum) factor(sum,array))
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|
LogAverageFactor(Double, IList<Gaussian>)
Evidence message for EP.
Declaration
public static double LogAverageFactor(double sum, IList<Gaussian> array)
Parameters
Type | Name | Description |
---|---|---|
Double | sum | Constant value for |
IList<Gaussian> | array | 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_(array) p(array) factor(sum,array))
.
LogAverageFactor(Double, IList<Double>)
Evidence message for EP.
Declaration
public static double LogAverageFactor(double sum, IList<double> array)
Parameters
Type | Name | Description |
---|---|---|
Double | sum | Constant value for |
IList<Double> | array | 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(sum,array))
.
LogEvidenceRatio(Gaussian)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Gaussian sum)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | 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_(sum) p(sum) factor(sum,array) / sum_sum p(sum) messageTo(sum))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Double, IList<Gaussian>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(double sum, IList<Gaussian> array)
Parameters
Type | Name | Description |
---|---|---|
Double | sum | Constant value for |
IList<Gaussian> | array | 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_(array) p(array) factor(sum,array))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Double, IList<Double>)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(double sum, IList<double> array)
Parameters
Type | Name | Description |
---|---|---|
Double | sum | Constant value for |
IList<Double> | 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(sum,array))
. Adding up these values across all factors and variables gives the log-evidence estimate for EP.
SumAverageConditional(IList<Gaussian>)
EP message to sum
.
Declaration
public static Gaussian SumAverageConditional(IList<Gaussian> array)
Parameters
Type | Name | Description |
---|---|---|
IList<Gaussian> | array | Incoming message from |
Returns
Type | Description |
---|---|
Gaussian | The outgoing EP message to the |
Remarks
The outgoing message is a distribution matching the moments of sum
as the random arguments are varied. The formula is proj[p(sum) sum_(array) p(array) factor(sum,array)]/p(sum)
.
SumAverageLogarithm(IList<Gaussian>)
VMP message to sum
.
Declaration
public static Gaussian SumAverageLogarithm(IList<Gaussian> array)
Parameters
Type | Name | Description |
---|---|---|
IList<Gaussian> | array | Incoming message from |
Returns
Type | Description |
---|---|
Gaussian | The outgoing VMP message to the |
Remarks
The outgoing message is a distribution matching the moments of sum
as the random arguments are varied. The formula is proj[sum_(array) p(array) factor(sum,array)]
.
SumDeriv(Gaussian, IList<Gaussian>, IList<Gaussian>)
Declaration
public static Gaussian SumDeriv(Gaussian sum, IList<Gaussian> array, IList<Gaussian> to_array)
Parameters
Type | Name | Description |
---|---|---|
Gaussian | sum | |
IList<Gaussian> | array | |
IList<Gaussian> | to_array |
Returns
Type | Description |
---|---|
Gaussian |
SumExcept(IList<Gaussian>, Int32)
Declaration
public static (double, double) SumExcept(IList<Gaussian> array, int excludedIndex)
Parameters
Type | Name | Description |
---|---|---|
IList<Gaussian> | array | |
Int32 | excludedIndex |
Returns
Type | Description |
---|---|
(T1, T2)<Double, Double> |