Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewGhazi committed Jul 5, 2024
1 parent 3f0f168 commit 843aba1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 9 additions & 3 deletions R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ run_gp = function(dat, ..., max_grid_size = 2000,
#' improvement at grid values.
#' @details The acquisition function is \code{lambda*f_star_var + (1-lambda)*exp_imp}.
#' Higher values of lambda up-weight posterior predictive variance, leading to more
#' exploration over exploitation.
#' exploration over exploitation. Lower lambda values up-weight expected improvement over \code{max(dat$rating) - off}
#' @returns a list with elements:
#' \itemize{
#' \item{draws_df}{a draws data frame of model parameters and grid point predictive draws f_star}
#' \item{acq_df}{a data table of acquisition function values and corresponding grid point values}
#' \item{suggested}{the row of \code{acq_df} that maximizes the acquisition function}
#' }
#'
#' @export
suggest_next = function(dat, ..., max_grid_size = 2000,
Expand All @@ -157,7 +163,7 @@ suggest_next = function(dat, ..., max_grid_size = 2000,
f_star_mat = qM(gp_res |> get_vars("f_star", regex = TRUE))

# expected improvement ----
minus_max = f_star_mat - obs_max - offset
minus_max = f_star_mat - (obs_max - offset)

w = 1*(minus_max > 0)

Expand Down Expand Up @@ -197,6 +203,6 @@ suggest_next = function(dat, ..., max_grid_size = 2000,
suggest = acq_df |> sbt(whichv(acq, fmax(acq)))

list(draws_df = gp_res,
x_grid = x_grid,
acq_df = acq_df,
suggested = suggest )
}
10 changes: 9 additions & 1 deletion man/suggest_next.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 843aba1

Please sign in to comment.