-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpredictorSelection.R
More file actions
31 lines (25 loc) · 1.35 KB
/
predictorSelection.R
File metadata and controls
31 lines (25 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Constants
NUM_FILES = 1 #Number of files to use
BRANCH_TOTAL = 7 #Number of branches
#Best Predictor per model Table: Initialize
pred_per_model_table=data.frame(file=numeric(), branch=numeric(), model=character(), predictors=character(), accuracy=numeric(), TP=numeric(), FN=numeric(), FP=numeric(), TN=numeric(), accuracy_cMatrix=numeric(), stringsAsFactors=FALSE)
#Average accuracy per file Table: Initialize
avr_per_file_table=data.frame(file=numeric(), accuracy=numeric(), stringsAsFactors=FALSE)
#Pick Predictors Per File
model_list=unique(results_table$model)
for(file_num in c(0:NUM_FILES)){
for(branch_num in c(1:BRANCH_TOTAL)){
for(model_num in c(1:length(model_list))){
temp_table=results_table[(results_table==file_num)&(results_table$branch==branch_num)&(results_table$model==model_list[model_num]),]
#TODO: CHANGE FILE SELECTION
pred_per_model_table=rbind(pred_per_model_table,temp_table[which.max(temp_table$accuracy),])
}
}
}
#Pick Best file
for(file_num in c(0:NUM_FILES)){
avr_per_file_table=rbind(avr_per_file_table, data.frame(file=file_num, accuracy=mean(pred_per_model_table[pred_per_model_table$file==file_num,]$accuracy)))
}
BEST_FILE=which.max(avr_per_file_table$accuracy)-1
write.csv(pred_per_model_table, file="./results/pred_per_model_table.csv")
write.csv(avr_per_file_table, file="./results/avr_per_file_table.csv")