Remove automatic normalization in Multinomial and Categorical #5246
Replies: 5 comments 2 replies
-
I'm in favour of this. Explicit is better than implicit! |
Beta Was this translation helpful? Give feedback.
-
I think this caused some problems e.g. if you a user specifies |
Beta Was this translation helpful? Give feedback.
-
Perhaps have a normalization tolerance, where for example [.33, .33, .33] gets normalized but more egregious values raise an exception? Then at least the user has to be explicit about how close they allow themselves to be. |
Beta Was this translation helpful? Give feedback.
-
The tolerance can be adjusted with |
Beta Was this translation helpful? Give feedback.
-
Here is an idea. Whenever the user creates a Multinomial / Categorical distribution with concrete (numpy) values we check if they are valid and if not we normalize them but also issue a UserWarning along the lines of:
In the logp or whenever we have symbolic inputs we don't do any invisible normalization, and let it evaluate to -inf as with invalid parameters in other distributions. I think this covers most of the user cases and does not have big backwards compat issues. |
Beta Was this translation helpful? Give feedback.
-
This cropped up in #5234
Should we stop doing automatic normalization of the p parameter? This can hide very wrong inputs such as
If we decide to keep the automatic normalization, we can at least remove some checks in the logp definition, since they cannot be triggered in this case.
Beta Was this translation helpful? Give feedback.
All reactions