[868c5d]: / bin / random_forest.r

Download this file

23 lines (13 with data), 656 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library("randomForest");
fileName <- "../data/LungCancerDataset_AllRecords_NORM_reduced_features.csv"
lung_cancer_datatable <- read.csv(fileName, header = TRUE, sep =",", stringsAsFactors = FALSE);
# lung_cancer_datatable$"Typeoffollow.upexpected" <- NULL
# lung_cancer_datatable$"SiterecwithKaposiandmesothelioma" <- NULL
#
# lung_cancer_datatable$Metastasis <- lung_cancer_datatable$M
# lung_cancer_datatable$M <- NULL
rf_output <- randomForest(Metastasis ~ ., data=lung_cancer_datatable, importance=TRUE, proximity=TRUE)
dd <- as.data.frame(rf_output$importance);
dd_sorted <- dd[order(dd$"%IncMSE"), ]
print(dd_sorted);
varImpPlot(rf_output)