Skip to content

Commit

Permalink
plot y axis as 'queries per second'
Browse files Browse the repository at this point in the history
(instead of 'time per query' with inverted scale - marginally more logical)
  • Loading branch information
Erik Bernhardsson committed Jun 23, 2015
1 parent 700305d commit bcfe374
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
for algo, color in zip(all_data.keys(), colors):
data = all_data[algo]
data.sort(key=lambda t: t[-2]) # sort by time
xs = [t[-2] for t in data]
ys = [t[-1] for t in data]
ys = [1.0 / t[-2] for t in data] # queries per second
xs = [t[-1] for t in data]
ls = [t[0] for t in data]
plt.plot(xs, ys, 'o', label=algo, color=color, markersize=3)
#for i, l in enumerate(ls):
Expand All @@ -37,20 +37,20 @@
y = t[-1]
if y > last_y:
last_y = y
ys.append(t[-1])
xs.append(t[-2])
xs.append(t[-1])
ys.append(1.0 / t[-2])
handle, = plt.plot(xs, ys, 'o-', label=algo, color=color)
handles.append(handle)
labels.append(algo)

plt.gca().set_xscale('log')
plt.gca().set_title('Precision-Performance tradeoff - up and to the left is better')
plt.gca().set_xlabel('Time per query (s) - lower is better')
plt.gca().set_ylabel('10-NN precision - higher is better')
plt.gca().set_yscale('log')
plt.gca().set_title('Precision-Performance tradeoff - up and to the right is better')
plt.gca().set_ylabel('Queries per second ($s^{-1}$) - larger is better')
plt.gca().set_xlabel('10-NN precision - larger is better')
box = plt.gca().get_position()
plt.gca().set_position([box.x0, box.y0, box.width * 0.8, box.height])
plt.gca().legend(handles, labels, loc='center left', bbox_to_anchor=(1, 0.5))
plt.grid(b=True, which='both', color='0.65',linestyle='-')
plt.ylim([0, 1.03])
plt.xlim([0.0, 1.03])
plt.savefig(args.output, bbox_inches='tight')

Binary file modified results/glove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified results/sift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions results/sift.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ nearpy NearPy(n_bits=16, hash_counts=40) 2689.25678992 1.5009472332 0.9558
flann FLANN(target_precision=0.500000) 909.874325991 0.000199952125549 0.2007
bruteforce BruteForce() 0.203589916229 0.744261413097 1.0
flann FLANN(target_precision=0.970000) 1713.85552406 0.00541697478294 0.8703
nearpy NearPy(n_bits=16, hash_counts=5) 420.568459034 0.211184137106 0.4588

0 comments on commit bcfe374

Please sign in to comment.