Skip to content

Neals funnel - #334

Open
michalkamin wants to merge 20 commits into
stan-dev:developmentfrom
Uupali:neals-funnel
Open

michalkamin wants to merge 20 commits into
stan-dev:developmentfrom
Uupali:neals-funnel

Conversation

@michalkamin

@michalkamin michalkamin commented Sep 23, 2026 •

Copy link
Copy Markdown

TLDR: Add the non-centered and centered parameterization of the Neal's funnel model.

This draft PR introduces the Neal's Funnel model to PosteriorDB using a 9-dimensional centered and non-centered parameterization. Neal's Funnel is a classic synthetic distribution that provides a challenging geometry for benchmarking MCMC samplers

Changes included

  • models: Added both implementations for both Stan and PyMC.
  • data: Synthetic data JSON specifying D=9 dimensions
  • Metadata: Added corresponding 'info.json' files for the model and data, plus the main posterior JSON file

"name": "neals_funnel",
"keywords": ["synthetic", "funnel"],
"title": "Neal's Funnel",
"description": "Neal's Funnel is a classic example of a hierarchical model that is difficult to sample from due to its geometry. It consists of a two-dimensional distribution where one dimension has a standard normal distribution and the other dimension has a normal distribution whose variance depends on the first dimension. This creates a 'funnel' shape that can be challenging for MCMC algorithms to explore effectively.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add info that the data is just the dimension?

"title": "Neal's Funnel (Centered Parameterization)",
"added_by": "Michal Kaminski",
"added_date": "2026-09-24",
"description": "Neal's Funnel is a classic example of a hierarchical model that is difficult to sample from due to its geometry.",

@MansMeg MansMeg Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add that its the centered parametrisation and what that mean?

Centered Neal's Funnel for PosteriorDB
"""

D = data.get("D", 9)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this be read in from the data?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to D = int(data["D"]) so there is no silent fallback and yields KeyError

Comment thread .gitignore Outdated
@MansMeg

MansMeg commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

LGTM

@JTorgander do you want to just take a look at this also?

@michalkamin

Copy link
Copy Markdown
Author

I actually had to change the JSON structure in the model info. The DATABASE_CONTENT.md specifies that it should have a "model_code" field, but when I try to load it in R using posterior() function it gives an error. I see now that other models have the code pointer as "model_implementations", and then inside a "model_code" field for respective languages. Maybe I misinterpreted the documentation; I just wanted to bring that up. @MansMeg

@MansMeg

MansMeg commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Excellent. Its most likely a bug/bad documentation. Please submit this as an issue that I can handle later on

@JTorgander

Copy link
Copy Markdown
Collaborator

LGTM as well!

@MansMeg

MansMeg commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Please make this a proper pr so we can merge to development

@michalkamin
michalkamin marked this pull request as ready for review September 25, 2026 12:20
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.

4 participants