Skip to content

Comments

Prior: Differentiate dims=() and dims=None#649

Merged
williambdean merged 2 commits intopymc-devs:mainfrom
ricardoV94:prior_default_dims
Feb 19, 2026
Merged

Prior: Differentiate dims=() and dims=None#649
williambdean merged 2 commits intopymc-devs:mainfrom
ricardoV94:prior_default_dims

Conversation

@ricardoV94
Copy link
Member

This is necessary so we can provide a safe default for the user. Also xdist variables can infer dims implied by the parameters just fine, no reason to require redundancy.

This is a major change as code elsewhere may assume dims are never None

@ricardoV94
Copy link
Member Author

Unrelated failure due to pymc-devs/pymc#8106

@williambdean
Copy link
Collaborator

Is this a breaking change for configurations that currently use Prior class in deployment?

@williambdean
Copy link
Collaborator

What is the difference between Prior(...).to_dict() and Prior(..., dims=()).to_dict()

@ricardoV94
Copy link
Member Author

Is this a breaking change for configurations that currently use Prior class in deployment?

If dims were not specified, potentially yes, depends what the code on the receiving end of Prior does. If they were explicit, nothing changed

@ricardoV94
Copy link
Member Author

What is the difference between Prior(...).to_dict() and Prior(..., dims=()).to_dict()

I'll check and test. Prior.from_dict(Prior().to_dict()) should be a perfect inverse

@ricardoV94
Copy link
Member Author

ricardoV94 commented Feb 15, 2026

What is the difference between Prior(...).to_dict() and Prior(..., dims=()).to_dict()

Pushing new changes, the former doesn't include dims in the dict, the latter includes "dims": ()

@ricardoV94
Copy link
Member Author

@williambdean this will break code if and only if it tries to access dims directly and doesn't expect None as a possibility.

Otherwise cases where dims were not specified but were supposed to be () will behave as before. The only thing that is different is that code that would fail before, because dims=() was invalid (e.g., parameters imply more dims) will work (in some contexts) or only fail later.

I can't think of a cleaner transition strategy

ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 15, 2026
@ricardoV94 ricardoV94 force-pushed the prior_default_dims branch 2 times, most recently from b5fc043 to d54ca63 Compare February 15, 2026 15:14
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 15, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 15, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 15, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 17, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 17, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 17, 2026
@ricardoV94 ricardoV94 marked this pull request as ready for review February 17, 2026 15:50
Copy link
Collaborator

@williambdean williambdean left a comment

Choose a reason for hiding this comment

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

LGTM!

@williambdean williambdean merged commit cc0e061 into pymc-devs:main Feb 19, 2026
29 checks passed
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 20, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 20, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 20, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 20, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 21, 2026
ricardoV94 added a commit to ricardoV94/pymc-marketing that referenced this pull request Feb 21, 2026
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