R 在配方中使用插入符号会导致重采样困难
我一直在使用配方来导入R 在配方中使用插入符号会导致重采样困难,r,r-caret,r-recipes,R,R Caret,R Recipes,我一直在使用配方来导入caret::train,这一直进展顺利,但现在我尝试了一些step\u转换,我得到了错误: Error in resamples.default(model_list) : There are different numbers of resamples in each model 当我比较有转换和没有转换的模型时。使用step_center和step_scale的相同代码可以正常工作 library(caret) library(tidyverse) libra
caret::train
,这一直进展顺利,但现在我尝试了一些step\u转换,我得到了错误:
Error in resamples.default(model_list) :
There are different numbers of resamples in each model
当我比较有转换和没有转换的模型时。使用step_center
和step_scale
的相同代码可以正常工作
library(caret)
library(tidyverse)
library(tidymodels)
formula <- price ~ carat
model_recipe <- recipe(formula, data = diamonds)
quadratic_model_recipe <- recipe(formula, data = diamonds) %>%
step_poly(all_predictors())
model_list <- list(
linear_model = NULL,
quadratic = NULL
)
model_list$linear_model <-
model_recipe %>% train(
data = diamonds,
method = "lm",
trControl = trainControl(method = "cv"))
model_list$quadratic_model <-
quadratic_model_recipe %>% train(
data = diamonds,
method = "lm",
trControl = trainControl(method = "cv"))
resamp <- resamples(model_list)
库(插入符号)
图书馆(tidyverse)
图书馆(tidymodels)
公式quadratic=NULL应该是quadratic\u model=NULL