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

as_model wraps function arguments in Data if they support it. #414

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

zaxtax
Copy link
Contributor

@zaxtax zaxtax commented Jan 12, 2025

This extends as_model to wrap the function arguments in pm.Data

The motivation for this is that often what gets resampled when running sample_posterior_predictive is dependent on what variables are shared. This makes lots of default behaviour less surprising. It also makes it easier to adapt models made with as_model into workflows which rely on set_data

@@ -25,5 +25,12 @@ def model_wrapped2():

mw2 = model_wrapped2(coords=coords)

@pmx.as_model()
Copy link
Member

Choose a reason for hiding this comment

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

Can you add an explicitly test with numpy array with nan which should fail when wrapped in pm.Data?

@zaxtax zaxtax force-pushed the add_data_to_as_model branch from b065709 to 66e9d7f Compare January 15, 2025 16:08
@ricardoV94 ricardoV94 changed the title Wrap function arguments with pm.Data if they support it. as_model wrap function arguments in Data if they support it. Jan 16, 2025
@ricardoV94 ricardoV94 changed the title as_model wrap function arguments in Data if they support it. as_model wraps function arguments in Data if they support it. Jan 16, 2025
@ricardoV94 ricardoV94 merged commit 96f7a2e into pymc-devs:main Jan 16, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants