Skip to content

Commit

Permalink
Function name change from recipes tidymodels/recipes#68
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Jun 28, 2017
1 parent c441061 commit 87750d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/caret/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Imports:
stats4,
utils,
grDevices,
recipes (>= 0.0.1.9004)
recipes (>= 0.0.1.9005)
Suggests:
BradleyTerry2,
e1071,
Expand Down
2 changes: 1 addition & 1 deletion pkg/caret/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ importFrom(grDevices,extendrange)
importFrom(recipes,all_outcomes)
importFrom(recipes,all_predictors)
importFrom(recipes,bake)
importFrom(recipes,extract)
importFrom(recipes,has_role)
importFrom(recipes,juice)
importFrom(recipes,prepare)
importFrom(stats,.checkMFClasses)
importFrom(stats,.getXlevels)
Expand Down
12 changes: 6 additions & 6 deletions pkg/caret/R/recipes.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ train.recipe <- function(recipe,
trained_rec <- prepare(recipe, training = data, fresh = TRUE,
retain = TRUE,
verbose = FALSE, stringsAsFactors = TRUE)
x <- recipes::extract(trained_rec, all_predictors())
y <- recipes::extract(trained_rec, all_outcomes())
x <- juice(trained_rec, all_predictors())
y <- juice(trained_rec, all_outcomes())
if(ncol(y) > 1)
stop("`train` doesn't support multivariate outcomes")
y <- getElement(y, names(y))
is_weight <- summary(trained_rec)$role == "case weight"
if(any(is_weight)) {
if(sum(is_weight) > 1)
stop("Ony one column can be used as a case weight.")
weights <- recipes::extract(trained_rec, has_role("case weight"))
weights <- juice(trained_rec, has_role("case weight"))
weights <- getElement(weights, names(weights))
} else weights <- NULL

Expand Down Expand Up @@ -675,7 +675,7 @@ holdout_rec <- function(object, dat, index) {
ho_data <- as.data.frame(ho_data)
}

#' @importFrom recipes bake prepare extract has_role
#' @importFrom recipes bake prepare juice has_role
rec_model <- function(rec, dat, method, tuneValue, obsLevels,
last = FALSE, sampling = NULL, classProbs, ...) {

Expand Down Expand Up @@ -703,8 +703,8 @@ rec_model <- function(rec, dat, method, tuneValue, obsLevels,
trained_rec <- prepare(rec, training = dat, fresh = TRUE,
verbose = FALSE, stringsAsFactors = TRUE,
retain = TRUE)
x <- recipes::extract(trained_rec, all_predictors())
y <- recipes::extract(trained_rec, all_outcomes())
x <- juice(trained_rec, all_predictors())
y <- juice(trained_rec, all_outcomes())
y <- get_vector(y)

is_weight <- summary(trained_rec)$role == "case weight"
Expand Down

0 comments on commit 87750d8

Please sign in to comment.