我有一些代碼適合幾個(交叉驗證的)模型對某些數據,如下所示。r caret整合 - 在caretList中傳遞一個適合param的特定模型
library(datasets)
library(caret)
library(caretEnsemble)
# load data
data("iris")
# establish cross-validation structure
set.seed(32)
trainControl <- trainControl(method="repeatedcv",
number=5, repeats=3, # 3x 5-fold CV
search="random")
algorithmList <- c('lda', # Linear Discriminant Analysis
'rpart' , # Classification and Regression Trees
'svmRadial') # SVM with RBF Kernel
# cross-validate models from algorithmList
models <- caretList(Species~., data=iris, trControl=trainControl, methodList=algorithmList)
迄今爲止這麼好。但是,如果我將'gbm'
添加到我的algorithmList
,則會收到大量無關的日誌消息,因爲gbm
似乎具有verbose=TRUE
默認適配參數。
按照caret docs,如果我上運行method='gbm'
train
本身(不與在caretList
訓練的幾款車型一起),我可以簡單地添加到verbose=FALSE
train()
,這將流經到gbm
。但是當我在caretList
中嘗試它時會引發錯誤。
所以我想通過verbose=FALSE
(或理論上的任何其他適合參數)專門從caretList
的methodList
的一個特定型號。我怎樣才能做到這一點?