-
Notifications
You must be signed in to change notification settings - Fork 425
Simplify implementation and tests in #1534 #1555
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
Conversation
@matbesancon Tests all pass it seems, with Julia 1.3, 1.7, and nightly. |
* constructor frule * frule tested * rrule tests * logpdf test * signature for conflict * TestUtils out of Project * ChainRules itself not needed (yet?) * remove checkarg * Update src/multivariate/dirichlet.jl Co-authored-by: David Widmann <[email protected]> * Update test/dirichlet.jl Co-authored-by: David Widmann <[email protected]> * Update test/dirichlet.jl Co-authored-by: David Widmann <[email protected]> * Update test/dirichlet.jl Co-authored-by: David Widmann <[email protected]> * Update src/multivariate/dirichlet.jl Co-authored-by: David Widmann <[email protected]> * conflict * eltype instability * single loop * fix tests * forward finite diff * switch to broadcast * fix broadcast * switch off-support value to NaN * Update src/multivariate/dirichlet.jl Co-authored-by: David Widmann <[email protected]> * Update src/multivariate/dirichlet.jl Co-authored-by: David Widmann <[email protected]> * do not assume inplace * fixed temp * Simplify implementation and tests in #1534 (#1555) * Simplify implementation and tests * Precompute `digamma(alpha0)` * Relax type signature Co-authored-by: David Widmann <[email protected]>
fwiw, running something completely different these tests were failing in 1.6, though all passing in 1.8: In 1.6:
Is this an RNG issue, or something tied up with the julia version? If this diagnosis is correct, assuming it's the former, and if chainrules are going to start being added here, It may be worth specifying the tangents in the the
|
Since tests pass (see e.g. #1606) I don't see any reason to tweak seeds right now. If it becomes necessary, we could possibly specify a seed but that is also not guaranteed to yield the same random numbers on different Julia versions (and OS IIRC). (BTW |
Possibly finite differencing fails for some unfortunate cases. We could maybe also try to pick values that are further away from zero or tweak the finite differencing method. |
Good points. I was considering the cases where adding in other unrelated testsets can change the RNG and I'd actually forgotten testset resets the seed, so this is essentially equivalent. For version changes, technically StableRNGs.jl could be used, but for here I also now don't see any particular reason to go out of the way to tweak. I just happened to be using the wrong version of julia when playing around with what I was working on when testing :) |
@matbesancon This PR simplifies the implementation and tests in #1534. It also makes the code a bit more consistent with the conventions in ChainRules, fixes some type stability issue, and simplifies the handling of non-finite values in
_logpdf
.Tests pass locally with Julia 1.7 and JuliaDiff/ChainRulesTestUtils.jl#247.
Edit: The CRTU PR was merged and released.