Class SoftmaxOp_Bouchard_Sparse
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(IList<double>)})]
[Quality(QualityBand.Experimental)]
[Buffers(new string[]{"A"})]
public static class SoftmaxOp_Bouchard_Sparse
Remarks
This implementation uses the simple first order Taylor series expansion from Blei et al. 06, followed by optimization using LBFGS. This approach is linear in the dimension K.
Methods
A<GaussianList>(GaussianList, Double)
Update the buffer A
.
Declaration
public static double A<GaussianList>(GaussianList x, double a)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
GaussianList | x | Incoming message from |
Double | a | Buffer |
Returns
Type | Description |
---|---|
Double | New value of buffer |
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the incoming message from |
Remarks
AInit()
Initialize the buffer A
.
Declaration
public static double AInit()
Returns
Type | Description |
---|---|
Double | Initial value of buffer |
Remarks
AverageLogFactor<GaussianList>(GaussianList, Dirichlet, Dirichlet, Double)
Evidence message for VMP.
Declaration
public static double AverageLogFactor<GaussianList>(GaussianList x, Dirichlet softmax, Dirichlet to_softmax, double a)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
GaussianList | x | Incoming message from |
Dirichlet | softmax | Incoming message from |
Dirichlet | to_softmax | Previous outgoing message to |
Double | a | Buffer |
Returns
Type | Description |
---|---|
Double | Zero. |
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the incoming message from |
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.
logSumExp<GaussianList>(GaussianList, Double)
Declaration
public static double logSumExp<GaussianList>(GaussianList x, double a)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
GaussianList | x | |
Double | a |
Returns
Type | Description |
---|---|
Double |
Type Parameters
Name | Description |
---|---|
GaussianList |
SoftmaxAverageLogarithm<GaussianList>(GaussianList, Double, Dirichlet)
VMP message to softmax
.
Declaration
public static Dirichlet SoftmaxAverageLogarithm<GaussianList>([SkipIfAllUniform] GaussianList x, double a, Dirichlet result)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
GaussianList | x | Incoming message from |
Double | a | Buffer |
Dirichlet | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
Dirichlet |
|
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the incoming message from |
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 |
|
XAverageLogarithm<GaussianList>(Dirichlet, GaussianList, Double, GaussianList)
VMP message to x
.
Declaration
public static GaussianList XAverageLogarithm<GaussianList>(Dirichlet softmax, [SkipIfAllUniform] GaussianList x, double a, GaussianList result)
where GaussianList : IList<Gaussian>
Parameters
Type | Name | Description |
---|---|---|
Dirichlet | softmax | Incoming message from |
GaussianList | x | Incoming message from |
Double | a | Buffer |
GaussianList | result | Modified to contain the outgoing message. |
Returns
Type | Description |
---|---|
GaussianList |
|
Type Parameters
Name | Description |
---|---|
GaussianList | The type of the incoming message from |
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 |
|