Class SoftmaxOp_KM11_LBFGS_Sparse
Provides outgoing messages for Softmax(IList<Double>), given random arguments to the function. This implementation uses the bound in Knowles and Minka (2011), followed by optimization using LBFGS. This approach is linear in the dimension K.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Factors
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[FactorMethod(typeof(MMath), "Softmax", new Type[]{typeof(IList<double>)})]
[Quality(QualityBand.Preview)]
[Buffers(new string[]{"A"})]
public static class SoftmaxOp_KM11_LBFGS_Sparse
  Methods
A(IList<Gaussian>, IList<Double>)
Update the buffer 'A'
Declaration
public static IList<double> A(IList<Gaussian> x, IList<double> a)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IList<Gaussian> | x | Incoming message from 'x'. Must be a proper distribution. If any element is uniform, the result will be uniform.  | 
      
| IList<Double> | a | Buffer 'a'.  | 
      
Returns
| Type | Description | 
|---|---|
| IList<Double> | New value of buffer 'A'  | 
      
Remarks
Exceptions
| Type | Condition | 
|---|---|
| ImproperMessageException | 
  | 
      
AInit(IList<Gaussian>)
Initialise the buffer 'A'
Declaration
public static IList<double> AInit(IList<Gaussian> x)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IList<Gaussian> | x | Incoming message from 'x'.  | 
      
Returns
| Type | Description | 
|---|---|
| IList<Double> | Initial value of buffer 'A'  | 
      
Remarks
AverageLogFactor<GaussianList>(GaussianList, IList<Double>, Dirichlet, Dirichlet)
Evidence message for VMP
Declaration
public static double AverageLogFactor<GaussianList>(GaussianList x, IList<double> a, Dirichlet softmax, Dirichlet to_softmax)
    where GaussianList : IList<Gaussian>
  Parameters
| Type | Name | Description | 
|---|---|---|
| GaussianList | x | |
| IList<Double> | a | |
| Dirichlet | softmax | |
| Dirichlet | to_softmax | 
Returns
| Type | Description | 
|---|---|
| Double | 
Type Parameters
| Name | Description | 
|---|---|
| GaussianList | 
GradientAndValueAtPoint(IList<Gaussian>, IList<Double>, Vector, Vector, Vector, Vector[])
Function to evaluate this factor's KL divergence contribution, and gradient (if grad is not null).
Declaration
public static double GradientAndValueAtPoint(IList<Gaussian> prior, IList<double> a, Vector xm, Vector lxv, Vector ns, Vector[] grad)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IList<Gaussian> | prior | |
| IList<Double> | a | Variational parameter vector a  | 
      
| Vector | xm | xm[1..K]: posterior mean  | 
      
| Vector | lxv | lxv[1..K]: posterior log variance  | 
      
| Vector | ns | Dirichlet counts-1  | 
      
| Vector[] | grad | Vector to store the gradient in  | 
      
Returns
| Type | Description | 
|---|---|
| Double | KL divergence  | 
      
SoftmaxAverageLogarithm<GaussianList>(GaussianList, IList<Double>, Dirichlet)
VMP message to 'softmax'
Declaration
public static Dirichlet SoftmaxAverageLogarithm<GaussianList>([SkipIfAllUniform] GaussianList x, IList<double> a, Dirichlet result)
    where GaussianList : IList<Gaussian>
  Parameters
| Type | Name | Description | 
|---|---|---|
| GaussianList | x | Incoming message from 'x'. Must be a proper distribution. If all elements are uniform, the result will be uniform.  | 
      
| IList<Double> | a | Buffer 'a'.  | 
      
| Dirichlet | result | Modified to contain the outgoing message  | 
      
Returns
| Type | Description | 
|---|---|
| Dirichlet | 
  | 
      
Type Parameters
| Name | Description | 
|---|---|
| GaussianList | 
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, IList<Gaussian>, IList<Double>, GaussianList)
VMP message to 'x'
Declaration
public static GaussianList XAverageLogarithm<GaussianList>(Dirichlet softmax, [SkipIfAllUniform] IList<Gaussian> x, IList<double> a, GaussianList result)
    where GaussianList : IList<Gaussian>
  Parameters
| Type | Name | Description | 
|---|---|---|
| Dirichlet | softmax | Incoming message from 'softmax'. Must be a proper distribution. If any element is uniform, the result will be uniform.  | 
      
| IList<Gaussian> | x | Incoming message from 'x'. Must be a proper distribution. If all elements are uniform, the result will be uniform.  | 
      
| IList<Double> | a | Buffer 'a'.  | 
      
| GaussianList | result | Modified to contain the outgoing message  | 
      
Returns
| Type | Description | 
|---|---|
| GaussianList | 
  | 
      
Type Parameters
| Name | Description | 
|---|---|
| GaussianList | 
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 | 
  |