-
Notifications
You must be signed in to change notification settings - Fork 1
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
Strong machine dependence of spey results (simplified likelihoods) #23
Comments
Thanks @WolfgangWaltenberger; in the future, can you also report the machines that you observe the difference so that I can try to find the exact machine configuration? Note that if I don't have access to the machine I won't be able to replicate the issue :/ This particular issue seems to be related to machine precision and optimiser performance tagged to it. Is this solved for other Scipy versions? Also, this might be due to Python 3.11, I haven't tested Spey with 3.11 yet. The ultimate solution may be adding an iminuit optimiser, but that will take some time to implement. |
Hey Jack, I can try and give you all that info. That said, statements "if floating_variable != specific_value:" are clearly, undoubtedly, horribly wrong. In this case, this is the culprit. It seems a given that it is not python 3.11, or a specific version of scipy or any of this. I can give you all the version numbers, but are you sure this is helping in any way? All digits of 64-bit floats after the 16th are a lottery. There will be other machine dependent results coming up that require all these versions, don't you worry ;) |
Hi @WolfgangWaltenberger, if your solution solves it for all the machines I can definitely add it or maybe add a clip on the mu value? Let me know if there is a one-fits-all type of solution and I'll update the release ASAP. |
All that said: |
How about sigma_mu = self.sigma_mu(muhat, expected=expected) if not np.isclose(muhat, 0.0) else 1.0 |
Hi @WolfgangWaltenberger, I also implemented the update within the
Can you please confirm this on your side as well? |
This is a realistic example, the data are from CMS-SUS-20-004, testing a very average simplified model point. So, eUL being 4 orders of magnitude bigger than oUL is absolutely impossible. The values I gave above were realistic. I will try to |
Maybe the issue is originating from an earlier step? perhaps, |
Now I am the one who cannot reproduce. Using your patch I get on one machine |
HI @WolfgangWaltenberger, I need a more specific issue. I compared the tool with the previous application (including Bill's version) and got the same result. If you can point out what needs to be changed, I can implement it accordingly. Otherwise, I'm afraid I don't know how to help here. |
@WolfgangWaltenberger is there any update on this? or is it solved? |
System Settings
Describe the bug
The simplified likelihoods in spey show some strong machine dependence. E.g. the code snippet below sometimes produce the correct:
spey oUL(mu)=0.2842
on other machines -- same versions of spey, autograd, scipy, numpy -- it produces e.g.:
spey oUL(mu)=0.0000
I traced back the problem, it is imho due to hypotest_base.py around line 892:
sigma_mu = self.sigma_mu(muhat, expected=expected) if muhat != 0.0 else 1.0
on the machines with the right result muhat = 0.0, therefore sigma_mu becomes 1.0
on the problematic machines muhat = 4e-24 != 0.0, sigma_mu becomes 1.4e-21 and the low_init, hi_init bracket becomes super small, the ul is not found.
I think, muhat != 0.0 has to be replaced with a floating-point-correct (in-)equality comparison operation.
Source code
Tracebacks
No response
Expected behaviour
spey oUL(mu)=0.2842
spey eUL(mu)=0.3516
which is the result obtained on those machines that just happen to compute muhat to be == 0.0.
Additional information
This is for sure not the only part of spey that is machine dependent. However, one step at a time. Expect more
such trouble tickets in the future.
Existing GitHub issues
The text was updated successfully, but these errors were encountered: