I'm using the randomForest package in R for prediction, and want to plot the out of bag (OOB) errors to see if I have enough trees, and to tune the mtry (number of variables at each split) variable. The package seems to automatically compute the OOB errors for classification tasks, but doesn't do so for regression tasks. Does anyone know if there is a way to look at the OOB errors for regressions tasks?
You can also look directly at the out of bag predictions:
data(airquality)
set.seed(131)
ozone.rf <- randomForest(Ozone ~ ., data=airquality, mtry=3,
importance=TRUE, na.action=na.omit)
ozone.rf$predicted
And then you can calculate also other measures like eg median absolute error.
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