annotate feature_selection.R @ 0:b4d2524e79ab draft

planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
author anmoljh
date Fri, 01 Jun 2018 05:16:19 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
1 args <- commandArgs(T)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
2
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
3 arg1 <- args[1]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
4 arg2 <- args[2]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
5 arg3 <- args[3]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
6 arg4 <- args[4]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
7 arg5 <- args[5]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
8 arg6 <- args[6]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
9 arg7 <- args[7]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
10 arg8 <- args[8]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
11 arg9 <- args[9]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
12 arg10 <- args[10]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
13 library(caret)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
14 library(doMC)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
15 load(arg1)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
16
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
17 #RAWDATA <- dataX
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
18 #RAWDATA$outcome <- dataY
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
19
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
20
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
21 ###########################
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
22 Smpling <- arg9
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
23
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
24 if(Smpling=="downsampling")
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
25 {
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
26 dwnsmpl <- downSample(dataX,dataY)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
27 RAWDATA <- dwnsmpl[,1:length(dwnsmpl)-1]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
28 RAWDATA$outcome <- dwnsmpl[,length(dwnsmpl)]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
29 dataX <- RAWDATA[,1:length(dwnsmpl)-1]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
30 dataY <- RAWDATA[,"outcome"]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
31 remove("dwnsmpl")
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
32 }else if(Smpling=="upsampling"){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
33 upsmpl <- upSample(dataX,dataY)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
34 RAWDATA <- upsmpl[,1:length(upsmpl)-1]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
35 RAWDATA$outcome <- upsmpl[,length(upsmpl)]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
36 dataX <- RAWDATA[,1:length(upsmpl)-1]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
37 dataY <- RAWDATA[,"outcome"]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
38 remove("upsmpl")
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
39 }else {
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
40 RAWDATA <- dataX
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
41 RAWDATA$outcome <- dataY
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
42 }
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
43
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
44
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
45
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
46
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
47 ##########################
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
48
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
49
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
50 rawData <- dataX
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
51 predictorNames <- names(rawData)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
52
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
53 isNum <- apply(rawData[,predictorNames, drop = FALSE], 2, is.numeric)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
54 if(any(!isNum)) stop("all predictors in rawData should be numeric")
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
55
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
56 colRate <- apply(rawData[, predictorNames, drop = FALSE],
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
57 2, function(x) mean(is.na(x)))
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
58 colExclude <- colRate > 0.1
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
59 if(any(colExclude)){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
60 predictorNames <- predictorNames[-which(colExclude)]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
61 rawData <- RAWDATA[, c(predictorNames,"outcome")]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
62 } else {
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
63 rawData <- RAWDATA
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
64 }
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
65 rowRate <- apply(rawData[, predictorNames, drop = FALSE],
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
66 1, function(x) mean(is.na(x)))
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
67
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
68
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
69 rowExclude <- rowRate > 0
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
70 if(any(rowExclude)){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
71 rawData <- rawData[!rowExclude, ]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
72 ##hasMissing <- apply(rawData[, predictorNames, drop = FALSE],
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
73 ##1, function(x) mean(is.na(x)))
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
74
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
75 ############################################################################
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
76
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
77
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
78 ###############################################################################
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
79 } else {
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
80 rawData <- rawData[complete.cases(rawData),]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
81
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
82 }
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
83
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
84 set.seed(2)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
85
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
86 #print(dim(dataX))
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
87 #print(dim(rawData))
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
88 #print(length(dataY))
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
89
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
90 nzv <- nearZeroVar(rawData[,1:(length(rawData) - 1)])
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
91 if(length(nzv) > 0) {
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
92 #nzvVars <- names(rawData)[nzv]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
93 rawData <- rawData[,-nzv]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
94 #rawData$outcome <- dataY
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
95 }
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
96
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
97 predictorNames <- names(rawData)[names(rawData) != "outcome"]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
98
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
99 dx <- rawData[,1:length(rawData)-1]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
100 dy <- rawData[,length(rawData)]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
101 corrThresh <- as.numeric(arg8)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
102 highCorr <- findCorrelation(cor(dx, use = "pairwise.complete.obs"),corrThresh)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
103 dx <- dx[, -highCorr]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
104 subsets <- seq(1,length(dx),by=5)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
105 normalization <- preProcess(dx)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
106 dx <- predict(normalization, dx)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
107 dx <- as.data.frame(dx)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
108
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
109 if (arg4 == "lmFuncs"){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
110 ctrl1 <- rfeControl(functions = lmFuncs,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
111 method = arg5 ,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
112 repeats = as.numeric(arg6),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
113 number = as.numeric(arg7),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
114 verbose = FALSE)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
115 } else if(arg4 == "rfFuncs"){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
116 ctrl1 <- rfeControl(functions = rfFuncs,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
117 method = arg5 ,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
118 repeats = as.numeric(arg6),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
119 number = as.numeric(arg7),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
120 verbose = FALSE)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
121 }else if (arg4 == "treebagFuncs"){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
122 ctrl1 <- rfeControl(functions = treebagFuncs,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
123 method = arg5 ,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
124 repeats = as.numeric(arg6),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
125 number = as.numeric(arg7),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
126 verbose = FALSE)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
127 }else {
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
128
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
129 ctrl1 <- rfeControl(functions = nbFuncs,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
130 method = arg5 ,
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
131 repeats = as.numeric(arg6),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
132 number = as.numeric(arg7),
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
133 verbose = FALSE)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
134 }
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
135
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
136
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
137
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
138 if (as.numeric(arg10) == 1){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
139 Profile <- rfe(dx, dy,sizes = subsets,rfeControl = ctrl1)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
140
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
141 pred11 <- predictors(Profile)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
142 save(Profile,file=arg2)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
143 dataX <- rawData[,pred11]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
144 dataY <- rawData$outcome
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
145
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
146 save(dataX,dataY,file=arg3)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
147 rm(dataX)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
148 rm(dataY)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
149 } else if (as.numeric(arg10) > 1){
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
150 registerDoMC(cores = as.numeric(arg10))
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
151
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
152 Profile <- rfe(dx, dy,sizes = subsets,rfeControl = ctrl1)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
153
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
154 pred11 <- predictors(Profile)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
155 save(Profile,file=arg2)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
156 dataX <- rawData[,pred11]
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
157 dataY <- rawData$outcome
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
158
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
159 save(dataX,dataY,file=arg3)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
160 rm(dataX)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
161 rm(dataY)
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
162 } else { stop("something went wrong. please see the parameters")}
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
163
b4d2524e79ab planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272
anmoljh
parents:
diff changeset
164