Calmcode - annoy: accuracy

Tuning the Accuracy in Annoy

1 2 3 4 5 6 7 8

The code below should be more accurate than before.

annoy = AnnoyIndex(columns, 'euclidean')
for i in range(vecs.shape[0]):
    annoy.add_item(i, vecs[i, :])
# this is the line that we changed from 1 -> 10
annoy.build(n_trees=10)

plt.figure(figsize=(5, 5))
plt.scatter(vecs[:, 0], vecs[:, 1], s=1);

indices = annoy.get_nns_by_vector(np.array([-1., -1.]), 2000)

subset = vecs[indices, :]
# this should now show a proper circle
plt.scatter(subset[:, 0], subset[:, 1], s=1);