【发布时间】:2018-12-30 11:08:29
【问题描述】:
fitControl <- trainControl(
method = "cv",
number = 5,
savePredictions = 'final',
classProbs = F)
predictors<-c("Age", "Quantile","label1","label2")
outcomeName<-'Life_expt'
model_rf<-train(Life_expt ~ Age+Quantile+label1+label2,Train2[country==.BY],method='rf',trControl=fitControl,tuneLength=3)
.prepareFastSubset(isub = isub, x = x, enclos = parent.frame(), 中的错误: == 的 RHS 是长度 0,它不是 1 或 nrow (559)。为了坚固,不允许再循环(长度为 1 RHS 除外)。请考虑使用 %in%。
我正在尝试在每个国家/地区扩展它。我想使用堆叠方法和模型(rf、svmRadial、glm)。我怎样才能在没有错误的情况下为每个国家/地区执行此操作?
谢谢
【问题讨论】:
-
能否请您提供更多详细信息(即集成和缩放是什么意思?)并通过分享一些数据/代码提出您的问题reproducible?
-
@Ozan147i 已添加代码和错误。
-
您的示例无法重现,因为我们仍然缺少样本数据。除了
Train2[country==.BY]的部分看起来很奇怪;什么是.BY和country,它们是如何定义的?你应该检查Train2[country==.BY]。我想你想子集Train2。试试Train2[Train2$country == some_country_to_match, ]。 -
您能否将前 20 行数据的
dput(head(Train2, 20))输出添加到您的问题中?
标签: r machine-learning statistics ensemble-learning