-
Notifications
You must be signed in to change notification settings - Fork 0
/
organize_results.py
143 lines (119 loc) · 5.46 KB
/
organize_results.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import os
import pandas as pd
results_directory = "./results/"
results_list = os.listdir(results_directory)
original = {
'mean': list(),
'std': list(),
'time': list()
}
variance = {
'mean': list(),
'std': list(),
'percent': list(),
'time': list()
}
chisquared = {
'mean': list(),
'std': list(),
'percent': list(),
'time': list()
}
anova = {
'mean': list(),
'std': list(),
'percent': list(),
'time': list()
}
principal = {
'mean': list(),
'std': list(),
'percent': list(),
'time': list()
}
for name in results_list:
df = pd.read_csv("./results/" + name)
if("chi" in name):
chisquared['mean'].append(df["dt_mean"].loc[0])
chisquared['mean'].append(df["rf_mean"].loc[0])
chisquared['mean'].append(df["svm_mean"].loc[0])
chisquared['mean'].append(df["knn_mean"].loc[0])
chisquared['std'].append(df["dt_std"].loc[0])
chisquared['std'].append(df["rf_std"].loc[0])
chisquared['std'].append(df["svm_std"].loc[0])
chisquared['std'].append(df["knn_std"].loc[0])
chisquared['percent'].append(df["dt_percent"].loc[0])
chisquared['percent'].append(df["rf_percent"].loc[0])
chisquared['percent'].append(df["svm_percent"].loc[0])
chisquared['percent'].append(df["knn_percent"].loc[0])
chisquared['time'].append(df["dt_time"].loc[0])
chisquared['time'].append(df["rf_time"].loc[0])
chisquared['time'].append(df["svm_time"].loc[0])
chisquared['time'].append(df["knn_time"].loc[0])
elif("f_cla" in name):
anova['mean'].append(df["dt_mean"].loc[0])
anova['mean'].append(df["svm_mean"].loc[0])
anova['mean'].append(df["rf_mean"].loc[0])
anova['mean'].append(df["knn_mean"].loc[0])
anova['std'].append(df["dt_std"].loc[0])
anova['std'].append(df["rf_std"].loc[0])
anova['std'].append(df["svm_std"].loc[0])
anova['std'].append(df["knn_std"].loc[0])
anova['percent'].append(df["dt_percent"].loc[0])
anova['percent'].append(df["rf_percent"].loc[0])
anova['percent'].append(df["svm_percent"].loc[0])
anova['percent'].append(df["knn_percent"].loc[0])
anova['time'].append(df["dt_time"].loc[0])
anova['time'].append(df["rf_time"].loc[0])
anova['time'].append(df["svm_time"].loc[0])
anova['time'].append(df["knn_time"].loc[0])
elif("original" in name):
original['mean'].append(df["dt_mean"].loc[0])
original['mean'].append(df["svm_mean"].loc[0])
original['mean'].append(df["rf_mean"].loc[0])
original['mean'].append(df["knn_mean"].loc[0])
original['std'].append(df["dt_std"].loc[0])
original['std'].append(df["rf_std"].loc[0])
original['std'].append(df["svm_std"].loc[0])
original['std'].append(df["knn_std"].loc[0])
original['time'].append(df["dt_time"].loc[0])
original['time'].append(df["rf_time"].loc[0])
original['time'].append(df["svm_time"].loc[0])
original['time'].append(df["knn_time"].loc[0])
elif("pca" in name):
principal['mean'].append(df["dt_mean"].loc[0])
principal['mean'].append(df["svm_mean"].loc[0])
principal['mean'].append(df["rf_mean"].loc[0])
principal['mean'].append(df["knn_mean"].loc[0])
principal['std'].append(df["dt_std"].loc[0])
principal['std'].append(df["rf_std"].loc[0])
principal['std'].append(df["svm_std"].loc[0])
principal['std'].append(df["knn_std"].loc[0])
principal['percent'].append(df["dt_percent"].loc[0])
principal['percent'].append(df["rf_percent"].loc[0])
principal['percent'].append(df["svm_percent"].loc[0])
principal['percent'].append(df["knn_percent"].loc[0])
principal['time'].append(df["dt_time"].loc[0])
principal['time'].append(df["rf_time"].loc[0])
principal['time'].append(df["svm_time"].loc[0])
principal['time'].append(df["knn_time"].loc[0])
elif("vt" in name):
variance['mean'].append(df["dt_mean"].loc[0])
variance['mean'].append(df["svm_mean"].loc[0])
variance['mean'].append(df["rf_mean"].loc[0])
variance['mean'].append(df["knn_mean"].loc[0])
variance['std'].append(df["dt_std"].loc[0])
variance['std'].append(df["rf_std"].loc[0])
variance['std'].append(df["svm_std"].loc[0])
variance['std'].append(df["knn_std"].loc[0])
variance['percent'].append(df["dt_percent"].loc[0])
variance['percent'].append(df["rf_percent"].loc[0])
variance['percent'].append(df["svm_percent"].loc[0])
variance['percent'].append(df["knn_percent"].loc[0])
variance['time'].append(df["dt_time"].loc[0])
variance['time'].append(df["rf_time"].loc[0])
variance['time'].append(df["svm_time"].loc[0])
variance['time'].append(df["knn_time"].loc[0])
pd.DataFrame({"Chi-squared": chisquared['mean'],"F ANOVA": anova['mean'], "PCA": principal['mean'], "Variance": variance['mean'], "Original": original['mean']}).to_csv("./results/performance.csv",index = False)
pd.DataFrame({"Chi-squared": chisquared['percent'],"F ANOVA": anova['percent'], "PCA": principal['percent'], "Variance": variance['percent']}).to_csv("./results/reduction.csv",index = False)
pd.DataFrame({"Chi-squared": chisquared['time'],"F ANOVA": anova['time'], "PCA": principal['time'], "Variance": variance['time'], "Original": original['time']}).to_csv("./results/time.csv",index = False)