【发布时间】:2018-04-26 17:51:21
【问题描述】:
假设我正在对同一模型进行多次运行,但仅使用不同的复杂度参数,在与插入符号包相同(种子固定)的交叉验证中,例如:
library(caret)
data(iris)
# controls are the same for every models
c = trainControl(method = "cv",number=10,verboseIter = TRUE)
d = iris # data is also the same
f = Species ~ . # formula is also the same
m = "rpart" # method is also the same
set.seed(1234)
model1 <- train(form = f, data = d, trControl = c, method = m,
tuneGrid = expand.grid(cp = c(0,0.5)))
set.seed(1234)
model2 <- train(form = f, data = d, trControl = c, method = m,
tuneGrid = expand.grid(cp = c(0.1,0.2)))
set.seed(1234)
model3 <- train(form = f, data = d, trControl = c, method = m,
tuneGrid = expand.grid(cp = c(0,0.5,0.1,0.2)))
有没有一种方法可以仅从 model1 和 model2 “构建”model3 训练对象? 计算很长,我没有在同一个插入符号调用中运行所有不同的调优。但是每次运行都在同一个火车对象中比较它们会更容易(通过绘图函数、更新函数、重采样函数等......)
我特别在寻找一种方法来做同样的事情 plot.train 做的事情,但要一起做。
【问题讨论】: