Class MatrixVectorProductOp
Provides outgoing messages for the following factors:
, given random arguments to the function.Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(Factor), "Product", new Type[]{typeof(Matrix), typeof(Vector)})]
[FactorMethod(typeof(Factor), "Product", new Type[]{typeof(double[, ]), typeof(Vector)})]
[Buffers(new string[]{"BMean", "BVariance"})]
[Quality(QualityBand.Stable)]
public static class MatrixVectorProductOp
Fields
UseAccurateMethod
Declaration
public static bool UseAccurateMethod
Field Value
| Type | Description |
|---|---|
| Boolean |
Methods
AAverageConditional(VectorGaussian, DistributionArray2D<Gaussian, Double>, Vector, PositiveDefiniteMatrix, DistributionStructArray2D<Gaussian, Double>)
EP message to a.
Declaration
public static DistributionStructArray2D<Gaussian, double> AAverageConditional(VectorGaussian product, DistributionArray2D<Gaussian, double> A, Vector BMean, PositiveDefiniteMatrix BVariance, DistributionStructArray2D<Gaussian, double> result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | Incoming message from |
| DistributionArray2D<Gaussian, Double> | A | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| DistributionStructArray2D<Gaussian, Double> | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| DistributionStructArray2D<Gaussian, Double> |
|
Remarks
The outgoing message is a distribution matching the moments of a as the random arguments are varied. The formula is proj[p(a) sum_(product) p(product) factor(product,a,b)]/p(a).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
AverageLogFactor(VectorGaussian, Matrix, VectorGaussian)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(VectorGaussian product, Matrix A, VectorGaussian B)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | Incoming message from |
| Matrix | A | Constant value for |
| VectorGaussian | B | Incoming message from |
Returns
| Type | Description |
|---|---|
| Double | Zero. |
Remarks
In Variational Message Passing, the evidence contribution of a deterministic factor is zero. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Vector, Matrix, VectorGaussian, Vector, PositiveDefiniteMatrix)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Vector product, Matrix A, VectorGaussian B, Vector BMean, PositiveDefiniteMatrix BVariance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| VectorGaussian | B | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
Returns
| Type | Description |
|---|---|
| Double | Zero. |
Remarks
In Variational Message Passing, the evidence contribution of a deterministic factor is zero. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
AverageLogFactor(Vector, Matrix, Vector)
Evidence message for VMP.
Declaration
public static double AverageLogFactor(Vector product, Matrix A, Vector B)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| Vector | B | Constant value for |
Returns
| Type | Description |
|---|---|
| Double | Zero. |
Remarks
The formula for the result is log(factor(product,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
BAverageConditional(VectorGaussian, DistributionArray2D<Gaussian, Double>, VectorGaussian)
Declaration
public static VectorGaussian BAverageConditional(VectorGaussian product, DistributionArray2D<Gaussian, double> A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | |
| DistributionArray2D<Gaussian, Double> | A | |
| VectorGaussian | result |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
BAverageConditional(VectorGaussian, Matrix, VectorGaussian)
EP message to b.
Declaration
public static VectorGaussian BAverageConditional(VectorGaussian product, Matrix A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | Incoming message from |
| Matrix | A | Constant value for |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is a distribution matching the moments of b as the random arguments are varied. The formula is proj[p(b) sum_(product) p(product) factor(product,a,b)]/p(b).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BAverageConditional(VectorGaussian, Double[,], VectorGaussian)
EP message to b.
Declaration
public static VectorGaussian BAverageConditional(VectorGaussian product, double[, ] A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | Incoming message from |
| Double[,] | A | Incoming message from |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is a distribution matching the moments of b as the random arguments are varied. The formula is proj[p(b) sum_(product,a) p(product,a) factor(product,a,b)]/p(b).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BAverageConditional(VectorGaussianMoments, DistributionArray2D<Gaussian, Double>, VectorGaussian)
Declaration
public static VectorGaussian BAverageConditional(VectorGaussianMoments product, DistributionArray2D<Gaussian, double> A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussianMoments | product | |
| DistributionArray2D<Gaussian, Double> | A | |
| VectorGaussian | result |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
BAverageConditional(VectorGaussianMoments, Matrix, VectorGaussian)
EP message to b.
Declaration
public static VectorGaussian BAverageConditional(VectorGaussianMoments product, Matrix A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussianMoments | product | Incoming message from |
| Matrix | A | Constant value for |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is a distribution matching the moments of b as the random arguments are varied. The formula is proj[p(b) sum_(product) p(product) factor(product,a,b)]/p(b).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BAverageConditional(VectorGaussianMoments, Double[,], VectorGaussian)
EP message to b.
Declaration
public static VectorGaussian BAverageConditional(VectorGaussianMoments product, double[, ] A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussianMoments | product | Incoming message from |
| Double[,] | A | Incoming message from |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is a distribution matching the moments of b as the random arguments are varied. The formula is proj[p(b) sum_(product,a) p(product,a) factor(product,a,b)]/p(b).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BAverageConditional(Vector, Matrix, VectorGaussian)
EP message to b.
Declaration
[NotSupported("A matrix-vector product with fixed output is not yet implemented.")]
public static VectorGaussian BAverageConditional(Vector product, Matrix A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is the factor viewed as a function of b conditioned on the given values.
BAverageLogarithm(VectorGaussian, Matrix, VectorGaussian)
VMP message to b.
Declaration
public static VectorGaussian BAverageLogarithm(VectorGaussian product, Matrix A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | Incoming message from |
| Matrix | A | Constant value for |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is the factor viewed as a function of b with product integrated out. The formula is sum_product p(product) factor(product,a,b).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BAverageLogarithm(VectorGaussianMoments, Matrix, VectorGaussian)
VMP message to b.
Declaration
public static VectorGaussian BAverageLogarithm(VectorGaussianMoments product, Matrix A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussianMoments | product | Incoming message from |
| Matrix | A | Constant value for |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is the factor viewed as a function of b with product integrated out. The formula is sum_product p(product) factor(product,a,b).
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BAverageLogarithm(Vector, Matrix, VectorGaussian)
VMP message to b.
Declaration
[NotSupported("A matrix-vector product with fixed output is not yet implemented.")]
public static VectorGaussian BAverageLogarithm(Vector product, Matrix A, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is the factor viewed as a function of b conditioned on the given values.
BMean(VectorGaussian, PositiveDefiniteMatrix, Vector)
Update the buffer BMean.
Declaration
public static Vector BMean(VectorGaussian B, PositiveDefiniteMatrix BVariance, Vector result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | B | Incoming message from |
| PositiveDefiniteMatrix | BVariance | Buffer |
| Vector | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| Vector |
|
Remarks
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BMeanInit(VectorGaussian)
Initialize the buffer BMean.
Declaration
public static Vector BMeanInit(VectorGaussian B)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | B | Incoming message from |
Returns
| Type | Description |
|---|---|
| Vector | Initial value of buffer |
Remarks
BVariance(VectorGaussian, PositiveDefiniteMatrix)
Update the buffer BVariance.
Declaration
public static PositiveDefiniteMatrix BVariance(VectorGaussian B, PositiveDefiniteMatrix result)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | B | Incoming message from |
| PositiveDefiniteMatrix | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| PositiveDefiniteMatrix |
|
Remarks
Exceptions
| Type | Condition |
|---|---|
| ImproperMessageException |
|
BVarianceInit(VectorGaussian)
Initialize the buffer BVariance.
Declaration
public static PositiveDefiniteMatrix BVarianceInit(VectorGaussian B)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | B | Incoming message from |
Returns
| Type | Description |
|---|---|
| PositiveDefiniteMatrix | Initial value of buffer |
Remarks
LogAverageFactor(VectorGaussian, VectorGaussian)
Evidence message for EP.
Declaration
public static double LogAverageFactor(VectorGaussian product, VectorGaussian to_product)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | Incoming message from |
| VectorGaussian | to_product | 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_(product) p(product) factor(product,a,b)).
LogAverageFactor(Vector, Matrix, VectorGaussian, Vector, PositiveDefiniteMatrix)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Vector product, Matrix A, VectorGaussian B, Vector BMean, PositiveDefiniteMatrix BVariance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| VectorGaussian | B | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
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_(b) p(b) factor(product,a,b)).
LogAverageFactor(Vector, Matrix, Vector)
Evidence message for EP.
Declaration
public static double LogAverageFactor(Vector product, Matrix A, Vector B)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| Vector | B | 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(product,a,b)).
LogEvidenceRatio(VectorGaussian, Matrix, VectorGaussian)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(VectorGaussian product, Matrix A, VectorGaussian B)
Parameters
| Type | Name | Description |
|---|---|---|
| VectorGaussian | product | Incoming message from |
| Matrix | A | Constant value for |
| VectorGaussian | B | 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_(product,b) p(product,b) factor(product,a,b) / sum_product p(product) messageTo(product)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Vector, Matrix, VectorGaussian, Vector, PositiveDefiniteMatrix)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Vector product, Matrix A, VectorGaussian B, Vector BMean, PositiveDefiniteMatrix BVariance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| VectorGaussian | B | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
Returns
| Type | Description |
|---|---|
| Double | Logarithm of the factor's contribution the EP model evidence. |
Remarks
The formula for the result is log(sum_(b) p(b) factor(product,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.
LogEvidenceRatio(Vector, Matrix, Vector)
Evidence message for EP.
Declaration
public static double LogEvidenceRatio(Vector product, Matrix A, Vector B)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | product | Constant value for |
| Matrix | A | Constant value for |
| Vector | B | 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(product,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.
ProductAverageConditional(DistributionArray2D<Gaussian, Double>, Vector, PositiveDefiniteMatrix, VectorGaussian)
EP message to product.
Declaration
public static VectorGaussian ProductAverageConditional(DistributionArray2D<Gaussian, double> A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| DistributionArray2D<Gaussian, Double> | A | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is a distribution matching the moments of product as the random arguments are varied. The formula is proj[p(product) sum_(a) p(a) factor(product,a,b)]/p(product).
ProductAverageConditional(DistributionArray2D<Gaussian, Double>, Vector, PositiveDefiniteMatrix, VectorGaussianMoments)
EP message to product.
Declaration
public static VectorGaussianMoments ProductAverageConditional(DistributionArray2D<Gaussian, double> A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussianMoments result)
Parameters
| Type | Name | Description |
|---|---|---|
| DistributionArray2D<Gaussian, Double> | A | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussianMoments | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussianMoments |
|
Remarks
The outgoing message is a distribution matching the moments of product as the random arguments are varied. The formula is proj[p(product) sum_(a) p(a) factor(product,a,b)]/p(product).
ProductAverageConditional(Matrix, Vector, PositiveDefiniteMatrix, VectorGaussian)
EP message to product.
Declaration
public static VectorGaussian ProductAverageConditional(Matrix A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | A | Constant value for |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is the factor viewed as a function of product conditioned on the given values.
ProductAverageConditional(Matrix, Vector, PositiveDefiniteMatrix, VectorGaussianMoments)
EP message to product.
Declaration
public static VectorGaussianMoments ProductAverageConditional(Matrix A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussianMoments result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | A | Constant value for |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussianMoments | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussianMoments |
|
Remarks
The outgoing message is the factor viewed as a function of product conditioned on the given values.
ProductAverageConditional(Double[,], Vector, PositiveDefiniteMatrix, VectorGaussian)
EP message to product.
Declaration
public static VectorGaussian ProductAverageConditional(double[, ] A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double[,] | A | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is a distribution matching the moments of product as the random arguments are varied. The formula is proj[p(product) sum_(a) p(a) factor(product,a,b)]/p(product).
ProductAverageConditional(Double[,], Vector, PositiveDefiniteMatrix, VectorGaussianMoments)
EP message to product.
Declaration
public static VectorGaussianMoments ProductAverageConditional(double[, ] A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussianMoments result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double[,] | A | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussianMoments | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussianMoments |
|
Remarks
The outgoing message is a distribution matching the moments of product as the random arguments are varied. The formula is proj[p(product) sum_(a) p(a) factor(product,a,b)]/p(product).
ProductAverageConditionalInit(Matrix)
Declaration
public static VectorGaussian ProductAverageConditionalInit(Matrix A)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | A | Constant value for |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
Remarks
ProductAverageLogarithm(Matrix, Vector, PositiveDefiniteMatrix, VectorGaussian)
VMP message to product.
Declaration
public static VectorGaussian ProductAverageLogarithm(Matrix A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | A | Constant value for |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is the factor viewed as a function of product conditioned on the given values.
ProductAverageLogarithm(Matrix, Vector, PositiveDefiniteMatrix, VectorGaussianMoments)
VMP message to product.
Declaration
public static VectorGaussianMoments ProductAverageLogarithm(Matrix A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussianMoments result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | A | Constant value for |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussianMoments | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussianMoments |
|
Remarks
The outgoing message is the factor viewed as a function of product conditioned on the given values.
ProductAverageLogarithm(Double[,], Vector, PositiveDefiniteMatrix, VectorGaussian)
VMP message to product.
Declaration
public static VectorGaussian ProductAverageLogarithm(double[, ] A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussian result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double[,] | A | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussian | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
|
Remarks
The outgoing message is a distribution matching the moments of product as the random arguments are varied. The formula is proj[sum_(a) p(a) factor(product,a,b)].
ProductAverageLogarithm(Double[,], Vector, PositiveDefiniteMatrix, VectorGaussianMoments)
VMP message to product.
Declaration
public static VectorGaussianMoments ProductAverageLogarithm(double[, ] A, Vector BMean, PositiveDefiniteMatrix BVariance, VectorGaussianMoments result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double[,] | A | Incoming message from |
| Vector | BMean | Buffer |
| PositiveDefiniteMatrix | BVariance | Buffer |
| VectorGaussianMoments | result | Modified to contain the outgoing message. |
Returns
| Type | Description |
|---|---|
| VectorGaussianMoments |
|
Remarks
The outgoing message is a distribution matching the moments of product as the random arguments are varied. The formula is proj[sum_(a) p(a) factor(product,a,b)].
ProductAverageLogarithmInit(Matrix)
Declaration
public static VectorGaussian ProductAverageLogarithmInit(Matrix A)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | A | Constant value for |
Returns
| Type | Description |
|---|---|
| VectorGaussian |
Remarks