Skip to content

Conversation

@bbbales2
Copy link
Member

@bbbales2 bbbales2 commented Sep 15, 2020

This is the replacement for #1989

Fixes #1861 and #1978

This also adds similar tests to prevent problems with the log ccdf and cdf functions.

Release notes

Added more tests for vectorized probability functions

Checklist

… log cdf, and a log ccdf (previously was just testing f([a, b, c, d], Issue #1861)
@bbbales2 bbbales2 requested a review from t4c1 September 15, 2020 04:07
Copy link
Contributor

@t4c1 t4c1 left a comment

Choose a reason for hiding this comment

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

For now I just reviewed the first file. Others look similar and I have a number of questions. So I will review the rest after this makes sense to me.

@bbbales2
Copy link
Member Author

@t4c1 ready for review again, though we might want to wait for tests to pass again since we're checking more things now that I enabled the fvar stuff you pointed out.

@t4c1
Copy link
Contributor

t4c1 commented Sep 17, 2020

@bbbales2 You have some failed tests here

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 4.2 4.17 1.01 0.7% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.99 -0.76% slower
eight_schools/eight_schools.stan 0.09 0.09 1.0 0.12% faster
gp_regr/gp_regr.stan 0.18 0.18 1.0 0.15% faster
irt_2pl/irt_2pl.stan 6.57 6.54 1.0 0.42% faster
performance.compilation 91.18 87.02 1.05 4.55% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.31 8.39 0.99 -0.93% slower
pkpd/one_comp_mm_elim_abs.stan 31.76 29.06 1.09 8.49% faster
sir/sir.stan 128.67 131.34 0.98 -2.08% slower
gp_regr/gen_gp_data.stan 0.05 0.05 1.04 3.55% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.29 3.39 0.97 -2.93% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.4 0.42 0.96 -4.5% slower
arK/arK.stan 2.59 1.83 1.42 29.46% faster
arma/arma.stan 0.74 0.97 0.76 -32.1% slower
garch/garch.stan 0.73 0.73 1.0 0.26% faster
Mean result: 1.01733233109

Jenkins Console Log
Blue Ocean
Commit hash: ebc5432


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

Copy link
Contributor

@t4c1 t4c1 left a comment

Choose a reason for hiding this comment

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

There were a number of changes since the last review, so I am again stopping at first file.

"gradients";
for (size_t i = 0; i < single_gradients2.size(); ++i)
EXPECT_NEAR(single_gradients2[i], multiple_gradients2[i], 1e-7)
<< "scalar and vectorized results should have the same first order "
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<< "scalar and vectorized results should have the same first order "
<< "scalar and vectorized results should have the same second order "

Copy link
Contributor

Choose a reason for hiding this comment

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

While this simplifies the code, the error message loses the information which variable has wrong gradient.

Copy link
Member Author

Choose a reason for hiding this comment

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

This error information wasn't printed anywhere anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, right I added it in #2082, but it is not merged yet. Could you print it? That is very useful info for debugging. (since it is not in yet lets make this optional)

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a minor note: you might want to use expect_near_rel for inexact comparisons - we thought a bit about good logic for this type of comparisons and also it works out of the box for vector/matrix arguments (see e.g. #1656)

Copy link
Member Author

Choose a reason for hiding this comment

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

@martinmodrak switched to expect_near_rel and life did get easier, thanks for rec.

Copy link
Member Author

@bbbales2 bbbales2 left a comment

Choose a reason for hiding this comment

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

Comment

Copy link
Member Author

@bbbales2 bbbales2 left a comment

Choose a reason for hiding this comment

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

Comment

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.59 3.56 1.01 0.68% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.99 -1.33% slower
eight_schools/eight_schools.stan 0.12 0.12 1.03 2.73% faster
gp_regr/gp_regr.stan 0.18 0.18 1.0 -0.31% slower
irt_2pl/irt_2pl.stan 5.66 5.63 1.01 0.54% faster
performance.compilation 90.99 88.99 1.02 2.19% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 9.13 9.11 1.0 0.21% faster
pkpd/one_comp_mm_elim_abs.stan 28.64 28.96 0.99 -1.13% slower
sir/sir.stan 133.83 141.55 0.95 -5.77% slower
gp_regr/gen_gp_data.stan 0.04 0.05 0.99 -1.51% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.2 3.16 1.01 1.21% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.37 0.38 0.98 -1.79% slower
arK/arK.stan 2.56 2.57 1.0 -0.45% slower
arma/arma.stan 0.75 0.75 1.01 0.63% faster
garch/garch.stan 0.65 0.65 1.0 0.07% faster
Mean result: 0.997680207726

Jenkins Console Log
Blue Ocean
Commit hash: 500a870


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 Author

bbbales2 commented Oct 2, 2020

Green check green check green check! Man that feels good

@t4c1 t4c1 merged commit 6318a19 into develop Oct 5, 2020
@rok-cesnovar rok-cesnovar deleted the bugfix/issue-1861-2 branch October 5, 2020 07:46
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.

Probability test framework didn't catch bug with vectorization

5 participants