Skip to main content

Parallel tempering MCMC sampler written in Python

Project description

PTMCMCSampler

GitHub release (latest by date) GitHub Workflow Status (event) DOI Python Versions GitHub license

MPI enabled Parallel Tempering MCMC code written in Python.

See the examples for some simple use cases.

For MPI support you will need A functional MPI 1.x/2.x/3.x implementation like:

  • MPICH
    # mac
    brew install mpich
    
    # debian
    sudo apt install mpich
    
  • Open MPI
    # mac
    brew install open-mpi
    
    # debian
    sudo apt install libopenmpi-dev
    

To run with MPI support you can run your script containing a sampler with:

mpirun -np <number of temperature chains> script.py

This will kick off np chains running at different temperatures. The temperature ladder and sampling schemes can be set in the PTMCMCSampler.sample() method.

Installation

Development

For development clone this repo and run:

make init
source venv/bin/activate

Via pip

pip install ptmcmcsampler

for MPI support use

pip install ptmcmcsampler[mpi]

Attribution

If you make use of this code, please cite:

@misc{justin_ellis_2017_1037579,
  author       = {Justin Ellis and
                  Rutger van Haasteren},
  title        = {jellis18/PTMCMCSampler: Official Release},
  month        = oct,
  year         = 2017,
  doi          = {10.5281/zenodo.1037579},
  url          = {https://doi.org/10.5281/zenodo.1037579}
}

Correlation Length

In order for the sampler to run correctly using acor with Python 3 kernels the GitHub version of acor needs to be installed. (Currently the PyPI version is behind the GitHub version.) It can be easily installed with:

pip install git+https://github.com/dfm/acor.git@master

Note that acor is not required to run the sampler, it simply calculates the effective chain length for output in the chain file.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ptmcmcsampler-2.0.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

ptmcmcsampler-2.0.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file ptmcmcsampler-2.0.0.tar.gz.

File metadata

  • Download URL: ptmcmcsampler-2.0.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for ptmcmcsampler-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1f96ea651a3c3964a7e37ca3c3924aff83a552d0b278bfcc991af265d8739ae3
MD5 cbcd208d2100df57e84020a3228769f3
BLAKE2b-256 7425772836964877039302c263a6946d9cb791db7d99d93d8edee3b0d1081c75

See more details on using hashes here.

File details

Details for the file ptmcmcsampler-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: ptmcmcsampler-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for ptmcmcsampler-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 520654e11fbb7829338dde6f28ea11b61e9d939d35c3109110512565173f35dd
MD5 60d6edc5be06c5b40d1e6e0262fb4b50
BLAKE2b-256 ee87620ef345742aa1572a50060f632cf1c07040a9a18497699204df17ce4dca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page