Skip to content

Commit 101810e

Browse files
committed
change output_samples in variational to draws for consistency
will continue to accept output_samples to not break backwards compatibility
1 parent 0c0ce6f commit 101810e

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

R/args.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ validate_variational_args <- function(self) {
831831
self$eval_elbo <- as.integer(self$eval_elbo)
832832
}
833833
checkmate::assert_integerish(self$output_samples, null.ok = TRUE,
834-
lower = 1, len = 1)
834+
lower = 1, len = 1, .var.name = "draws")
835835
if (!is.null(self$output_samples)) {
836836
self$output_samples <- as.integer(self$output_samples)
837837
}

R/model.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,9 @@ CmdStanModel$set("public", name = "laplace", value = laplace)
16661666
#' @param tol_rel_obj (positive real) Convergence tolerance on the relative norm
16671667
#' of the objective.
16681668
#' @param eval_elbo (positive integer) Evaluate ELBO every Nth iteration.
1669-
#' @param output_samples (positive integer) Number of approximate posterior
1669+
#' @param output_samples (positive integer) Use `draws` argument instead.
1670+
#' `output_samples` will be deprecated in the future.
1671+
#' @param draws (positive integer) Number of approximate posterior
16701672
#' samples to draw and save.
16711673
#'
16721674
#' @return A [`CmdStanVB`] object.
@@ -1693,7 +1695,8 @@ variational <- function(data = NULL,
16931695
adapt_iter = NULL,
16941696
tol_rel_obj = NULL,
16951697
eval_elbo = NULL,
1696-
output_samples = NULL) {
1698+
output_samples = NULL,
1699+
draws = NULL) {
16971700
procs <- CmdStanProcs$new(
16981701
num_procs = 1,
16991702
show_stdout_messages = (is.null(refresh) || refresh != 0),
@@ -1713,7 +1716,7 @@ variational <- function(data = NULL,
17131716
adapt_iter = adapt_iter,
17141717
tol_rel_obj = tol_rel_obj,
17151718
eval_elbo = eval_elbo,
1716-
output_samples = output_samples
1719+
output_samples = draws %||% output_samples
17171720
)
17181721
args <- CmdStanArgs$new(
17191722
method_args = variational_args,

man/model-method-variational.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)