Skip to content
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

Fix dirichlet_lpdf and multi_normal_cholesky_lpdf adjoints #2331

Merged
merged 3 commits into from
Jan 23, 2021

Conversation

t4c1
Copy link
Contributor

@t4c1 t4c1 commented Jan 22, 2021

Summary

Fixes a bug in dirichlet_lpdf and multi_normal_cholesky_lpdf, where some overloads (ones that do broadcasting) produced wrong derivatives. The bug appeared with generalizations of the functions, so it is also present in the last release.

Tests

As far as I can see there is no test for dirichlet_lpdf that would check adjoints (ouch). Tests for multi_normal_cholesky_lpdf seem as if they should catch that, but they are quite complicated and I can't really make sense of them.

@bbbales2 can I recruit you for writing appropriate tests for this?

Side Effects

None.

Release notes

Fixed a bug in dirichlet_lpdf and multi_normal_cholesky_lpdf, where some overloads (ones that do broadcasting) produced wrong derivatives.

Checklist

@bbbales2
Copy link
Member

Yeah sure on my list. Good catch.

@wds15
Copy link
Contributor

wds15 commented Jan 22, 2021

wow! the last working version of the multivariate normal was in 2.24.1 ! Test, test, test, test... please, please, please :)

…o added multi_normal tests for the same, but there was no bug) (Issue stan-dev#2332)
@bbbales2
Copy link
Member

bbbales2 commented Jan 22, 2021

Yoyo, I have fixes, but it's not letting me push to the bstatcomp repo. I thought the pull requests to this repo granted push privileges in the source branch?

There is a branch with tests here: develop...fix_multivar_adjoints

Edit: @rok-cesnovar gave me permissions so I pushed the changes here now.

I originally added tests in the multi_normal thing too. I just left them cause it's not gonna hurt to have them. We'll need to add the ability to test these vectorized things in the varmat tests separately.

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.39 3.38 1.0 0.22% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.96 -4.54% slower
eight_schools/eight_schools.stan 0.11 0.11 1.01 0.89% faster
gp_regr/gp_regr.stan 0.15 0.15 1.0 -0.11% slower
irt_2pl/irt_2pl.stan 5.21 5.23 1.0 -0.35% slower
performance.compilation 92.84 90.54 1.03 2.48% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.62 8.65 1.0 -0.35% slower
pkpd/one_comp_mm_elim_abs.stan 28.38 28.74 0.99 -1.29% slower
sir/sir.stan 135.45 127.9 1.06 5.57% faster
gp_regr/gen_gp_data.stan 0.04 0.04 1.01 1.25% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.05 3.07 0.99 -0.56% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.38 0.41 0.91 -9.29% slower
arK/arK.stan 1.81 1.82 0.99 -0.53% slower
arma/arma.stan 0.61 0.61 1.0 0.25% faster
garch/garch.stan 0.59 0.59 1.0 -0.04% slower
Mean result: 0.996689438063

Jenkins Console Log
Blue Ocean
Commit hash: 125a4e1


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

@bbbales2
Copy link
Member

@rok-cesnovar @SteveBronder ready for review (and this is a bugfix for the release)

Copy link
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to both!

@rok-cesnovar rok-cesnovar merged commit 575d3f0 into stan-dev:develop Jan 23, 2021
@rok-cesnovar rok-cesnovar deleted the fix_multivar_adjoints branch January 23, 2021 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants