-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Fixing propto tests in probability test framework #1764
Conversation
…f always picking the 0th parameter (Issue #1763)
This makes the prop tests for |
This is not an exhaustive list, but also |
Good catch. I think the check here: https://github.com/stan-dev/math/blob/develop/test/prob/test_fixture_distr.hpp#L254 Needs changed from:
to:
This just checks to make sure the two numbers are within 1e-12 of each other (absolute tolerance). With this in place only negative binomial fails. |
You might need `value_of_rec` to get down to a`double` value from an
arbitrary autodiff variable.
…On Fri, Mar 6, 2020 at 2:11 PM Ben Bales ***@***.***> wrote:
Good catch. I think the check here:
https://github.com/stan-dev/math/blob/develop/test/prob/test_fixture_distr.hpp#L254
Needs changed from:
EXPECT_TRUE(reference_logprob_false - logprob_false
== reference_logprob_true - logprob_true)
to:
EXPECT_NEAR(value_of(reference_logprob_false - reference_logprob_true),
value_of(logprob_false - logprob_true), 1e-12)
This just checks to make sure the two numbers are within 1e-12 of each
other (absolute tolerance).
With this in place only negative binomial fails.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1764?email_source=notifications&email_token=AAZ2D757ZHUEFKCN266SSNTRGFDHDA5CNFSM4LCUTQKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOCPROI#issuecomment-595916985>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZ2D75CSUXMOUSEZZ7CNS3RGFDHDANCNFSM4LCUTQKA>
.
|
Great! I went back as far as 2.18.1 and the |
I suspect the negative binomial is something @martinmodrak might know about. He got super deep on these functions a while back. I asked a question over here: #1497 (comment). |
Yes, I believe the problem might be fixed with the new code, which, unfortunately, got a bit stuck, will try to move it forward a bit. |
@martinmodrak I removed the poisson stuff from neg_binomial in this branch and then updated the numerics a bit. I'm not sure I did it right though. Mind taking a look when you get the chance (no hurry)? For
R gives me:
with this code:
Develop math was giving:
So we improved but I'm not sure it's fixed yet. |
…to neg_binomial (Issue #1763)
…4.1 (tags/RELEASE_600/final)
@martinmodrak with these values:
Can you run the code with lots of precision in Mathematica and tell me the result:
I'm trying to figure out how off the version of |
…tan-dev/math into bugfix/issue-1763-propto-tests
@bbbales2 Unfortunately, Mathematica (at least the free version available in Wolfram Cloud) refuses to compute this (allowed computation time exceeded).... To test for those big values of |
The raspberry pi has Mathematica freely available, I tested with those values (may have done it wrong, not at all familiar with mathematica) to 20 decimals:
|
@martinmodrak @andrjohns thanks! What we have in this branch is: -2.6185576442208003 I'll look into the n = 0 / n = 1 thing. I just wanted a spot check that things weren't totally awry. The big fix was dropping the Poisson like @martinmodrak did previously so I think we're probably better off already. |
…ng constants (Issue #1763)
…4.1 (tags/RELEASE_600/final)
…tan-dev/math into bugfix/issue-1763-propto-tests
…4.1 (tags/RELEASE_600/final)
…tan-dev/math into bugfix/issue-1763-propto-tests
…4.1 (tags/RELEASE_600/final)
I added an n = 0 and n = 1 comparison against long double calculations to the tests but I only compared with EXPECT_FLOAT_EQ so it's not really testing for much precision. The numbers are (printed out to 17 digits):
|
Are we targeting this for the release? Given that its a test it probably doesnt matter? |
@rok-cesnovar it's bugfixes, so I wasn't worried about the feature freeze. If it passes it's ready for review though. |
Oh right. Yeah its a bug fix definitely. |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
@andrjohns @SteveBronder this is ready to be reviewed. There's three things going on here:
|
I can review this one tonight |
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.
Mostly comments on the ordering of some of the calcs, and some basic q's around the tests. Otherwise looks great!
I didn't check the any of the numerics, since I assumed the approach was reviewed in Martin's original PR (plus the tests are passing)
…tan-dev/math into bugfix/issue-1763-propto-tests
…ges I forgot previously (Issue #1763)
…4.1 (tags/RELEASE_600/final)
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
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.
All looks good to me, merge when ready
This solves issue #1763
Tests
This is a bugfix to a function in the test framework. I did not add any tests for this. Do we have tests for the probability test framework?
Release Notes
Fixed propto tests in probability test framework (and fixed bugs this revealed in
neg_binomial_lpdf
andpareto_type_2_lpdf
).Checklist
Math issue propto tests not testing the correct things in probability unit tests #1763
Copyright holder: Columbia University
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested