FFVB: Control variate
This section describes a control variate technique for variance reduction.
See: Variational Bayes Introduction, Fixed Form Variational Bayes
Control variate
Let
For any number
which is still an unbiased estimator of
The variance of
The optimal
Then
where
One can estimate the numbers
In practice, the
We then update the
Algorithm 4 provides a detailed pseudo-code implementation of the FFVB approach that uses the control variate for variance reduction and moving average adaptive learning, and Algorithm 5 implements the FFVB approach that uses the control variate and natural gradient.
Algorithm 4: FFVB with control variates and adaptive learning
- Input: Initial
, adaptive learning weights , fixed learning rate , threshold , rolling window size and maximum patience . Model-specific requirement: function . - Initialization
- Generate
, . -
Compute the unbiased estimate of the LB gradient
- Set
, , , . - Estimate the vector of control variates
as in using the samples . - Set
, and .
- Generate
- While
:- Generate
, . -
Compute the unbiased estimate of the LB gradient
- Estimate the new control variate vector
as in using the samples . -
Compute
and -
Compute
and update -
Compute the lower bound estimate
\item If : compute the moving averaged lower boundand if
patience = 0; else . - If
, . - Set
.
- Generate
Note: The term
Algorithm 5: FFVB with control variates and natural gradient
- Input: Initial
, momentum weight , fixed learning rate , threshold , rolling window size and maximum patience . Model-specific requirement: function function . - Initialization
- Generate
, . -
Compute the unbiased estimate of the LB gradient
and the natural gradient
- Set momentum gradient
- Estimate control variate vector
as in using the samples . - Set
, and .
- Generate
- While
:- Generate
, . -
Compute the unbiased estimate of the LB gradient
and the natural gradient
- Estimate the new control variate vector
as in using the samples . -
Compute the momentum gradient
-
Compute
and update -
Compute the lower bound estimate
-
If
: compute the moving average lower boundand if
patience = 0; else . - If
, . - Set
.
- Generate
Next: FFVB with reparameterization trick