[R] Surprising randomForest Results
Rodney Barnett
barnett at ploughman-analytics.com
Wed Oct 1 17:01:18 CEST 2008
Is it expected that predict.randomForest() produces the response vector when
given the same data frame as provided to randomForest()? See below.
Thanks.
Rodney
> rf <- randomForest (Species ~ ., iris)
> pc <- predict (rf, iris)
> confusion (pc, iris$Species)
true
object setosa versicolor virginica
setosa 50 0 0
versicolor 0 50 0
virginica 0 0 50
attr(,"error")
[1] 0
> confusion (rf$predicted, iris$Species)
true
object setosa versicolor virginica
setosa 50 0 0
versicolor 0 47 3
virginica 0 3 47
attr(,"error")
[1] 0.04
> rf$confusion
setosa versicolor virginica class.error
setosa 50 0 0 0.00
versicolor 0 47 3 0.06
virginica 0 3 47 0.06
>
More information about the R-help
mailing list