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

kfold(): Arguments (from ...?) not passed to brm() #1378

Closed
fweber144 opened this issue Jul 11, 2022 · 2 comments
Closed

kfold(): Arguments (from ...?) not passed to brm() #1378

fweber144 opened this issue Jul 11, 2022 · 2 comments
Labels
Milestone

Comments

@fweber144
Copy link
Contributor

fweber144 commented Jul 11, 2022

This is similar to #1373, but for kfold.brmsfit() instead of update.brmsfit(). So here it seems like kfold.brmsfit() does not pass all arguments from the original brm() call to the K fold-specific brm() calls (I guess arguments from the ellipsis ... are missing). For example: argument adapt_delta in case of the cmdstanr backend:

library(brms)
options(mc.cores = parallel::detectCores(logical = FALSE))
fit_cmdstanr <- brm(rate ~ conc + state,
                    data = Puromycin,
                    refresh = 0,
                    seed = 11403,
                    backend = "cmdstanr",
                    adapt_delta = 0.9)
unique(sapply(fit_cmdstanr$fit@stan_args, "[[", "delta"))
## Gives: 0.9
kfold_cmdstanr <- kfold(fit_cmdstanr, K = 2, save_fits = TRUE, seed = 789)
fit_cmdstanr_fold1 <- kfold_cmdstanr$fits[1, "fit"]$fit
unique(sapply(fit_cmdstanr_fold1$fit@stan_args, "[[", "delta"))
## Gives: 0.8

Specifying adapt_delta in the kfold() call helps (even though the ... documentation at ?kfold.brmsfit only mentions "post-processing functions"):

kfold_cmdstanr_add <- kfold(fit_cmdstanr, K = 2, save_fits = TRUE, seed = 789,
                            adapt_delta = 0.9)
fit_cmdstanr_fold1_add <- kfold_cmdstanr_add$fits[1, "fit"]$fit
unique(sapply(fit_cmdstanr_fold1_add$fit@stan_args, "[[", "delta"))
## Gives: 0.9

Tested with brms v2.17.0.

@paul-buerkner paul-buerkner added this to the brms 2.17.0++ milestone Jul 11, 2022
paul-buerkner added a commit that referenced this issue Aug 12, 2022
@paul-buerkner
Copy link
Owner

Fixed.

@fweber144
Copy link
Contributor Author

Thanks! I can confirm that the example is working now.

fweber144 added a commit to fweber144/brms that referenced this issue Aug 12, 2022
<paul-buerkner#1378 (comment)>). Thus,
take the `...` documentation from `brm_multiple()` instead of from
`loo.brmsfit()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants