I'm trying to predict a continuous variable (count) in R with random forest. The values of the predicted variable are min=1 and max=1000.
I tried getting the prediction accuracy with "confusionMatrix", but naturally I get the error of different number of levels between the prediction and the predicted.
What is the best method of getting prediction accuracy in these circumstances?
@ mishakob
Roughly speaking, the root mean squared error can be understood as normalized deviance between actual and fitted values. it can be obtained as following.
library(randomForest)
set.seed(1237)
iris.rg <- randomForest(Sepal.Length ~ ., data=iris, importance=TRUE,
proximity=TRUE)
sqrt(sum((iris.rg$predicted - iris$Sepal.Length)^2) / nrow(iris))
[1] 0.3706187
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With