Skip to main content

Adaptive Markov Chain Monte Carlo (MCMC) algorithms

Project description

Adaptive-MCMC

Adaptive Markov Chain Monte Carlo (MCMC) algorithms

Examples

    from scipy.stats import multivariate_normal

    dim = 20
    cov = 0.5 * np.eye(dim) + 0.5
    inv_cov = np.linalg.inv(cov)

    def logp(x):
        return multivariate_normal.logpdf(x, mean=np.zeros(dim), cov=cov)

    def grad_logp(x):
        return -inv_cov @ x

    mala = ESJDMALA(logp, grad_logp, initial_sample=np.zeros(dim), eps0=0.5)
    samples, acc, eps_hist, esjd_hist = mala.run(20_000)
    print(f"Acceptance: {acc:.3f}, Final epsilon = {eps_hist[-1]:.4f}")

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

adaptive_mcmc-0.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

adaptive_mcmc-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file adaptive_mcmc-0.1.1.tar.gz.

File metadata

  • Download URL: adaptive_mcmc-0.1.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for adaptive_mcmc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f878c3dd8b6ee3cc23c1aa39100bd333f4adbc065517dfdcd7e8d37a52c1252e
MD5 c2db40e81291aa65ee2af3c286346231
BLAKE2b-256 3e4362c5453a090994f814948a517de2888f7f726d6dc2ce27ef6938984ebdc4

See more details on using hashes here.

File details

Details for the file adaptive_mcmc-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for adaptive_mcmc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f6864f4f7745234023ed71f1a5928b076f2647b1535e835e2fa5c1455cd9a22
MD5 b143e418c6a93fb0a3c064a7ec3cbef5
BLAKE2b-256 7f8f4c19ede3b8dcd28fe54f3427c2d3892e5c81c00d5fa9cf70f90202776d9e

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