【发布时间】:2021-07-05 12:10:07
【问题描述】:
我正在尝试使用插入符号将树的数量和 mtry 显式传递给随机森林算法:
library(caret)
library(randomForest)
repGrid<-expand.grid(.mtry=c(4),.ntree=c(350))
controlRep <- trainControl(method="cv",number = 5)
rfClassifierRep <- train(label~ .,
data=overallDataset,
method="rf",
metric="Accuracy",
trControl=controlRep,
tuneGrid = repGrid,)
我收到此错误:
Error: The tuning parameter grid should have columns mtry
我先尝试了更明智的方法:
rfClassifierRep <- train(label~ .,
data=overallDataset,
method="rf",
metric="Accuracy",
trControl=controlRep,
ntree=350,
mtry=4,
tuneGrid = repGrid,)
但这导致了一个错误,指出我的超参数太多。这就是我尝试制作 1x1 网格的原因。
【问题讨论】:
标签: r machine-learning random-forest r-caret