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

Add laplace and pathfinder approximate inference #624

Merged
merged 6 commits into from
Mar 25, 2024
Merged

Add laplace and pathfinder approximate inference #624

merged 6 commits into from
Mar 25, 2024

Conversation

sbfnk
Copy link
Contributor

@sbfnk sbfnk commented Mar 22, 2024

Description

This PR closes #403.

It adds laplace and pathfinder approximations when the cmdstanr backend is used. Will need a bit more testing but they both seem more robust than the standard variational inference version. If this is confirmed we could add a note to e.g. one of the vignettes to say that these could be used to get an approximate idea before running exact inference for production.

fit_model_with_vb has been re-used and re-named for this but as it was really an internal function I didn't start a deprecation cycle.

Initial submission checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have tested my changes locally (using devtools::test() and devtools::check()).
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required and rebuilt docs if yes (using devtools::document()).
  • I have followed the established coding standards (and checked using lintr::lint_package()).
  • I have added a news item linked to this PR.

After the initial Pull Request

  • I have reviewed Checks for this PR and addressed any issues as far as I am able.

Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 9545b8a is merged into main:

  • ✔️default: 35.7s -> 37.2s [-12.19%, +20.85%]
  • ✔️no_delays: 40.6s -> 41.2s [-10.54%, +13.33%]
  • ✔️random_walk: 10.6s -> 10.4s [-10.38%, +6.58%]
  • ✔️stationary: 32.6s -> 2.18m [-460.69%, +1061.34%]
  • ✔️uncertain: 54.9s -> 56.3s [-11.61%, +16.48%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

seabbs
seabbs previously approved these changes Mar 22, 2024
Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

LGTM. I think marking them as experimental (as they are) is good enough

Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 93c072d is merged into main:

  • ✔️default: 38.9s -> 36.3s [-26.48%, +13.22%]
  • 🚀no_delays: 45.5s -> 40.7s [-19.86%, -1.14%]
  • ✔️random_walk: 10.1s -> 10.3s [-6.11%, +10.12%]
  • ✔️stationary: 23.2s -> 20.3s [-32.85%, +8.2%]
  • ✔️uncertain: 56.7s -> 59s [-5.68%, +13.47%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if e9eab37 is merged into main:

  • ✔️default: 33.5s -> 35.6s [-12.79%, +25.33%]
  • ✔️no_delays: 44.4s -> 43s [-19.21%, +12.73%]
  • ✔️random_walk: 18.6s -> 11.1s [-143.06%, +62.31%]
  • ✔️stationary: 22.5s -> 21.6s [-17.33%, +9.83%]
  • ✔️uncertain: 1.01m -> 55.7s [-24.15%, +8.32%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if f7ded41 is merged into main:

  • ❗🐌default: 32.8s -> 40.5s [+6.17%, +40.74%]
  • ✔️no_delays: 41.8s -> 45.5s [-1.7%, +19.55%]
  • ✔️random_walk: 9.68s -> 10s [-6.57%, +13.59%]
  • ✔️stationary: 19.5s -> 21.2s [-4.33%, +22.22%]
  • ✔️uncertain: 55.3s -> 59.7s [-9.26%, +24.93%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 5a27186 is merged into main:

  • 🚀default: 36s -> 30.9s [-25.72%, -2.47%]
  • ✔️no_delays: 42.7s -> 42.2s [-13.57%, +11.09%]
  • ✔️random_walk: 9.66s -> 10.1s [-5.86%, +15.77%]
  • ✔️stationary: 22.5s -> 19.8s [-45.05%, +21.26%]
  • ✔️uncertain: 1.08m -> 52.2s [-68.55%, +29.13%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@sbfnk sbfnk marked this pull request as ready for review March 25, 2024 17:24
@sbfnk sbfnk merged commit ca3ae0d into main Mar 25, 2024
14 checks passed
@sbfnk sbfnk deleted the laplace branch March 25, 2024 20:00
sbfnk added a commit that referenced this pull request May 3, 2024
* add laplace algorithm

* add pathfinder algorithm

* actually use pathfinder

* label as experimental

* fix tests
sbfnk added a commit that referenced this pull request May 3, 2024
* add laplace algorithm

* add pathfinder algorithm

* actually use pathfinder

* label as experimental

* fix tests
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.

Optimisation
2 participants