Skip to content

Commit df07110

Browse files
authored
Merge branch 'main' into no-pkg
2 parents 5ea923d + 082351b commit df07110

File tree

4 files changed

+2
-128
lines changed

4 files changed

+2
-128
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ export(rand_forest)
312312
export(repair_call)
313313
export(req_pkgs)
314314
export(required_pkgs)
315-
export(rpart_train)
316315
export(rule_fit)
317316
export(set_args)
318317
export(set_dependency)

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
* Aligned `null_model()` with other model types; the model type now has an engine argument that defaults to `"parsnip"` and is checked with the same machinery that checks other model types in the package (#1083).
2525

26+
* The deprecated function `rpart_train()` was removed after its deprecation period (#1044).
27+
2628
## Bug Fixes
2729

2830
* Make sure that parsnip does not convert ordered factor predictions to be unordered.

R/decision_tree.R

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -129,76 +129,3 @@ translate.decision_tree <- function(x, engine = x$engine, ...) {
129129
check_args.decision_tree <- function(object, call = rlang::caller_env()) {
130130
invisible(object)
131131
}
132-
133-
# ------------------------------------------------------------------------------
134-
135-
#' Decision trees via rpart
136-
#'
137-
#' @description
138-
#' `rpart_train()` is a wrapper for `rpart()` tree-based models
139-
#' where all of the model arguments are in the main function.
140-
#'
141-
#' The function is now deprecated, as parsnip uses `rpart::rpart()` directly.
142-
#'
143-
#' @param formula A model formula.
144-
#' @param data A data frame.
145-
#' @param cp A non-negative number for complexity parameter. Any split
146-
#' that does not decrease the overall lack of fit by a factor of
147-
#' `cp` is not attempted. For instance, with anova splitting,
148-
#' this means that the overall R-squared must increase by `cp` at
149-
#' each step. The main role of this parameter is to save computing
150-
#' time by pruning off splits that are obviously not worthwhile.
151-
#' Essentially, the user informs the program that any split which
152-
#' does not improve the fit by `cp` will likely be pruned off by
153-
#' cross-validation, and that hence the program need not pursue it.
154-
#' @param weights Optional case weights.
155-
#' @param minsplit An integer for the minimum number of observations
156-
#' that must exist in a node in order for a split to be attempted.
157-
#' @param maxdepth An integer for the maximum depth of any node
158-
#' of the final tree, with the root node counted as depth 0.
159-
#' Values greater than 30 `rpart` will give nonsense results on
160-
#' 32-bit machines. This function will truncate `maxdepth` to 30 in
161-
#' those cases.
162-
#' @param ... Other arguments to pass to either `rpart` or `rpart.control`.
163-
#' @return A fitted rpart model.
164-
#' @keywords internal
165-
#' @export
166-
rpart_train <-
167-
function(formula, data, weights = NULL, cp = 0.01, minsplit = 20, maxdepth = 30, ...) {
168-
lifecycle::deprecate_warn(
169-
"1.2.0",
170-
"rpart_train()",
171-
details = 'Instead, use `decision_tree(engine = "rpart")` or `rpart::rpart()` directly.'
172-
)
173-
174-
bitness <- 8 * .Machine$sizeof.pointer
175-
if (bitness == 32 & maxdepth > 30)
176-
maxdepth <- 30
177-
178-
other_args <- list(...)
179-
protect_ctrl <- c("minsplit", "maxdepth", "cp")
180-
protect_fit <- NULL
181-
f_names <- names(formals(getFromNamespace("rpart", "rpart")))
182-
c_names <- names(formals(getFromNamespace("rpart.control", "rpart")))
183-
other_args <- other_args[!(other_args %in% c(protect_ctrl, protect_fit))]
184-
ctrl_args <- other_args[names(other_args) %in% c_names]
185-
fit_args <- other_args[names(other_args) %in% f_names]
186-
187-
ctrl <- call2("rpart.control", .ns = "rpart")
188-
ctrl$minsplit <- minsplit
189-
ctrl$maxdepth <- maxdepth
190-
ctrl$cp <- cp
191-
ctrl <- rlang::call_modify(ctrl, !!!ctrl_args)
192-
193-
fit_call <- call2("rpart", .ns = "rpart")
194-
fit_call$formula <- expr(formula)
195-
fit_call$data <- expr(data)
196-
fit_call$control <- ctrl
197-
if (!is.null(weights)) {
198-
fit_call$weights <- quote(weights)
199-
}
200-
fit_call <- rlang::call_modify(fit_call, !!!fit_args)
201-
202-
eval_tidy(fit_call)
203-
}
204-

man/rpart_train.Rd

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)