===
set.seed(123)randfit <- randomForest(lpsa~lcavol+lweight+age+lbph+svi+lcp+gleason+pgg45, mtry=3, nodesize=5, replace=T, localImp=T, nPerm=10, data = prostate)
plot(randfit,main="Random Forest")
which.min(randfit$mse)
randfit2 <- randomForest(lpsa~lcavol+lweight+age+lbph+svi+lcp+gleason+pgg45, ntree=197, mtry=3, nodesize=5, replace=5, localImp=T, nPerm=10, data = prostate)
varImpPlot(randfit2,main = "Variable Importance Plot")
联系客服