使用插入符号调整参数

Tuning parameters with caret

我正在使用 R 中的 caret 包使用 Cubist 模型树构建回归模型,它有两个调整参数:

调整参数:委员会 (#Committees)、邻居 (#Instances)

我想我正在尝试错误地实施调整参数,需要一些帮助来解决问题。按照插入符号站点上的示例,我为我的调整参数构建了一个网格,如下所示:

cubistGrid <- expand.grid(committees = 30, neighbors = 10)

然后我使用 train 函数调用网格,如下所示:

LMFit1 <- train(Total~., data = training, method = "cubist", trControl = fitControl, tuneGrid = cubistGrid)

我收到以下错误:

Something is wrong; all the RMSE metric values are missing:

我的数据框没有任何问题,因为我 运行 迄今为止有很多模型;第一次使用调参

谢谢,

首先,不是 reproducible example,但是如果您检查警告,您将看到以下内容:

predictions failed for Resample1: committees=30, neighbors=10 Error in predict.cubist(modelFit, newdata, neighbors = modelFit$tuneValue$neighbors) : 'neighbors' must be less than 10

将邻居设置为小于 10 的值。这应该会处理空的 rmse 指标。