Skip to content
/ HAIS Public

Hamiltonian Annealed Importance Sampling (HAIS) in tensorflow

License

Notifications You must be signed in to change notification settings

JohnReid/HAIS

Repository files navigation

README

A TensorFlow implementation of Hamiltonian Annealed Importance Sampling (HAIS). We implement the method described by Sohl-Dickstein and Culpepper in their paper "Hamiltonian Annealed Importance Sampling for partition function estimation".

Features

  • Partial momentum refresh (from HAIS paper). This preserves some fraction of the Hamiltonian Monte Carlo momentum across annealing distributions resulting in more accurate estimation.
  • Adaptive step size for Hamiltonian Monte Carlo. This is a simple scheme to adjust the step size for each chain in order to push the smoothed acceptance rate towards a theoretical optimum.

Related implementations

We have used ideas and built upon the code from some of the following repositories:

Tests

The tests that appear to be working include:

  • test-hmc: a simple test of the HMC implementation
  • test-hmc-mvn: a test of the HMC implementation that samples from a multivariate normal
  • test-hais-log-gamma: a simple test to sample from and calculate the log normaliser of an unnormalised log-Gamma density.
  • test-hais-model1a-gaussian: a test that estimates the log marginal likelihood for model 1a with a Gaussian prior from Sohl-Dickstein and Culpepper (2011).

Installation

Install either the GPU version of TensorFlow (I don't know why but tensorflow-gpu==1.8 and tensorflow-gpu==1.9 are >10x slower than 1.7 on my machine)

pip install tensorflow-gpu==1.7

or the CPU version

pip install tensorflow

then install the project

pip install git+https://github.com/JohnReid/HAIS

API documentation

The implementation contains some documentation generated from the docstrings that may be useful. However it is probably easier to examine the test scripts and adapt them to your needs.

Who do I talk to?

John Reid or Halil Bilgin

Releases

No releases published

Packages

No packages published

Languages