Samplers

class geoopt.samplers.RHMC(params, epsilon=0.001, n_steps=1)[source]

Riemannian Hamiltonian Monte-Carlo.

Parameters:
  • params (iterable) – iterables of tensors for which to perform sampling
  • epsilon (float) – step size
  • n_steps (int) – number of leapfrog steps
step(closure)[source]

Perform a single sampling step.

Parameters:closure (callable) – A closure that reevaluates the model and returns the log probability.
class geoopt.samplers.RSGLD(params, epsilon=0.001)[source]

Riemannian Stochastic Gradient Langevin Dynamics.

Parameters:
  • params (iterable) – iterables of tensors for which to perform sampling
  • epsilon (float) – step size
step(closure)[source]

Perform a single sampling step.

Parameters:closure (callable) – A closure that reevaluates the model and returns the log probability.
class geoopt.samplers.SGRHMC(params, epsilon=0.001, n_steps=1, alpha=0.1)[source]

Stochastic Gradient Riemannian Hamiltonian Monte-Carlo.

Parameters:
  • params (iterable) – iterables of tensors for which to perform sampling
  • epsilon (float) – step size
  • n_steps (int) – number of leapfrog steps
  • alpha (float) – \((1 - alpha)\) – momentum term
step(closure)[source]

Perform a single sampling step.

Parameters:closure (callable) – A closure that reevaluates the model and returns the log probability.