Skip to main content

Hamiltonian sampling and analysis of sampled distributions

Project description

Package samppy implements Hamiltonian Markov-chain sampling and some additional analysis methods for multivariate probability distributions.

The probability distribution is represented only by an array of independent and identically distributed (i.i.d.) samples drawn from the distribution.

The package includes three modules:

  • Module hamiltonian_sampler implements Hamiltonian Markov-Chain sampling. A HamiltonianSampler instance can generate random samples of a multivariate probability distribution, defined only by an non-normalized log-likelihood function, and the gradient of that function.

    The generated batch of sample vectors is stored in a 2D numpy array, either as rows or as columns.

    Class HamiltonianSampler defines a standard isotropic sampler. Class HamiltonianBoundedSampler is a subclass also allowing one- or two-sided interval limits for all vector elements.

  • Module credibility includes functions to estimate jointly credible differences and/or correlations between pairs of elements in a random vector with a multivariate probability distribution, represented only by samples.

  • Module sample_entropy includes a function to estimate the differential entropy of a multivariate probability distribution, represented only by samples. The entropy is estimated by the Kozachenko-Leonenko nearest-neighbor approximation (Singh and Poczos, 2016).

Usage

This package was developed mainly for use by another project. It is distributed separately because it may be useful for other purposes.

The Hamiltonian sampler code was inspired by the LAHMC project by Jasha Sohlstein. The present implementation includes some safety features to facilitate its use. The present sampler does not include sampling within a general subspace manifold.

Requirements

The package requires Python 3.6 with Numpy and Scipy installed. It has been tested with Numpy v. 1.17 and Scipy v. 1.5.4.

References

R M Neal (2011): MCMC using Hamiltonian dynamics. Ch. 5 in Brooks et al. (eds) Handbook of Markov Chain Monte Carlo. Chapman and Hall / CRC Press.

A. Leijon, G. E. Henter, and M. Dahlquist (2016): Bayesian analysis of phoneme confusion matrices. IEEE Transactions on Audio, Speech, and Language Processing 24(3):469–482. (Describes an application of credible-difference calculation.)

F Perez-Cruz (2008): Estimation of Information Theoretic Measures for Continuous Random Variables. Advances in Neural Information Processing Systems 21 (NIPS 2008).

S Singh and B Poczos (2016): Analysis of k-nearest neighbor distances with application to entropy estimation. arXiv:1603.08578 [math.ST].

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

samppy-1.2.2.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

samppy-1.2.2-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file samppy-1.2.2.tar.gz.

File metadata

  • Download URL: samppy-1.2.2.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for samppy-1.2.2.tar.gz
Algorithm Hash digest
SHA256 bddf0c091f7104eedfb18babb8b616addd71145585dea036c9aa3256f190e0b5
MD5 fe643a8ad687f45c216c4d42c1741ad5
BLAKE2b-256 c9c9053b770a869dff132227791b243f4f7e6a237afd0a4c06467502d5fd6c3f

See more details on using hashes here.

File details

Details for the file samppy-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: samppy-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for samppy-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2bcbebc7970969e5c2f30bcc3c2ceb458eb5747e2da9b8f4b8b7adaf68e4e46b
MD5 42bee04c0789b54aef9b45e06334906d
BLAKE2b-256 a24f96c9199c4bfe4889958dfc7ff0ba5ee410ec1bdf89d6d6cc8ccbd6a56a61

See more details on using hashes here.

Supported by

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