Randomforest, confusionMatrix, visualization

Problem : To calculate accuracy about Randomforest ntree(from 1 ~ to 10), visualizing the results as a graph.

So, i was trying to make a code.

r = rpart(Species~., data = iris)
for(i in 1:10) {
f <- randomForest(Species~.,data = iris, ntree = i)
r_pred = predict(r, iris, type = 'class')}
after that, i also confuse how to use confusion matrix.
f

Call:
randomForest(formula = Species ~ ., data = iris, ntree = i)
Type of random forest: classification
Number of trees: 10
No. of variables tried at each split: 2

    OOB estimate of  error rate: 5.37%

Confusion matrix:
setosa versicolor virginica class.error
setosa 50 0 0 0.0000000
versicolor 0 47 3 0.0600000
virginica 0 5 44 0.1020408

I think this is right, but how can i visualize each accuracy (from 1 to 10 ntree) as each part and also graph.
Please help me.
Thanks

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.