-
Notifications
You must be signed in to change notification settings - Fork 422
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
Expand the testing coverage using R as the reference #414
Conversation
Good call |
- Erlang - FDist - Gamma - Normal - NormalCanon - TDist - Uniform
Thanks for all of your work here, @lindahua, this is great. Glad to see you around these parts again. 🙂 |
This PR is ready, and passed all tests in my machine. Now almost all distributions have been covered by this R-based reference framework, including many distributions that were not available in scipy, e.g. Generalized Extreme Value, Beta Binomial, Noncentral Beta/Chi squared/F/T, Noncentral Hypergeometric, Normal Inverse Gaussian, and Von Mises, etc. Also, with the new test cases, several bugs have been found and fixed. A readme describing this testing framework was provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR. Thanks for that and good to see you back here. Just two minor comments though I haven't reviewed the R part.
end | ||
|
||
kurtosis{T<:Real}(d::TriangularDist{T}) = T(-3)/5 | ||
|
||
entropy(d::TriangularDist) = 1//2 + log((d.b - d.a) / 2) | ||
entropy(d::TriangularDist) = 0.5 + log((d.b - d.a) / 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't use Float64
literal here to avoid promoting e.g. Float32
input. Maybe one(d.b)/2
.
@@ -82,12 +82,12 @@ end | |||
|
|||
function skewness(d::TriangularDist) | |||
(a, b, c) = params(d) | |||
sqrt2 * (a + b - 2c) * (2a - b - c) * (a - 2b + c) / (5 * _pretvar(a, b, c)^3//2) | |||
sqrt2 * (a + b - 2c) * (2a - b - c) * (a - 2b + c) / (5 * _pretvar(a, b, c)^1.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@andreasnoack Fix per your comments. |
The failures on master are because of JuliaLang/julia#20344 |
Currently, we use Python's Scipy package as a reference to verify the correctness of our implementation of distributions.
However, Scipy only provides a limited coverage of what we currently have. This PR aims to expand the coverage of our testing by switching to using R as our reference. R, together with the packages in CRAN, can cover most (if not all) of the distributions.