fq = open('annoy_fq.txt', 'a') ff = open('annoy_ff.txt', 'a') tree_size = [100, 200, 400] _k = [ 100, 200, 400, 1000, 2000, 4000, 10000, 20000, 40000, 100000, 200000, 400000 ] for ts in tree_size: for kk in _k: break print("tree_Size:", ts, "kk:", kk) start_graph = time.time() t = AnnoyIndex( 128, 'euclidean') # Length of item vector that will be indexed for i in range(len(xb)): t.add_item(i, xb[i]) t.build(ts) # 10 trees end_graph = time.time() start_query = end_graph accuracy = 0 for i in range(len(xq)): ans = t.get_nns_by_vector(xq[i], k, kk) for x in ans: if x in gt[i]: accuracy += 1 end_query = time.time() f = open('annoy_results.txt', 'a') fg = open('annoy_fg.txt', 'a') fq = open('annoy_fq.txt', 'a')