Skip to content

Support getattr for prior module #511

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

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

williambdean
Copy link
Collaborator

@williambdean williambdean commented Jun 9, 2025

This ports this PR: pymc-labs/pymc-marketing#1534

It was removed from PyMC-Marketing due to the documentation build failing. However, since the
build for PyMC-extras requires specified classes and functions, it should work.

The prior class now has the convenience imports:

# Direct import of a distribution
from pymc_extras.prior import Normal, HalfNormal

distribution = Normal(mu=Normal(), sigma=HalfNormal(), dims="covariate")

# dot notation for convenience
import pymc_extras.prior as pr

distribution = pr.Normal(mu=pr.Normal(), sigma=pr.HalfNormal(), dims="covariate")

Then use like normal:

assert isinstance(distribution, pr.Prior)
assert distribution == Prior("Normal", mu=Prior("Normal"), sigma=Prior("HalfNormal"), dims="covariate")

No functional change. Just a convenience import to make things closer to the PyMC / preliz API

@williambdean
Copy link
Collaborator Author

williambdean commented Jun 9, 2025

Closes #500

@williambdean williambdean linked an issue Jun 10, 2025 that may be closed by this pull request
Copy link

@juanitorduz juanitorduz left a comment

Choose a reason for hiding this comment

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

Nice 😎 !

@juanitorduz juanitorduz merged commit ce618a4 into pymc-devs:main Jun 10, 2025
17 checks passed
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.

Implement __getattr__ for Prior class
2 participants