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

Issue #362: Reduce dependence on cmdstanr #424

Merged
merged 27 commits into from
Nov 14, 2024
Merged

Issue #362: Reduce dependence on cmdstanr #424

merged 27 commits into from
Nov 14, 2024

Conversation

athowes
Copy link
Collaborator

@athowes athowes commented Nov 6, 2024

Description

This draft PR explores #362.

Checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have included the target issue or issues in the PR title in the for Issue(s) issue-numbers: PR title
  • I have read the contribution guidelines.
  • I have tested my changes locally.
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required.
  • My code follows the established coding standards.
  • I have added a news item linked to this PR.
  • I have reviewed CI checks for this PR and addressed them as far as I am able.

R/fit.R Outdated Show resolved Hide resolved
@athowes athowes linked an issue Nov 7, 2024 that may be closed by this pull request
@athowes
Copy link
Collaborator Author

athowes commented Nov 11, 2024

Fitting a model with cmdstanr then it contains the posterior draws. Fitting it with rstan then it doesn't. Need to change our functionality which interfaces with e.g. brms::prepare_predictions to be agnostic. How does brms achieve this? If it's fit with rstan then there is an extra step?

@athowes

This comment was marked as outdated.

@athowes
Copy link
Collaborator Author

athowes commented Nov 13, 2024

@seabbs to look at then discuss.

@athowes athowes force-pushed the reduce-cmdstanr-dep branch from 2db875e to 03f4971 Compare November 13, 2024 16:21
@seabbs
Copy link
Contributor

seabbs commented Nov 13, 2024

@athowes as you can tell from the commits I have started to look at this will circle back once I have made more progress

@seabbs seabbs marked this pull request as ready for review November 14, 2024 13:15
@seabbs
Copy link
Contributor

seabbs commented Nov 14, 2024

@athowes this is ready for review.

It completes your work removing the dependency on cmdstanr.

It also updates the tests to use fits from the setup script, and updates most of the vignettes to use cmdstanr. Finally it renames the epidist containing script to match the name and fixes the outstanding CRAN notes.

seabbs
seabbs previously approved these changes Nov 14, 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

R/epidist.R Show resolved Hide resolved
Copy link
Collaborator Author

@athowes athowes left a comment

Choose a reason for hiding this comment

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

Nice!

Main larger thing is can we delete the saving of the data file seeing as it's not used now?

With regard to this change, perhaps it's going to slow down development sometimes (as I rerun the test preparation script) but I'm OK with it given the benefits.

I'm also confused why we are getting rid of tests of the model compiling.

inst/generate_examples.R Outdated Show resolved Hide resolved
inst/generate_examples.R Show resolved Hide resolved
tests/testthat/test-diagnostics.R Show resolved Hide resolved
tests/testthat/test-diagnostics.R Show resolved Hide resolved
tests/testthat/test-int-direct_model.R Show resolved Hide resolved
tests/testthat/test-int-latent_individual.R Outdated Show resolved Hide resolved
tests/testthat/test-int-latent_individual.R Show resolved Hide resolved
vignettes/approx-inference.Rmd Show resolved Hide resolved
vignettes/ebola.Rmd Show resolved Hide resolved
vignettes/epidist.Rmd Outdated Show resolved Hide resolved
@seabbs
Copy link
Contributor

seabbs commented Nov 14, 2024

I'm also confused why we are getting rid of tests of the model compiling.

because the test suite is super super slow and we don't need them as we are checking the syntax and we know we can compile models more generally in the fitting

@seabbs
Copy link
Contributor

seabbs commented Nov 14, 2024

Main larger thing is can we delete the saving of the data file seeing as it's not used now?

I think maybe if we don't need it for examples (which are currently quite missing) probably a new issue though.

With regard to this change, perhaps it's going to slow down development sometimes (as I rerun the test preparation script) but I'm OK with it given the benefits.

I think its the same or fewer number of model fits so the test suite should actually be faster

