0
私は混乱行列の結果をforループ内に格納しようとしています。今、ループは各反復の分析結果を表示します。混乱行列の結果を格納するためのループ
for(i in 1:50){
train.cpg.t2 <- sample(nrow(cpg.updated.2), 2/3 * nrow(cpg.updated.2))
cpg.train.t2 <- cpg.updated.2[train.cpg.t2, ]
cpg.test.t2 <- cpg.updated.2[-train.cpg.t2, ]
model.nb2 <- naiveBayes(group ~ ., data = cpg.train.t2)
naive.cpg2<-predict(model.nb2, cpg.test.t2)
myconf<-confusionMatrix(predict(model.nb2, cpg.test.t2), cpg.test.t2$group)
print(myconf)
}
ではなく、単に私はpredict
関数の結果を格納したいと、ループのすべての50回の反復confusionMatrix
機能を実装しmyconf
を印刷します。