Skip to main content

Morph-Z for high accuracy marginal likelihood estimation package.

Project description

MorphZ

Python versions PyPI version CI Docs GitHub Repo arXiv

MorphZ for high accuracy marginal likelihood estimation and morphological density approximation toolkit for scientific workflows, with utilities for dependency analysis.

  • Flexible Morph backends: independent, pairwise, grouped, and "tree-structured".
  • Bandwidth selection: Scott, Silverman, Botev ISJ, and cross-validation variants.
  • Evidence estimation via bridge sampling with robust diagnostics.
  • Mutual information and Total correlation estimation.
  • Mutual information and Chow–Liu dependency tree visualisation.

Installation

Python 3.10+ is recommended.

pip install morphz

From source (editable):

pip install -e .

Run The Examples

Interactive notebooks live in examples/:

  • examples/eggbox.ipynb — eggbox likelihood (dynesty nested sampling)
  • examples/gaussian shell.ipynb — Gaussian shell (dynesty nested sampling)
  • examples/peak_sampling.ipynb — sharply peaked posterior
  • examples/numpyro_gaussian_shell.ipynb — Gaussian shell with NUTS via NumPyro
  • examples/numpyro_morphz_lnz.ipynb — log-evidence comparison across morph types (NumPyro/NUTS)

Documentation

Jupyter Book powers the project docs. During each build the helper script copies README.md and the contents of examples/ into docs/_auto/ so that the book always reflects the latest files without committing the generated copies.

python -m pip install 'jupyter-book<2'
./docs/build_docs.sh

HTML output is written to docs/_build/html, and GitHub Actions publishes it to GitHub Pages automatically on pushes to main.

API Highlights

  • Morphs: Morph_Indep, Morph_Pairwise, Morph_Group, Morph_Tree.
  • Bandwidths: select_bandwidth, compute_and_save_bandwidths.
  • Evidence: evidence, bridge_sampling_ln (lower‑level), compute_bridge_rmse.
  • Dependency analysis: dependency_tree.compute_and_plot_mi_tree.
  • Total correlation: Nth_TC.compute_and_save_tc.

Notes:

  • If you pass a numeric kde_bw (e.g., 0.9) the library skips bandwidth JSONs.
  • pair/group proposals will compute and cache MI.json/params_*_TC.json on first use.

Dependencies

  • Core: numpy, scipy, matplotlib, corner, networkx, emcee, statsmodels, scikit-learn
  • Optional: pandas (CSV labels), pygraphviz (nicer tree layout), scikit-sparse (optional exception type)

Development

  • Build wheels/sdist: python -m build
  • Check metadata: twine check dist/*
  • Tests live in tests/

Versioning & Release

Versioning is derived from git tags via setuptools_scm.

  • Tag a release: git tag vX.Y.Z && git push --tags
  • CI: publishes to TestPyPI on pushes to main/master; to PyPI on v* tags.
  • Uses PyPI/TestPyPI Trusted Publishing (OIDC). You can also use API tokens if preferred.

License

BSD-3-Clause. See LICENSE for details.

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

morphz-0.4.0.tar.gz (4.1 MB view details)

Uploaded Source

Built Distribution

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

morphz-0.4.0-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file morphz-0.4.0.tar.gz.

File metadata

  • Download URL: morphz-0.4.0.tar.gz
  • Upload date:
  • Size: 4.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for morphz-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9d90dcc95dd979f6a3c3505f1960573b1f89949adfecdde426c7da11e76e67f5
MD5 e67861ace9b73e8a36f3fa2cf338143a
BLAKE2b-256 fd520472df6f2e7e200602bcd286b623345f9f4bd8469e03f5e15864181f833a

See more details on using hashes here.

Provenance

The following attestation bundles were made for morphz-0.4.0.tar.gz:

Publisher: publish-pypi.yml on EL-MZ/MorphZ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file morphz-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: morphz-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for morphz-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 281b8efecc2f759db8e9f432552569af2fde4e4cf0c4669d8c6d86cf1577db9c
MD5 028a2b937b1c39493c26c76a1675d347
BLAKE2b-256 117b70e15b64c4e96f14c74ab75ea4b16e614afc437f20c74532fe2cf02e4697

See more details on using hashes here.

Provenance

The following attestation bundles were made for morphz-0.4.0-py3-none-any.whl:

Publisher: publish-pypi.yml on EL-MZ/MorphZ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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