0
Rで回帰randomForest
を100回実行したい場合は、実行ごとに可変重要度を取得し、可変重要度の結果をcsvファイルとして書き出します。これは私のコードとそのエラーです:randomForestループと可変重要度をRで実行する
result<-data.frame(IncMSE="%IncMSE", IncNodePurity="IncNodePurity")
for (i in 1:3){
imp[i]<- importance(randomForest(train[,1:11], train[,12], data = train,importance = TRUE, ntree =5000, proximity = TRUE, mtry=3))
results<-cbind(result,imp[i])
}
write.csv(results,"D:/vari.csv")
Warning messages:
In imp[i] <- importance(randomForest(train[, 1:11], train[, 12], :
number of items to replace is not a multiple of replacement length
それを修正するには?どうもありがとう。