-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathextract_test_set_accuracy.py
64 lines (58 loc) · 1.84 KB
/
extract_test_set_accuracy.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
import numpy as np
import pandas as pd
import os
data = {
4: {
"MNIST": {
"cosine": [
"mnist/acc_MNIST_t0.csv",
"mnist/acc_MNIST_t1.csv",
"mnist/acc_MNIST_t2.csv",
],
},
"FashionMNIST": {
"cosine": [
"fmnist/acc_FMNIST_t0.csv",
"fmnist/acc_FMNIST_t1.csv",
"fmnist/acc_FMNIST_t2.csv",
],
},
"DVS128 Gesture": {
"cosine": [
"DVS/acc_DVS_t0.csv",
"DVS/acc_DVS_t1.csv",
"DVS/acc_DVS_t2.csv",
],
},
},
}
df = pd.DataFrame(
columns=[
"dataset",
"network_precision",
"scheduler",
"test_set_accuracy_best",
"test_set_accuracy_mean",
"test_set_accuracy_std",
]
)
for precision in data.keys():
for dataset_idx, dataset in enumerate(data[precision].keys()):
for scheduler in data[precision][dataset].keys():
test_set_accuracy_values = []
for idx, trial in enumerate(data[precision][dataset][scheduler]):
trial_df = pd.read_csv(trial)
test_set_accuracy = trial_df["test_acc"].max().item()
test_set_accuracy_values.append(test_set_accuracy)
df = df.append(
{
"dataset": dataset,
"network_precision": precision,
"scheduler": scheduler,
"test_set_accuracy_best": max(test_set_accuracy_values),
"test_set_accuracy_mean": np.mean(test_set_accuracy_values),
"test_set_accuracy_std": np.std(test_set_accuracy_values),
},
ignore_index=True,
)
df.to_csv("test_set_accuracy.csv", index=False)