Skip to content

Commit 952e07b

Browse files
bjornkallerudtopepogithub-actions[bot]
authored
Make surv_reg() defunct and update NEWS (#1294)
* Make surv_reg() defunct and update NEWS * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * redoc and remove surv_reg tests --------- Co-authored-by: Max Kuhn <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a214056 commit 952e07b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+176
-270
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ Config/testthat/edition: 3
8080
Encoding: UTF-8
8181
LazyData: true
8282
Roxygen: list(markdown = TRUE)
83-
RoxygenNote: 7.3.2
83+
RoxygenNote: 7.3.3

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# parsnip (development version)
22

3+
* `surv_reg()` is now defunct and will error if called. Please use `survival_reg()` instead (#1206).
4+
35
# parsnip 1.3.3
46

57
* Bug fix in how tunable parameters were configured for brulee neural networks.

R/surv_reg.R

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,37 @@
2727
#' @keywords internal
2828
#' @export
2929
surv_reg <- function(mode = "regression", engine = "survival", dist = NULL) {
30+
lifecycle::deprecate_stop("1.4.0", "surv_reg()", "survival_reg()")
3031

31-
lifecycle::deprecate_warn("0.1.6", "surv_reg()", "survival_reg()")
32-
33-
args <- list(
34-
dist = enquo(dist)
35-
)
36-
37-
new_model_spec(
38-
"surv_reg",
39-
args = args,
40-
eng_args = NULL,
41-
mode = mode,
42-
user_specified_mode = !missing(mode),
43-
method = NULL,
44-
engine = engine,
45-
user_specified_engine = !missing(engine)
46-
)
47-
}
32+
args <- list(
33+
dist = enquo(dist)
34+
)
4835

36+
new_model_spec(
37+
"surv_reg",
38+
args = args,
39+
eng_args = NULL,
40+
mode = mode,
41+
user_specified_mode = !missing(mode),
42+
method = NULL,
43+
engine = engine,
44+
user_specified_engine = !missing(engine)
45+
)
46+
}
47+
48+
# nocov
4949
# ------------------------------------------------------------------------------
5050

5151
#' @method update surv_reg
5252
#' @rdname parsnip_update
5353
#' @export
54-
update.surv_reg <- function(object, parameters = NULL, dist = NULL, fresh = FALSE, ...) {
55-
54+
update.surv_reg <- function(
55+
object,
56+
parameters = NULL,
57+
dist = NULL,
58+
fresh = FALSE,
59+
...
60+
) {
5661
args <- list(
5762
dist = enquo(dist)
5863
)
@@ -84,14 +89,13 @@ translate.surv_reg <- function(x, engine = x$engine, ...) {
8489

8590
#' @export
8691
check_args.surv_reg <- function(object, call = rlang::caller_env()) {
87-
8892
if (object$engine == "flexsurv") {
89-
9093
args <- lapply(object$args, rlang::eval_tidy)
9194

9295
# `dist` has no default in the function
93-
if (all(names(args) != "dist") || is.null(args$dist))
96+
if (all(names(args) != "dist") || is.null(args$dist)) {
9497
object$args$dist <- "weibull"
98+
}
9599
}
96100

97101
invisible(object)
@@ -132,6 +136,11 @@ flexsurv_mean <- function(results, object) {
132136
flexsurv_quant <- function(results, object) {
133137
results <- map(results, as_tibble)
134138
names(results) <- NULL
135-
results <- map(results, setNames, c(".quantile", ".pred", ".pred_lower", ".pred_upper"))
139+
results <- map(
140+
results,
141+
setNames,
142+
c(".quantile", ".pred", ".pred_lower", ".pred_upper")
143+
)
136144
}
137145

146+
# nocov end

R/surv_reg_data.R

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# nocov
12

23
set_new_model("surv_reg")
34
set_model_mode("surv_reg", "regression")
@@ -50,12 +51,11 @@ set_pred(
5051
pre = NULL,
5152
post = flexsurv_mean,
5253
func = c(fun = "summary"),
53-
args =
54-
list(
55-
object = expr(object$fit),
56-
newdata = expr(new_data),
57-
type = "mean"
58-
)
54+
args = list(
55+
object = expr(object$fit),
56+
newdata = expr(new_data),
57+
type = "mean"
58+
)
5959
)
6060
)
6161

@@ -106,11 +106,12 @@ set_pred(
106106
pre = NULL,
107107
post = NULL,
108108
func = c(fun = "predict"),
109-
args =
110-
list(
111-
object = expr(object$fit),
112-
newdata = expr(new_data),
113-
type = "response"
114-
)
109+
args = list(
110+
object = expr(object$fit),
111+
newdata = expr(new_data),
112+
type = "response"
113+
)
115114
)
116115
)
116+
117+
# nocov end

man/C5_rules.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/add_rowindex.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/augment.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bart.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/boost_tree.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/condense_control.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)