-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Eliminate less than and greater than comparisons for UFloat
#278
Comments
That law applies to real numbers. UFloats are not real numbers. One should not expect that to apply to complex numbers, classes, or UFloats. Nominal values (and std_dev) are real numbers. That law should apply. And it does. I would assume that most people would expect Less than and greater than are more troublesome. It seems okay for these to always return |
This expectation is incorrect (not sure if that is what you were trying to point out?). From the docs:
because
Yeah so right now these return One big question is how painful would this change be for users? It's hard for me to know... Recovery would probably be pretty simple if what the user is really wanting to do is a comparison on the nominal value. We could deprecate the |
Yes, yes, I do understand that. I think that most people will find this current behavior of "==" to be confusing. The hidden correlation with Worse, any comparison with ">" or "<" is basically to "impossible to decide". It could be "always False", or it could raise a TypeError (citing the precedent of complex numbers). With
the ambiguity would be pretty clear, but
seems weird. That probably argues for preferring "raise TypeError". If that were the case, then "raise TypeError" for "==" and "!=" would then also be defensible....and probably no more confusing than the current situation ;). But to come back to the main topic: yeah, the law of trichotomy does not apply. It does not apply to complex numbers, sets, vectors, etc. There is no reason to expect it to apply to UFloats. |
... and also ... or maybe to summarize: |
@newville ok, I can't tell if I'm fully following your points or not but I think I am. You are pointing out
So I agree with everything you are saying. Here is what I'm proposing for
This proposal is fully guided by the principle that It is NOT standard to define any partial or total order Technical note: If |
@jagerber48 I am OK with |
It seems like the consensus is to keep the current I mentioned in #283 that there is the question of how much a |
The user guide already calls out this strange behavior
That is, the order established on
UFloat
objects does not obey the law of trichotomy that you would expect to be followed by a strict total order.In the new post #262 framing,
UFloat
s are considered to model random variables. For random variables we talk about equality in distribution. This means that comparing nominal values, or even nominal values and standard deviations, does not suffice to establish equality. Rather twoUFloat
s should only be equal if they give the same weights to the same atomic units of uncertainty (UAtom
s).This means that comparing nominal values shouldn't suffice to establish greater than or less than relations either. When working with random variables I don't think it is typical to establish an ordering on random variables. So I propose
uncertainties
doesn't try to do so. If users want to know if the mean of some random variable passes some fixedfloat
threshold (including the mean of some otherUFloat
) then I suggest they explicitly indicate that by extracting thenominal_value
from theUFloat
they are working with.Thoughts? Opinions?
The text was updated successfully, but these errors were encountered: