2
我希望運行隨機森林並行使用脫字符包,我希望設置種子重複性的結果在Fully reproducible parallel models using caret。但是,在下面的代碼中,我不明白第9行的代碼幫助:爲什麼我們要抽取22(加上第12,23行的最後一個模型)整數(對參數k的12個值進行評估)?有關信息,我希望運行5倍CV以評估RF參數'mtry'的584個值。任何幫助深表感謝。謝謝。設置種子平行隨機森林插入可重複的結果
## Not run:
## Do 5 repeats of 10-Fold CV for the iris data. We will fit
## a KNN model that evaluates 12 values of k and set the seed
## at each iteration.
set.seed(123)
seeds <- vector(mode = "list", length = 51)
for(i in 1:50) seeds[[i]] <- sample.int(1000, 22) # Why 22?
## For the last model:
seeds[[51]] <- sample.int(1000, 1)
ctrl <- trainControl(method = "repeatedcv",
repeats = 5,
seeds = seeds)
是的,它看起來像一個錯誤,你會期望它的樣品50次。即使他們想重複摺疊之間的種子,你會期望10的倍數。我會說這是一個錯誤。 – smci