我正在R中使用CARET软件包进行预测建模。我不知道我的模型是否是分类和回归模型,但是每当我仅使用回归模型时,都会出现错误。
control <- trainControl(method='repeatedcv',
number=10,
repeats=3,
classProbs = T)
set.seed(1)
scaled_t$Training=factor(scaled_t$Training)
knn_grid1 = train(Training~.,
data=scaled_t,
method = "knn",
trControl = control,
tuneGrid = expand.grid(k = seq(1, 31, by = 2))
)
knn_grid1