Skip to content

Commit

Permalink
changes for R CMD check
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Dec 18, 2024
1 parent 978e7a7 commit 2fb8701
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/0_imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ utils::globalVariables(
"rowwise", ".best", "location", "msg", "..object", ".eval_time",
".pred_survival", ".pred_time", ".weight_censored", "nice_time",
"time_metric", ".lower", ".upper", "i", "results", "term", ".alpha",
".method", "old_term", ".lab_pre", ".model", ".num_models"
".method", "old_term", ".lab_pre", ".model", ".num_models", "predict_stage"
)
)

Expand Down
18 changes: 17 additions & 1 deletion R/loopy.R
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ rebind_grid <- function(...) {
}

get_output_columns <- function(x, syms = FALSE) {
pred_cols <- .get_prediction_column_names(x, syms = TRUE)
pred_cols <- parsnip::.get_prediction_column_names(x, syms = TRUE)
res <- c(list(outcome = rlang::syms(outcome_names(x))), pred_cols)
res
}
Expand Down Expand Up @@ -379,6 +379,22 @@ update_reserve <- function(reserve, iter, predictions, grid_size) {

opts <- list(event_level = "first", verbose = FALSE)

#' Iterate over workflow settings
#'
#' @param sched A preprocessing schedule.
#' @param grid A parameter grid.
#' @param wflow A workflow object.
#' @param tune_id A character vector of tuning parameter names.
#' @param dat A list containing fit and prediction data.
#' @param mtr A metric set.
#' @param eval_time Optional. Evaluation time point(s).
#'
#' @returns
#' A list containing two elements:
#' * `metrics`: A tibble of computed metrics grouped by tuning parameters
#' * `predictions`: A tibble of model predictions
#'
#' @export
#' @export
loopy <- function(sched, grid, wflow, tune_id, dat, mtr, eval_time = NULL) {
# ------------------------------------------------------------------------------
Expand Down
11 changes: 10 additions & 1 deletion R/schedule.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#' Get tune schedule
#'
#' @param wflow A workflow object.
#' @param param A dials parameters set.
#' @param grid A tibble containing the parameter grid.
#'
#' @returns A schedule object, inheriting from either 'single_schedule',
#' 'grid_schedule', or 'resample_schedule'.
#'
#' @export
get_tune_schedule <- function(wflow, param, grid) {
if (!inherits(wflow, "workflow")) {
Expand Down Expand Up @@ -27,7 +36,7 @@ get_tune_schedule <- function(wflow, param, grid) {
# Merge the info in with the other parameters
param <- dplyr::left_join(param, model_param, by = "name") %>%
dplyr::mutate(
has_submodel = if_else(is.na(has_submodel), FALSE, has_submodel)
has_submodel = dplyr::if_else(is.na(has_submodel), FALSE, has_submodel)
)

# ------------------------------------------------------------------------------
Expand Down
22 changes: 22 additions & 0 deletions man/get_tune_schedule.Rd

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

33 changes: 33 additions & 0 deletions man/loopy.Rd

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

0 comments on commit 2fb8701

Please sign in to comment.