{"id":24738375,"url":"https://github.com/astro-informatics/proxnest","last_synced_at":"2025-10-10T07:32:37.257Z","repository":{"id":41295985,"uuid":"488969274","full_name":"astro-informatics/proxnest","owner":"astro-informatics","description":"Proximal Nested Sampling for high-dimensional Bayesian model selection","archived":false,"fork":false,"pushed_at":"2024-04-18T09:52:15.000Z","size":16717,"stargazers_count":25,"open_issues_count":2,"forks_count":4,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-09-23T01:13:18.582Z","etag":null,"topics":["bayesian","model-selection","nested-sampling","proximal-algorithms"],"latest_commit_sha":null,"homepage":"https://astro-informatics.github.io/proxnest/","language":"Jupyter Notebook","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":"2022-05-05T12:46:23.000Z","updated_at":"2025-06-11T13:46:36.000Z","dependencies_parsed_at":"2025-01-27T22:36:27.410Z","dependency_job_id":"23401409-2adb-4ad5-9c9d-330c5f5e87f2","html_url":"https://github.com/astro-informatics/proxnest","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/astro-informatics/proxnest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fproxnest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fproxnest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fproxnest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fproxnest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astro-informatics","download_url":"https://codeload.github.com/astro-informatics/proxnest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astro-informatics%2Fproxnest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003189,"owners_count":26083533,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","model-selection","nested-sampling","proximal-algorithms"],"created_at":"2025-01-27T22:36:07.224Z","updated_at":"2025-10-10T07:32:36.843Z","avatar_url":"https://github.com/astro-informatics.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":".. |github| image:: https://img.shields.io/badge/GitHub-ProxNest-brightgreen.svg?style=flat\n    :target: https://github.com/astro-informatics/proxnest\n.. |tests| image:: https://github.com/astro-informatics/proxnest/actions/workflows/tests.yml/badge.svg?branch=main\n    :target: https://github.com/astro-informatics/proxnest/actions/workflows/tests.yml\n.. |docs| image:: https://github.com/astro-informatics/proxnest/actions/workflows/docs.yml/badge.svg\n    :target: https://astro-informatics.github.io/proxnest\n.. |codecov| image:: https://codecov.io/gh/astro-informatics/proxnest/branch/main/graph/badge.svg?token=oGowwdoMRN\n    :target: https://codecov.io/gh/astro-informatics/proxnest\n.. |pypi| image:: https://badge.fury.io/py/ProxNest.svg\n    :target: https://badge.fury.io/py/ProxNest\n.. |licence| image:: https://img.shields.io/badge/License-GPL-blue.svg\n    :target: http://perso.crans.org/besson/LICENSE.html\n.. |arxiv| image:: http://img.shields.io/badge/arXiv-2106.03646-orange.svg?style=flat\n    :target: https://arxiv.org/abs/2106.03646\n\n|github| |tests| |docs| |codecov| |pypi| |licence| |arxiv|\n\n|logo| Proximal nested sampling for high-dimensional Bayesian model selection\n=================================================================================================================\n\n.. |logo| raw:: html\n\n   \u003cimg src=\"./docs/assets/ProxNestLogo.png\" align=\"center\" height=\"80\" width=\"100\"\u003e\n\n``ProxNest`` is an open source, well tested and documented Python implementation of the *proximal nested sampling* framework (`Cai et al. 2022 \u003chttps://arxiv.org/pdf/2106.03646.pdf\u003e`_) to compute the Bayesian model evidence or marginal likelihood in high-dimensional log-convex settings.  Furthermore, non-smooth sparsity-promoting priors are also supported.\n\nThis is achieved by exploiting tools from proximal calculus and Moreau-Yosida regularisation (`Moreau 1962 \u003chttps://hal.archives-ouvertes.fr/hal-01867195/file/Fonctions_convexes_duales_points_proximaux_Moreau_CRAS_1962.pdf\u003e`_) to efficiently sample from the prior subject to the hard likelihood constraint. The resulting Markov chain iterations include a gradient step, approximating (with arbitrary precision) an overdamped Langevin SDE that can scale to very high-dimensional applications.\n\nBasic Usage\n===========\n\nThe following is a straightforward example application to image denoising (Phi = I), regularised with Daubechies wavelets (DB6). \n\n.. code-block:: Python\n\n    # Import relevant modules.\n    import numpy as np \n    import ProxNest \n\n    # Load your data and set parameters.\n    data = np.load(\u003cpath to your data.npy\u003e)\n    params = params    # Parameters of the prior resampling optimisation problem.\n    options = options  # Options associated with the sampling strategy.\n\n    # Construct your forward model (phi) and wavelet operators (psi).\n    phi = ProxNest.operators.sensing_operators.Identity()\n    psi = ProxNest.operators.wavelet_operators.db_wavelets([\"db6\"], 2, (dim, dim))\n\n    # Define proximal operators for both your likelihood and prior.\n    proxH = lambda x, T : ProxNest.operators.proximal_operators.l1_projection(x, T, delta, Psi=psi)\n    proxB = lambda x, tau: ProxNest.optimisations.l2_ball_proj.sopt_fast_proj_B2(x, tau, params)\n\n    # Write a lambda function to evaluate your likelihood term (here a Gaussian)\n    LogLikeliL = lambda sol : - np.linalg.norm(y-phi.dir_op(sol), 'fro')**2/(2*sigma**2)\n\n    # Perform proximal nested sampling\n    BayEvi, XTrace = ProxNest.sampling.proximal_nested.ProxNestedSampling(\n        np.abs(phi.adj_op(data)), LogLikeliL, proxH, proxB, params, options\n        )\n\nAt this point you have recovered the tuple **BayEvi** and dict **Xtrace** which contain \n\n.. code-block:: python\n\n    Live = options[\"samplesL\"] # Number of live samples\n    Disc = options[\"samplesD\"] # Number of discarded samples\n\n    # BayEvi is a tuple containing two values:\n    BayEvi[0] = 'Estimate of Bayesian evidence (float).'\n    BayEvi[1] = 'Variance of Bayesian evidence estimate (float).'\n\n    # XTrace is a dictionary containing the np.ndarrays:\n    XTrace['Liveset'] = 'Set of live samples (shape: Live, dim, dim).'\n    XTrace['LivesetL'] = 'Likelihood of live samples (shape: Live).'\n\n    XTrace['Discard'] = 'Set of discarded samples (shape: Disc, dim, dim).'\n    XTrace['DiscardL'] = 'Likelihood of discarded samples (shape: Disc).'\n    XTrace['DiscardW'] = 'Weights of discarded samples (shape: Disc).'\n\n    XTrace['DiscardPostProb'] = 'Posterior probability of discarded samples (shape: Disc)'\n    XTrace['DiscardPostMean'] = 'Posterior mean solution (shape: dim, dim)'\n\nfrom which one can perform *e.g.* Bayesian model comparison.\n\nInstallation\n============\n\nBrief installation instructions are given below (for further details see the full installation documentation).  \n\nQuick install (PyPi)\n--------------------\nThe ``ProxNest`` package can be installed by running\n\n.. code-block:: bash\n    \n    pip install ProxNest\n\nInstall from source (GitHub)\n----------------------------\nThe ``ProxNest`` package can also be installed from source by running\n\n.. code-block:: bash\n\n    git clone https://github.com/astro-informatics/proxnest\n    cd harmonic\n\nand running the install script, within the root directory, with one command \n\n.. code-block:: bash\n\n    bash build_proxnest.sh\n\nTo check the install has worked correctly run the unit tests with \n\n.. code-block:: bash\n\n    pytest --black ProxNest/tests/\n\nContributors\n============\n`Matthew Price \u003chttps://cosmomatt.github.io\u003e`_, `Xiaohao Cai \u003chttps://xiaohaocai.netlify.app\u003e`_, `Jason McEwen \u003chttp://www.jasonmcewen.org\u003e`_, `Marcelo Pereyra \u003chttps://www.macs.hw.ac.uk/~mp71/about.html\u003e`_, and contributors.\n\nAttribution\n===========\nA BibTeX entry for ``ProxNest`` is:\n\n.. code-block:: \n\n     @article{Cai:ProxNest:2021, \n        author = {Cai, Xiaohao and McEwen, Jason~D. and Pereyra, Marcelo},\n         title = {\"High-dimensional Bayesian model selection by proximal nested sampling\"},\n       journal = {ArXiv},\n        eprint = {arXiv:2106.03646},\n          year = {2021}\n     }\n\nLicense\n=======\n\n``ProxNest`` is released under the GPL-3 license (see `LICENSE.txt \u003chttps://github.com/astro-informatics/proxnest/blob/main/LICENSE.txt\u003e`_), subject to \nthe non-commercial use condition (see `LICENSE_EXT.txt \u003chttps://github.com/astro-informatics/proxnest/blob/main/LICENSE_EXT.txt\u003e`_)\n\n.. code-block::\n\n     ProxNest\n     Copyright (C) 2022 Matthew Price, Xiaohao Cai, Jason McEwen, Marcelo Pereyra \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%2Fproxnest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastro-informatics%2Fproxnest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastro-informatics%2Fproxnest/lists"}