SGLD¶
-
class
pysgmcmc.optimizers.sgld.
SGLD
(params, lr=0.01, precondition_decay_rate=0.95, num_pseudo_batches=1, num_burn_in_steps=3000, diagonal_bias=1e-08)[source]¶ Stochastic Gradient Langevin Dynamics Sampler with preconditioning. Optimization variable is viewed as a posterior sample under Stochastic Gradient Langevin Dynamics with noise rescaled in eaach dimension according to RMSProp.
-
__init__
(params, lr=0.01, precondition_decay_rate=0.95, num_pseudo_batches=1, num_burn_in_steps=3000, diagonal_bias=1e-08) → None[source]¶ Set up a SGLD Optimizer.
Parameters: - params (iterable) – Parameters serving as optimization variable.
- lr (float, optional) – Base learning rate for this optimizer. Must be tuned to the specific function being minimized. Default: 1e-2.
- precondition_decay_rate (float, optional) – Exponential decay rate of the rescaling of the preconditioner (RMSprop). Should be smaller than but nearly 1 to approximate sampling from the posterior. Default: 0.95
- num_pseudo_batches (int, optional) – Effective number of minibatches in the data set. Trades off noise and prior with the SGD likelihood term. Note: Assumes loss is taken as mean over a minibatch. Otherwise, if the sum was taken, divide this number by the batch size. Default: 1.
- num_burn_in_steps (int, optional) – Number of iterations to collect gradient statistics to update the preconditioner before starting to draw noisy samples. Default: 3000.
- diagonal_bias (float, optional) – Term added to the diagonal of the preconditioner to prevent it from degenerating. Default: 1e-8.
-