Sample R code for Random Forest
library(randomForest) rf50 <- randomForest(Creditability ~., data = Train50, ntree=200, importance=T, proximity=T) plot(rf50, main="") rf50 Test50_rf_pred <- predict(rf50, Test50, type="class") table(Test50_rf_pred, Test50$Creditability) importance(rf50) varImpPlot(rf50, main="", cex=0.8)
Completely unsupervised random forest method on Training data with ntree = 200 leads to the following error plot:
Importance of predictors are given in the following dotplot.
which gives rise to the following classification table:
With judicious choice of more important predictors, further improvement in accuracy is possible. But as improvement is slight, no attempt is made for supervised random forest.