【发布时间】:2018-04-09 05:08:26
【问题描述】:
我正在尝试使用 here 描述的示例组合来自不同模型的信号。我有不同的数据集可以预测相同的输出。但是,当我在caretList 中组合模型输出并集成信号时,会出现错误
Error in check_bestpreds_resamples(modelLibrary) :
Component models do not have the same re-sampling strategies
这是可重现的示例
library(caret)
library(caretEnsemble)
df1 <-
data.frame(x1 = rnorm(200),
x2 = rnorm(200),
y = as.factor(sample(c("Jack", "Jill"), 200, replace = T)))
df2 <-
data.frame(z1 = rnorm(400),
z2 = rnorm(400),
y = as.factor(sample(c("Jack", "Jill"), 400, replace = T)))
library(caret)
check_1 <- train( x = df1[,1:2],y = df1[,3],
method = "nnet",
tuneLength = 10,
trControl = trainControl(method = "cv",
classProbs = TRUE,
savePredictions = T))
check_2 <- train( x = df2[,1:2],y = df2[,3] ,
method = "nnet",
preProcess = c("center", "scale"),
tuneLength = 10,
trControl = trainControl(method = "cv",
classProbs = TRUE,
savePredictions = T))
combine <- c(check_1, check_2)
ens <- caretEnsemble(combine)
【问题讨论】:
标签: r r-caret ensemble-learning