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 tests to ppe #436

Merged
merged 5 commits into from
May 17, 2024
Merged

Add tests to ppe #436

merged 5 commits into from
May 17, 2024

Conversation

rohanbabbar04
Copy link
Contributor

@rohanbabbar04 rohanbabbar04 commented May 16, 2024

Closes #433

Description

  • Add tests for ppe.
  • Return new_priors in ppe.
  • Add random_state parameter to get a unique answer.

Checklist

  • Code style is correct (follows pylint and black guidelines)
  • Includes new or updated tests to cover the new feature

@rohanbabbar04 rohanbabbar04 marked this pull request as ready for review May 16, 2024 11:04
preliz/tests/test_ppe.py Outdated Show resolved Hide resolved
preliz/tests/test_ppe.py Show resolved Hide resolved
requirements-dev.txt Outdated Show resolved Hide resolved
@rohanbabbar04
Copy link
Contributor Author

rohanbabbar04 commented May 17, 2024

Hi @aloctavodia ,

I think we can merge this PR, with the two tests and slight tweaks. I have opened a new issue #437 , I will be modifying the code and adding the tests for hierarchical models there itself(opening a new PR).

@aloctavodia
Copy link
Contributor

Better to add the test now. Just write separate tests for these 3 models. The other hierarchical model can wait.

normal_normal

with pm.Model() as model:
x = pm.Normal("x", mu=0, sigma=10)
z = pm.HalfNormal("z", 10)
y = pm.Normal("y", x, z, observed=Y)

target = pz.Normal(mu=174, sigma=20)

norma_normal_shape

with pm.Model() as model:
x = pm.Normal("x", mu=[0, 1], sigma=[10,10]) # This has shape 2
z = pm.HalfNormal("z", 10)
y = pm.Normal("y", x[idx], z, observed=Y)

target = pz.Normal(mu=174, sigma=20)

hierarchical

with pm.Model(coords=coords) as model:
μ_mu = pm.Normal('μ_mu', mu=0, sigma=10)
μ_sd = pm.HalfNormal('μ_sd', 10)
σ = pm.HalfNormal('σ', sigma=10)

μ = pm.Normal('μ', mu=μ_mu, sigma=μ_sd, dims="aa") 

y = pm.Normal('y', mu=μ[idx], sigma=σ, observed=diff)  

@aloctavodia aloctavodia merged commit 64bfa7a into arviz-devs:main May 17, 2024
4 checks passed
@rohanbabbar04 rohanbabbar04 deleted the ppe_tests branch May 17, 2024 18:27
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.

Add tests for PyMC functionality
2 participants