diff --git a/DESCRIPTION b/DESCRIPTION index fc51bb3e..57f01a76 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: workflows Title: Modeling Workflows -Version: 1.1.3.9000 +Version: 1.1.3.9001 Authors@R: c( person("Davis", "Vaughan", , "davis@posit.co", role = "aut"), person("Simon", "Couch", , "simon.couch@posit.co", role = c("aut", "cre"), @@ -24,7 +24,7 @@ Imports: hardhat (>= 1.2.0), lifecycle (>= 1.0.3), modelenv (>= 0.1.0), - parsnip (>= 1.1.1.9004), + parsnip (>= 1.1.1.9007), rlang (>= 1.0.3), tidyselect (>= 1.2.0), vctrs (>= 0.4.1) @@ -51,4 +51,4 @@ Remotes: Config/testthat/edition: 3 Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.2.3.9000 diff --git a/NAMESPACE b/NAMESPACE index f1bac48f..3757fe64 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +S3method(.censoring_weights_graf,workflow) S3method(augment,workflow) S3method(extract_fit_engine,workflow) S3method(extract_fit_parsnip,workflow) @@ -68,5 +69,6 @@ importFrom(hardhat,extract_preprocessor) importFrom(hardhat,extract_recipe) importFrom(hardhat,extract_spec_parsnip) importFrom(lifecycle,deprecated) +importFrom(parsnip,.censoring_weights_graf) importFrom(parsnip,fit_xy) importFrom(stats,predict) diff --git a/R/survival-censoring-weights.R b/R/survival-censoring-weights.R new file mode 100644 index 00000000..4d8a575b --- /dev/null +++ b/R/survival-censoring-weights.R @@ -0,0 +1,10 @@ +#' @export +.censoring_weights_graf.workflow <- function(object, + predictions, + cens_predictors = NULL, + trunc = 0.05, eps = 10^-10, ...) { + if (is.null(object$fit$fit)) { + rlang::abort("The workflow does not have a model fit object.") + } + .censoring_weights_graf(object$fit$fit, predictions, cens_predictors, trunc, eps) +} diff --git a/R/workflows-package.R b/R/workflows-package.R index d9f0e86e..a6c484b1 100644 --- a/R/workflows-package.R +++ b/R/workflows-package.R @@ -13,6 +13,7 @@ #' @importFrom generics tune_args #' @importFrom generics tunable #' @importFrom lifecycle deprecated +#' @importFrom parsnip .censoring_weights_graf #' @importFrom parsnip fit_xy #' @importFrom stats predict ## usethis namespace: end