Class VectorSoftmaxOp_KM11
Provides outgoing messages for Softmax(IList<Double>), given random arguments to the function.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(MMath), "Softmax", new Type[]{typeof(Vector)})]
[Quality(QualityBand.Preview)]
[Buffers(new string[]{"A"})]
public static class VectorSoftmaxOp_KM11
Remarks
This implementation uses the bound in Knowles and Minka (2011), followed by nonconjugate VMP. This approach is linear in the dimension K.
Methods
A(VectorGaussian, Vector)
Update the buffer A
.
Declaration
public static Vector A(VectorGaussian x, Vector a)
Parameters
Type | Name | Description |
---|---|---|
VectorGaussian | x | Incoming message from |
Vector | a | Buffer |
Returns
Type | Description |
---|---|
Vector | New value of buffer |
Remarks
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
AInit(VectorGaussian)
Initialize the buffer A
.
Declaration
public static Vector AInit(VectorGaussian x)
Parameters
Type | Name | Description |
---|---|---|
VectorGaussian | x | Incoming message from |
Returns
Type | Description |
---|---|
Vector | Initial value of buffer |
Remarks
AverageLogFactor()
Evidence message for VMP.
Declaration
public static double AverageLogFactor()
Returns
Type | Description |
---|---|
Double | Zero. |
Remarks
The formula for the result is log(factor(softmax,x))
. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
SoftmaxAverageLogarithm(VectorGaussian, Vector, Dirichlet)
VMP message to softmax
.
Declaration
public static Dirichlet SoftmaxAverageLogarithm(VectorGaussian x, Vector a, Dirichlet result)
Parameters
Type | Name | Description |
---|---|---|
VectorGaussian | x | Incoming message from |
Vector | a | Buffer |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Remarks
The outgoing message is a distribution matching the moments of softmax
as the random arguments are varied. The formula is proj[sum_(x) p(x) factor(softmax,x)]
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
SoftmaxAverageLogarithmInit(VectorGaussian)
Declaration
public static Dirichlet SoftmaxAverageLogarithmInit(VectorGaussian x)
Parameters
Type | Name | Description |
---|---|---|
VectorGaussian | x | Incoming message from |
Returns
Type | Description |
---|---|
Dirichlet |
Remarks
VectorGaussianToGaussianList(VectorGaussian)
Declaration
public static Gaussian[] VectorGaussianToGaussianList(VectorGaussian x)
Parameters
Type | Name | Description |
---|---|---|
VectorGaussian | x |
Returns
Type | Description |
---|---|
Gaussian[] |
XAverageLogarithm(Dirichlet, VectorGaussian, Vector, VectorGaussian)
VMP message to x
.
Declaration
public static VectorGaussian XAverageLogarithm(Dirichlet softmax, VectorGaussian x, Vector a, VectorGaussian result)
Parameters
Type | Name | Description |
---|---|---|
Dirichlet | softmax | Incoming message from |
VectorGaussian | x | Incoming message from |
Vector | a | 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 x
with softmax
integrated out. The formula is sum_softmax p(softmax) factor(softmax,x)
.
Exceptions
Type | Condition |
---|---|
ImproperMessageException |
|
ImproperMessageException |
|