categorical does not validate probabilities #687
Replies: 4 comments
-
The multinomial does some checks for unit probabilities, but also does not check that they sum up to one, and does this: atr.multinomial(100, [0, 0, 0, 0]).eval() # array([ 0, 0, 0, 100]) |
Beta Was this translation helpful? Give feedback.
-
This is the same behavior as NumPy: import numpy as np
np.random.multinomial(100, [0, 0, 0, 0])
# array([ 0, 0, 0, 100]) More importantly, don't forget that we cannot do input validation that can only be done with concrete/non-symbolic input values. At best, such validation could only be done under very narrow circumstances (e.g. all the inputs are Otherwise, it's not clear what this issue is about/requesting, so I'm going to close it for now, and we can reopen it once that's clarified. |
Beta Was this translation helpful? Give feedback.
-
That still does not justify the categorical examples. I understand there is a trade-off between input validation and speed, but I am specially surprised that the categorical can return values larger than the support domain as in my second example. That was an extreme case, but it can happen whenever the cdf sums to something less than 1. Obviously any input validation (if justified) would have to be done during Reopening just for discussion of the categorical case. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I don't particularly like that output either, but we need to be clear about the scope of this project, and it doesn't include making voluntary improvements to NumPy/SciPy—especially not ones that should be brought to NumPy/SciPy first. These Don't forget that one is able to make their own Another thing to remember is that all these validation ideas that involve changes to Aesara (or any other core libraries) have a few inherent downsides: e.g. they add steps to places in code that are called frequently and can be much more difficult to disable than they would be under a different approach. For instance, if a user knows that input validation isn't needed and we add it into a basic Instead of making strong choices for the users and bringing that complexity into Aesara, we can focus on making our |
Beta Was this translation helpful? Give feedback.
-
The categorical seems to do a simple draw from the inverse cdf, and is oblivious to invalid probabilities,
Beta Was this translation helpful? Give feedback.
All reactions