Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NestedToMCMCAdapter to enable compatibility with MCMC (#2391) #2400

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SamuelSonoiki
Copy link

@SamuelSonoiki SamuelSonoiki commented Dec 5, 2024

Description

This PR addresses issue #2391 by adding the NestedToMCMCAdapter class to convert NestedSampler objects into an MCMC-compatible interface. This change ensures compatibility with tools like ArviZ for posterior analysis and visualization.

Key Changes:

  • Implemented NestedToMCMCAdapter to reshape posterior samples from NestedSampler into a chain-and-draw structure expected by MCMC workflows.
  • Added get_samples method to provide reshaped or flattened posterior samples.
  • Added get_extra_fields method to simulate dummy sampling statistics such as acceptance probabilities, step sizes, and number of steps.
  • Supports passing model arguments (e.g., data, labels) for models requiring input parameters.

This update allows seamless integration of NestedSampler results into ArviZ workflows and enhances usability for downstream analysis.

Checklist

  • Follows official PR format
  • Includes a sample plot to visually illustrate the changes (only for plot-related functions)
  • New features are properly documented (with an example if appropriate)
  • Includes new or updated tests to cover the new feature
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

📚 Documentation preview 📚: https://arviz--2400.org.readthedocs.build/en/2400/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant