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

Reuse intermediate computations in distributions part 1 #1744

Merged
merged 2 commits into from
Feb 28, 2020

Conversation

mcol
Copy link
Contributor

@mcol mcol commented Feb 25, 2020

Summary

This is the first of a few PRs that aim to clean up the distributions so that we make better use of intermediate computations and composed functions.

This covers the following distributions:

  • bernoulli
  • bernoulli_logit_glm
  • beta
  • beta_binomial
  • beta_proportion
  • binomial
  • double_exponential
  • exponential
  • exp_mod_normal

Tests

None, this is just cleanup.

Side Effects

None.

Checklist

  • Math issue: Make use of composed functions and temporaries #1230

  • Copyright holder: Marco Colombo

    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

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 4.83 5.06 0.95 -4.74% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.99 -1.02% slower
eight_schools/eight_schools.stan 0.09 0.09 1.0 0.02% faster
gp_regr/gp_regr.stan 0.22 0.22 0.99 -1.34% slower
irt_2pl/irt_2pl.stan 6.1 6.24 0.98 -2.3% slower
performance.compilation 89.65 86.97 1.03 2.98% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 7.49 7.79 0.96 -3.93% slower
pkpd/one_comp_mm_elim_abs.stan 20.77 20.87 1.0 -0.46% slower
sir/sir.stan 89.13 91.07 0.98 -2.18% slower
gp_regr/gen_gp_data.stan 0.05 0.05 0.98 -1.84% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.97 3.08 0.96 -3.83% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.32 0.32 1.03 2.5% faster
arK/arK.stan 1.72 1.74 0.99 -1.06% slower
arma/arma.stan 0.76 0.77 1.0 -0.41% slower
garch/garch.stan 0.63 0.63 1.0 0.43% faster
Mean result: 0.989115739917

Jenkins Console Log
Blue Ocean
Commit hash: 594a56e


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

@mcol
Copy link
Contributor Author

mcol commented Feb 26, 2020

@SteveBronder Is this something you'd like to tackle?

@rok-cesnovar
Copy link
Member

If Steve is busy, I can tackle this one tomorrow.

@SteveBronder
Copy link
Collaborator

Idt I'll have time today but I will have time tmrw!

Though looking at this I think @bbbales2 or other people better at stats stuff would be a better candidate to review this

@bbbales2
Copy link
Member

bbbales2 commented Feb 27, 2020

I'll do this tomorrow. Thanks for ping.

Edit: Also careful with compliments. I'm superstitious on these pull reqs. I don't want a stats ghost to come haunt this and challenge my lowly skillz.

@mcol
Copy link
Contributor Author

mcol commented Feb 27, 2020

Not much stat going on, only reshuffling of terms. When diffs are nice it's quite straightforward... but that's not often the case! :)

Copy link
Member

@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.

Looks good!

@bbbales2 bbbales2 merged commit 3315de8 into develop Feb 28, 2020
@mcol mcol deleted the cleanup/1230-better-intermediates-prob-p1 branch February 28, 2020 15:59
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