@seabbs seabbs force-pushed the reduce-cmdstanr-dep branch from f8f4611 to c14152d Compare November 14, 2024 15:06
@seabbs seabbs merged commit 4afb056 into main Nov 14, 2024
5 checks passed
@seabbs seabbs deleted the reduce-cmdstanr-dep branch November 14, 2024 15:06
@github-actions github-actions bot restored the reduce-cmdstanr-dep branch November 14, 2024 15:08
@athowes athowes deleted the reduce-cmdstanr-dep branch November 14, 2024 15:14
seabbs added a commit that referenced this pull request Jan 10, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 729e385075e181a2c7d9a716e776ac504d08a658 [formerly 70e78c0742b69012eb57ad58c5d92e39d25c45ad]
Former-commit-id: 38ff128853245a2fba7acdbe49951aabc476647e
seabbs added a commit that referenced this pull request Jan 21, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 4afb056
Former-commit-id: 764790be7d4ec49bce89e458a96556e91a472cb2
seabbs added a commit that referenced this pull request Jan 21, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 4afb056
Former-commit-id: 764790be7d4ec49bce89e458a96556e91a472cb2
seabbs added a commit that referenced this pull request Jan 21, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 4afb056
Former-commit-id: 764790be7d4ec49bce89e458a96556e91a472cb2
seabbs added a commit that referenced this pull request Jan 21, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 729e385075e181a2c7d9a716e776ac504d08a658 [formerly 70e78c0742b69012eb57ad58c5d92e39d25c45ad]
Former-commit-id: 38ff128853245a2fba7acdbe49951aabc476647e
seabbs added a commit that referenced this pull request Jan 21, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 729e385075e181a2c7d9a716e776ac504d08a658 [formerly 70e78c0742b69012eb57ad58c5d92e39d25c45ad]
Former-commit-id: 38ff128853245a2fba7acdbe49951aabc476647e
Former-commit-id: 9fc612e
seabbs added a commit that referenced this pull request Jan 21, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 4afb056
Former-commit-id: 764790be7d4ec49bce89e458a96556e91a472cb2
Former-commit-id: 0de625c0e819bd977b6691ec528c385cbbd34615 [formerly 32c2660]
Former-commit-id: 67be8349533318a2c020276788ccdfe2dd84e106
seabbs added a commit that referenced this pull request Jan 21, 2025
* Switch default to rstan rather than cmdstanr

* Import BH

* Use match.arg as suggested by @jamesmbaazam

* Add RcppEigen to Suggests

* Change backend to cmdstanr in approximate inference vignette

* Use cmdstanr for Laplace test

* Remove erroneous output_dir arg

* drop backend entirely as an arg

* remove cmdstanr using vignettes from cran check

* update cmdstan install instructions

* update epidist docs

* update approx-inference vignette to make it clear we are using cmdstanr and not rstan

* switch ebola vignette over to cmdstanr

* update test fit returns

* update more fit uses in test

* fix helper function

* bring silence to laplace

* fix epidist

* get tests passing

* fix CRAN check

* use fewer cores

* drop additional deps

* drop duplicate prepping

* try and use linking with instead of imports

* Update vignettes/epidist.Rmd

Co-authored-by: Adam Howes <[email protected]>

* Update tests/testthat/test-int-latent_individual.R

Co-authored-by: Adam Howes <[email protected]>

* Update inst/generate_examples.R

Co-authored-by: Adam Howes <[email protected]>

---------

Co-authored-by: Sam <[email protected]>
Former-commit-id: 4afb056
Former-commit-id: 764790be7d4ec49bce89e458a96556e91a472cb2
Former-commit-id: 0de625c0e819bd977b6691ec528c385cbbd34615 [formerly 32c2660]
Former-commit-id: 67be8349533318a2c020276788ccdfe2dd84e106
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.

Reduce dependence on cmdstanr given it's suggested not required
3 participants