-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcounter.py
69 lines (61 loc) · 2.23 KB
/
counter.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
#read text from .txt file
#check if text contains counterexample found or not
#loop through indecies 0-99 in the txt filename
#do epsilon 0.01,0.05,0.1,0.5
#write to csv
#eps=0.01
csv01 = open("moreresults0.01.csv", "w")
for i in range(100,500,1):
filename = './logs/fashion1l32n/onelayer32n0.01-' + str(i) + '.txt'
with open(filename) as f:
data = f.read()
if ' robust [=========================================================] 9/9 queries' in data:
csv01.write(str(i) + ",1\n")
elif 'counterexample found' in data:
csv01.write(str(i) + ",0\n")
else:
print("Major error; check" + filename)
f.close()
csv01.close()
#eps=0.05
csv05 = open("moreresults0.05.csv", "w")
for i in range(100,500,1):
filename = './logs/fashion1l32n/onelayer32n0.05-' + str(i) + '.txt'
with open(filename) as f:
data = f.read()
if ' robust [=========================================================] 9/9 queries' in data:
csv05.write(str(i) + ",1\n")
elif 'counterexample found' in data:
csv05.write(str(i) + ",0\n")
else:
print("Major error; check" + filename)
f.close()
csv05.close()
#eps=0.1
csv1 = open("moreresults0.1.csv", "w")
for i in range(100,500,1):
filename = './logs/fashion1l32n/onelayer32n0.1-' + str(i) + '.txt'
with open(filename) as f:
data = f.read()
if ' robust [=========================================================] 9/9 queries' in data:
csv1.write(str(i) + ",1\n")
elif 'counterexample found' in data:
csv1.write(str(i) + ",0\n")
else:
print("Major error; check" + filename)
f.close()
csv1.close()
#eps=0.5
csv5 = open("moreresults0.5.csv", "w")
for i in range(100,500,1):
filename = './logs/fashion1l32n/onelayer32n0.5-' + str(i) + '.txt'
with open(filename) as f:
data = f.read()
if ' robust [=========================================================] 9/9 queries' in data:
csv5.write(str(i) + ",1\n")
elif 'counterexample found' in data:
csv5.write(str(i) + ",0\n")
else:
print("Major error; check" + filename)
f.close()
csv5.close()