-
Notifications
You must be signed in to change notification settings - Fork 2
/
compute_accuracy.py
43 lines (39 loc) · 1.12 KB
/
compute_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
predictions = {}
with open('boost.1.predictions', 'r') as f:
for line in f:
word_num = 0
guess = None
real = None
for word in line.split():
if word_num == 0:
guess = word
elif word_num == 1:
real = word
word_num += 1
if predictions.get((real, guess)) is None:
predictions[(real, guess)] = 0
predictions[(real, guess)] += 1
for x,y in predictions.iteritems():
if x[0] == 'Rembrant':
print x, y/float(50) * 100, "%"
print ""
for x,y in predictions.iteritems():
if x[0] == 'Picasso':
print x,y/float(50) * 100, "%"
print ""
for x,y in predictions.iteritems():
if x[0] == 'Dali':
print x,y/float(50) * 100, "%"
print ""
for x,y in predictions.iteritems():
if x[0] == 'VanGogh':
print x,y/float(50) * 100, "%"
print ""
for x,y in predictions.iteritems():
if x[0] == 'Monet':
print x,y/float(50) * 100, "%"
print ""
for x,y in predictions.iteritems():
if x[0] == 'Turner':
print x,y/float(50) * 100, "%"
# print x, y/float(50) * 100, "%"