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

Improve efficiency of model methods, tidy code #960

Merged
merged 3 commits into from
May 5, 2024

Conversation

andrjohns
Copy link
Collaborator

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

As flagged in #920, unconstraining variables in cmdstanr was much slower than rstan. This was because the current implementation had an unnecessary write-to-disk before calling the method (a rookie mistake of mine).

I've updated the unconstrain_variables() method to pass the variables to c++ directly and also added a corresponding c++ implementation for unconstrain_draws(), to avoid looping in R.

I've also moved the hessian implementation to using the finite-diff method and being compiled by default with the model-methods, I don't think it was worth it having it be separate and possibly not being able to compile with some Stan code

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Andrew Johnson

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.25%. Comparing base (1b45e70) to head (fadf5dd).
Report is 92 commits behind head on master.

❗ Current head fadf5dd differs from pull request most recent head d34b77e. Consider uploading reports for the commit d34b77e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #960      +/-   ##
==========================================
- Coverage   88.33%   86.25%   -2.09%     
==========================================
  Files          12       13       +1     
  Lines        4553     4714     +161     
==========================================
+ Hits         4022     4066      +44     
- Misses        531      648     +117     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrjohns andrjohns merged commit c4d6e80 into master May 5, 2024
10 of 11 checks passed
@andrjohns andrjohns deleted the model-methods-speedup branch May 5, 2024 20:36
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.

2 participants