-
Notifications
You must be signed in to change notification settings - Fork 67
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
Poor precision in BinomialDistribution for probability & logProbablilty #166
Comments
My bet is naive error estimation. It always fails somewhere in parameter space. I'll check it out |
Playing a bit binomial distribution shows that yes. It's a bug. Ironically test failure happens in region where algorithm performs tolerable. |
It turns out main contribution to error comes from binomial coefficient. |
I took second look. For probability main contribution to error is term In the meantime I just increased error tolerance. test should not fail any more. |
This should fix failure found in #166: log probabilty check: FAIL *** Failed! Falsified (after 34 tests): binomial 79 9.83897381493678e-2 7 probability = 0.14935400356648396 logProbability = -1.9014359280741342 log p = -1.9014359280741266 eps = 3.970429114115656e-15 It turns out that main contribution to error in probability is (1-p)^(n-k) and for logProbability we subtract values of same magnitude with usual consequences for precision
@Shimuuar Thanks for your work on this! This sounds like a regression, if so, does it make sense to open a low priority bug on that? wrt to your comment above on pow1p, it would be nice if the package math-functions had pow1p. When I have a chance I'll file an ER for that and update this. I guess the ER will be to start with pow1p and ultimately add everything IEEE recommends, as listed in JuliaLang/julia#6148. BTW do you know of any library that has implementations? https://www.gnu.org/software/gsl/doc/html/math.html has some. |
statistics-0.16.2.1 on aarch64-darwin:
Full log – I don't expect it's interesting and might be overwritten by retries of exactly the same build, but let me link it: https://cache.nixos.org/log/b7pzjh4s2dh41zgiwb9mvl0qky945xj6-statistics-0.16.2.1.drv |
A recent built on the nixos build server hydra failed with this error for
statistics-0.15.2.0
:My best guess is, that this is not indicative of a bug in the library. Maybe the eps is to small?
I don‘t assume that this is the result of linking against a wrong library version or something, i.e. a issue in nixpkgs. But please enlighten me.
The text was updated successfully, but these errors were encountered: