Skip to content

Commit

Permalink
COSMIT prefer loops to repetition in LSHForest benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
jnothman committed Aug 9, 2015
1 parent 44fd56b commit 7fca5a1
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions benchmarks/bench_plot_approximate_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,16 @@ def calc_accuracy(X, queries, n_queries, n_neighbors, exact_neighbors,

# Set labels for LSHForest parameters
colors = ['c', 'm', 'y']
p1 = plt.Rectangle((0, 0), 0.1, 0.1, fc=colors[0])
p2 = plt.Rectangle((0, 0), 0.1, 0.1, fc=colors[1])
p3 = plt.Rectangle((0, 0), 0.1, 0.1, fc=colors[2])
legend_rects = [plt.Rectangle((0, 0), 0.1, 0.1, fc=color)
for color in colors]

labels = ['n_estimators=' + str(params_list[0]['n_estimators']) +
', n_candidates=' + str(params_list[0]['n_candidates']),
'n_estimators=' + str(params_list[1]['n_estimators']) +
', n_candidates=' + str(params_list[1]['n_candidates']),
'n_estimators=' + str(params_list[2]['n_estimators']) +
', n_candidates=' + str(params_list[2]['n_candidates'])]
legend_labels = ['n_estimators={n_estimators}, '
'n_candidates={n_candidates}'.format(**p)
for p in params_list]

# Plot precision
plt.figure()
plt.legend((p1, p2, p3), (labels[0], labels[1], labels[2]),
plt.legend(legend_rects, legend_labels,
loc='upper left')

for i in range(len(params_list)):
Expand All @@ -154,7 +150,7 @@ def calc_accuracy(X, queries, n_queries, n_neighbors, exact_neighbors,

# Plot speed up
plt.figure()
plt.legend((p1, p2, p3), (labels[0], labels[1], labels[2]),
plt.legend(legend_rects, legend_labels,
loc='upper left')

for i in range(len(params_list)):
Expand Down

0 comments on commit 7fca5a1

Please sign in to comment.