{"id":24738381,"url":"https://github.com/astro-informatics/harmonic","last_synced_at":"2025-04-05T05:04:29.066Z","repository":{"id":36991005,"uuid":"121647599","full_name":"astro-informatics/harmonic","owner":"astro-informatics","description":"Machine learning assisted marginal likelihood (Bayesian evidence) estimation for Bayesian model selection","archived":false,"fork":false,"pushed_at":"2025-03-21T12:49:56.000Z","size":14090,"stargazers_count":60,"open_issues_count":30,"forks_count":7,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-29T04:05:30.494Z","etag":null,"topics":["bayesian-inference","code","machine-learning","statistics-toolbox"],"latest_commit_sha":null,"homepage":"https://astro-informatics.github.io/harmonic/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astro-informatics.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-15T15:45:36.000Z","updated_at":"2025-02-19T15:51:11.000Z","dependencies_parsed_at":"2023-11-17T14:11:16.407Z","dependency_job_id":"6193a673-557f-42b3-8062-5df715413652","html_url":"https://github.com/astro-informatics/harmonic","commit_stats":{"total_commits":672,"total_committers":18,"mean_commits":"37.333333333333336","dds":0.7723214285714286,"last_synced_commit":"4b62a608855c43a5d8b6d69c77e3a2a455cf82b1"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fharmonic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fharmonic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fharmonic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fharmonic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astro-informatics","download_url":"https://codeload.github.com/astro-informatics/harmonic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289424,"owners_count":20914464,"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","code","machine-learning","statistics-toolbox"],"created_at":"2025-01-27T22:36:08.588Z","updated_at":"2025-04-05T05:04:29.043Z","avatar_url":"https://github.com/astro-informatics.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. |github| image:: https://img.shields.io/badge/GitHub-harmonic-brightgreen.svg?style=flat\n    :target: https://github.com/astro-informatics/harmonic\n.. |tests| image:: https://github.com/astro-informatics/harmonic/actions/workflows/python.yml/badge.svg\n    :target: https://github.com/astro-informatics/harmonic/actions/workflows/python.yml\n.. |docs| image:: https://readthedocs.org/projects/ansicolortags/badge/?version=latest\n    :target: https://astro-informatics.github.io/harmonic/\n.. |codecov| image:: https://codecov.io/gh/astro-informatics/harmonic/branch/main/graph/badge.svg?token=1s4SATphHV\n    :target: https://codecov.io/gh/astro-informatics/harmonic\n.. |pypi| image:: https://badge.fury.io/py/harmonic.svg\n    :target: https://badge.fury.io/py/harmonic\n.. |licence| image:: https://img.shields.io/badge/License-GPL-blue.svg\n    :target: http://perso.crans.org/besson/LICENSE.html\n.. |arxiv1| image:: http://img.shields.io/badge/arXiv-2111.12720-orange.svg?style=flat\n    :target: https://arxiv.org/abs/2111.12720\n.. |arxiv2| image:: http://img.shields.io/badge/arXiv-2207.04037-orange.svg?style=flat\n    :target: https://arxiv.org/abs/2207.04037\n.. |arxiv3| image:: http://img.shields.io/badge/arXiv-2307.00048-orange.svg?style=flat\n    :target: https://arxiv.org/abs/2307.00048\n.. |arxiv4| image:: http://img.shields.io/badge/arXiv-2405.05969-orange.svg?style=flat\n    :target: https://arxiv.org/abs/2405.05969\n.. .. image:: https://img.shields.io/pypi/pyversions/harmonic.svg\n..     :target: https://pypi.python.org/pypi/harmonic/\n\n|github| |tests| |docs| |codecov| |pypi| |licence| |arxiv1| |arxiv2| |arxiv3| |arxiv4|\n\n\n|logo|\n\n.. |logo| image:: /docs/assets/harm_badge_simple.svg\n    :width: 90\n=================================================================================================================\n\n``harmonic`` is an open source, well tested and documented Python implementation of the *learnt harmonic mean estimator* (`McEwen et al. 2021 \u003chttps://arxiv.org/abs/2111.12720\u003e`_) to compute the marginal likelihood (Bayesian evidence), required for Bayesian model selection.\n\nFor an accessible overview of the *learnt harmonic mean estimator* please see this `Towards Data Science article \u003chttps://towardsdatascience.com/learnt-harmonic-mean-estimator-for-bayesian-model-selection-47258bb0fc2e\u003e`_.\n\nWhile ``harmonic`` requires only posterior samples, and so is agnostic to the technique used to perform Markov chain Monte Carlo (MCMC) sampling, ``harmonic`` works well with MCMC sampling techniques that naturally provide samples from multiple chains by their ensemble nature, such as affine invariant ensemble samplers.  For instance, ``harmonic`` can be used with the popular `emcee \u003chttps://github.com/dfm/emcee\u003e`_ code implementing the affine invariant sampler of `Goodman \u0026 Weare (2010) \u003chttps://cims.nyu.edu/~weare/papers/d13.pdf\u003e`_, or the `NumPyro \u003chttps://github.com/pyro-ppl/numpyro\u003e`_ code implementing various MCMC algorithms.\n\nBasic usage is highlighted in this `interactive demo \u003chttps://colab.research.google.com/github/astro-informatics/harmonic/blob/main/notebooks/basic_usage.ipynb\u003e`_. \n\nOverview video\n==============\n\n.. image:: docs/assets/video_screenshot.png\n    :target: https://www.youtube.com/watch?v=RHoQItSA4J4\n\n\nInstallation\n============\n\nBrief installation instructions are given below (for further details see the `full installation documentation \u003chttps://astro-informatics.github.io/harmonic/user_guide/install.html\u003e`_).  \n\nQuick install (PyPi)\n--------------------\nThe ``harmonic`` package can be installed by running\n\n.. code-block:: bash\n    \n    pip install harmonic\n\nInstall from source (GitHub)\n----------------------------\nThe ``harmonic`` package can also be installed from source by running\n\n.. code-block:: bash\n\n    git clone https://github.com/astro-informatics/harmonic\n    cd harmonic\n\nand installing within the root directory, with one command \n\n.. code-block:: bash\n\n    pip install .\n\nTo check the install has worked correctly run the unit tests with \n\n.. code-block:: bash\n\n    pytest \n\nTo build the documentation from source run\n\n.. code-block:: bash\n\n    cd docs \u0026\u0026 make html\n\nThen open ``./docs/_build/html/index.html`` in a browser.\n\nDocumentation\n=============\n\nComprehensive  `documentation for harmonic \u003chttps://astro-informatics.github.io/harmonic/\u003e`_ is available.\n\nContributors\n============\n\n`Jason D. McEwen \u003chttp://www.jasonmcewen.org/\u003e`_, `Christopher G. R. Wallis \u003chttps://scholar.google.co.uk/citations?user=Igl7nakAAAAJ\u0026hl=en\u003e`_, `Matthew A. Price \u003chttps://cosmomatt.github.io/\u003e`_, `Matthew M. Docherty \u003chttps://mdochertyastro.com/\u003e`_, `Alessio Spurio Mancini \u003chttps://www.alessiospuriomancini.com/\u003e`_, `Alicja Polanska \u003chttps://alicjaap.github.io/\u003e`_.\n\n\nAttribution\n===========\n\nPlease cite `McEwen et al. (2021) \u003chttps://arxiv.org/abs/2111.12720\u003e`_ if this code package has been of use in your project. \n\nA BibTeX entry for the paper is:\n\n.. code-block:: \n\n     @article{harmonic, \n        author = {Jason~D.~McEwen and Christopher~G.~R.~Wallis and Matthew~A.~Price and Matthew~M.~Docherty},\n         title = {Machine learning assisted {B}ayesian model comparison: learnt harmonic mean estimator},\n       journal = {ArXiv},\n        eprint = {arXiv:2111.12720},\n          year = 2021\n     }\n\n\nPlease *also* cite `Polanska et al. (2024) \u003chttps://arxiv.org/abs/2405.05969\u003e`_ if using normalizing flow models.\n\nA BibTeX entry for the paper is:\n\n.. code-block::\n\n    @misc{polanska2024learned,\n        title={Learned harmonic mean estimation of the Bayesian evidence with normalizing flows}, \n        author={Alicja Polanska and Matthew A. Price and Davide Piras and Alessio Spurio Mancini and Jason D. McEwen},\n        year={2024},\n        eprint={2405.05969},\n        archivePrefix={arXiv},\n        primaryClass={astro-ph.IM}\n    }\n\nPlease *also* cite `Spurio Mancini et al. (2022) \u003chttps://arxiv.org/abs/2207.04037\u003e`_ if this code has been of use in a simulation-based inference project.\n\nA BibTeX entry for the paper is:\n\n.. code-block::\n\n     @article{spurio-mancini:harmonic_sbi,\n        author   = {A.~Spurio Mancini and M.~M.~Docherty and M.~A.~Price and J.~D.~McEwen},\n        doi      = {10.1093/rasti/rzad051},\n        eprint   = {arXiv:2207.04037},\n        journal  = {{RASTI}, in press},\n        title    = {{B}ayesian model comparison for simulation-based inference},\n        year     = {2023}\n     }\n\n\nLicense\n=======\n\n``harmonic`` is released under the GPL-3 license (see `LICENSE.txt \u003chttps://github.com/astro-informatics/harmonic/blob/main/LICENSE.txt\u003e`_), subject to \nthe non-commercial use condition (see `LICENSE_EXT.txt \u003chttps://github.com/astro-informatics/harmonic/blob/main/LICENSE_EXT.txt\u003e`_)\n\n.. code-block::\n\n     harmonic\n     Copyright (C) 2021 Jason D. McEwen, Christopher G. R. Wallis, \n     Matthew A. Price, Matthew M. Docherty, Alessio Spurio Mancini, \n     Alicja Polanska \u0026 contributors\n\n     This program is released under the GPL-3 license (see LICENSE.txt), \n     subject to a non-commercial use condition (see LICENSE_EXT.txt).\n\n     This program is distributed in the hope that it will be useful,\n     but WITHOUT ANY WARRANTY; without even the implied warranty of\n     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastro-informatics%2Fharmonic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastro-informatics%2Fharmonic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastro-informatics%2Fharmonic/lists"}