RandomVariables raise ValueError when size would broadcast parameter #1044
Replies: 3 comments 6 replies
-
You can check the |
Beta Was this translation helpful? Give feedback.
-
I disagree with converting this to a discussion. The original example clearly shows a different interpretation/inconsistency between the meaning of size in univariate and multivariate distributions. These checks were introduced by the PR that intended to harmonize the meaning across the two classes of distributions. It also shows the distinct interpretation being used for the univariate categorical distribution that just so happens to require a vector parameter. It looks like (the independent dimensions of parameters) should be allowed to broadcast to size. If not, the last example with the normal should also fail (and similar checks should be introduced to all existing univariate distributions). |
Beta Was this translation helpful? Give feedback.
-
This could simply be a bug in the current implementation of |
Beta Was this translation helpful? Give feedback.
-
We have a common check in multivariate distributions (+ categorical), that raises when a non-size is not strictly equal to the batched dimensions of the parameters, saying objects cannot be broadcast to a single shape.
aesara/aesara/tensor/random/basic.py
Lines 377 to 383 in 510a961
I don't know why we are imposing this limitation. Even if there is a good reason, the message is wrong, because the batched shapes may very well be broadcastable to size:
The message for the CategoricalRV is more accurate:
aesara/aesara/tensor/random/basic.py
Lines 651 to 652 in 510a961
However I still don't get why we would not broadcast the parameter to match size, when this is would be valid. Otherwise, the following should also be invalid, no?
Beta Was this translation helpful? Give feedback.
All reactions