{"id":13699440,"url":"https://github.com/jeremiecoullon/SGMCMCJax","last_synced_at":"2025-05-04T16:34:10.285Z","repository":{"id":41955070,"uuid":"380187309","full_name":"jeremiecoullon/SGMCMCJax","owner":"jeremiecoullon","description":"Lightweight library of stochastic gradient MCMC algorithms written in JAX.","archived":false,"fork":false,"pushed_at":"2023-10-23T08:43:46.000Z","size":1435,"stargazers_count":95,"open_issues_count":11,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-13T21:40:25.992Z","etag":null,"topics":["bayesian-inference","jax","sampling-methods"],"latest_commit_sha":null,"homepage":"https://sgmcmcjax.readthedocs.io/en/latest/index.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeremiecoullon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-06-25T09:21:17.000Z","updated_at":"2024-09-21T18:00:09.000Z","dependencies_parsed_at":"2022-08-04T12:30:12.492Z","dependency_job_id":"5912c828-402a-4102-bf93-8aaa8e16edb9","html_url":"https://github.com/jeremiecoullon/SGMCMCJax","commit_stats":{"total_commits":140,"total_committers":6,"mean_commits":"23.333333333333332","dds":0.07857142857142863,"last_synced_commit":"a2a2ae81da4aa57f08274909d1d5138c815e6ddc"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremiecoullon%2FSGMCMCJax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremiecoullon%2FSGMCMCJax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremiecoullon%2FSGMCMCJax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremiecoullon%2FSGMCMCJax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeremiecoullon","download_url":"https://codeload.github.com/jeremiecoullon/SGMCMCJax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224398825,"owners_count":17304661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian-inference","jax","sampling-methods"],"created_at":"2024-08-02T20:00:33.290Z","updated_at":"2024-11-13T05:30:58.619Z","avatar_url":"https://github.com/jeremiecoullon.png","language":"Python","funding_links":[],"categories":["\u003cspan id=\"head30\"\u003e3.4. Bayesian Inference\u003c/span\u003e"],"sub_categories":["\u003cspan id=\"head31\"\u003e3.4.1. MCMC\u003c/span\u003e"],"readme":"# SGMCMCJax\n\n[**Quickstart**](#example-usage) | [**Samplers**](#samplers) | [**Documentation**](https://sgmcmcjax.readthedocs.io/en/latest/index.html)\n\nSGMCMCJax is a lightweight library of stochastic gradient Markov chain Monte Carlo (SGMCMC) algorithms. The aim is to include both standard samplers (SGLD, SGHMC) as well as state of the art samplers while requiring only JAX to run.\n\nThe target audience for this library is researchers and practitioners: simply plug in your JAX model and easily obtain samples.\n\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.04113/status.svg)](https://doi.org/10.21105/joss.04113)\n\n## Example usage\n\nWe show the basic usage with the following example of estimating the mean of a D-dimensional Gaussian from data using a Gaussian prior.\n\n```python\nimport jax.numpy as jnp\nfrom jax import random\nfrom sgmcmcjax.samplers import build_sgld_sampler\n\n\n# define model in JAX\ndef loglikelihood(theta, x):\n    return -0.5*jnp.dot(x-theta, x-theta)\n\ndef logprior(theta):\n    return -0.5*jnp.dot(theta, theta)*0.01\n\n# generate dataset\nN, D = 10_000, 100\nkey = random.PRNGKey(0)\nX_data = random.normal(key, shape=(N, D))\n\n# build sampler\nbatch_size = int(0.1*N)\ndt = 1e-5\nmy_sampler = build_sgld_sampler(dt, loglikelihood, logprior, (X_data,), batch_size)\n\n# run sampler\nNsamples = 10_000\nsamples = my_sampler(key, Nsamples, jnp.zeros(D))\n```\n\n## Ask a question or open an issue\n\nPlease open issues on [Github Issue Tracker](https://github.com/jeremiecoullon/SGMCMCJax/issues), or ask a question in the [Discussion section](https://github.com/jeremiecoullon/SGMCMCJax/discussions) on Github.\n\n\n## Samplers\n\nThe library includes several SGMCMC algorithms with their pros and cons briefly discussed in the [documentation](https://sgmcmcjax.readthedocs.io/en/latest/all_samplers.html).\n\nThe current list of samplers is:\n\n- SGLD\n- SGLD-CV\n- SVRG-Langevin\n- SGHMC\n- SGHMC-CV\n- SVRG-SGHMC\n- pSGLD\n- SGLDAdam\n- BAOAB\n- SGNHT\n- SGNHT-CV\n- BADODAB\n- BADODAB-CV\n\n\n## Installation\n\nCreate a virtual environment and either install a stable version using pip or install the development version.\n\n### Stable version\n\nTo install the latest stable version run:\n\n```\npip install sgmcmcjax\n```\n\n### Development version\n\nTo install the development version run:\n\n```\ngit clone https://github.com/jeremiecoullon/SGMCMCJax.git\ncd SGMCMCJax\npython -m pip install -e .\n```\nThen run the tests with `pip install -r requirements-dev.txt; make`\n\nTo run code style checks: `make lint`\n\n## Citing SGMCMCJax\n\nPlease use the following bibtex reference to cite this repository:\n\n```\n@article{Coullon2022,\n  doi = {10.21105/joss.04113},\n  url = {https://doi.org/10.21105/joss.04113},\n  year = {2022},\n  publisher = {The Open Journal},\n  volume = {7},\n  number = {72},\n  pages = {4113},\n  author = {Jeremie Coullon and Christopher Nemeth},\n  title = {SGMCMCJax: a lightweight JAX library for stochastic gradient Markov chain Monte Carlo algorithms},\n  journal = {Journal of Open Source Software}\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremiecoullon%2FSGMCMCJax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeremiecoullon%2FSGMCMCJax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremiecoullon%2FSGMCMCJax/lists"}