RandomForest package with R mse calculation
I feel like I am missing something very basic here.
I ran a random forest regression:
INTERP.rf<-randomForest(y~.,data=df,importance=T,mtry=3,ntree=300)
and then extracted the predictions for the training set:
rf.predict<-predict(INTERP.rf,df,type="response")
% var from rf.predict looked too low, so I checked it:
MSE.rf<-sum((rf.predict-y)^2)/length(y)
... and got a completely different answer than inspecting the rf.predict object.
Please can anyone highlight my error?
+3
source to share