Dear R users,
I have a question on the confusion matrix generated by function randomForest.
I used the entire data
set to generate the forest, for example:
> print(iris.rf)
Call:
randomForest(formula = Species ~ ., data = iris, importance = TRUE,
keep.forest = TRUE)
confusion
setosa versicolor virginica class.error
setosa 50 0 0 0.00
versicolor 0 47 3 0.06
virginica 0 3 47 0.06
then I classified the same data set with this forest:
> iris.pred <- predict(iris.rf, iris)
> table(observed = iris[,"Species"], predicted = iris.pred)
predicted
observed setosa versicolor virginica
setosa 50 0 0
versicolor 0 50 0
virginica 0 0 50
Why the two matrices are different?
Thinks,
Li
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.