Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return AnnoyTripletGenerator(X, index, k=k,
batch_size=batch_size,
search_k=search_k)
else:
if precompute:
if verbose > 0:
print('Extracting KNN from index')
neighbour_matrix = extract_knn(X, index_path, k=k,
search_k=search_k, verbose=verbose)
return LabeledKnnTripletGenerator(X, Y, neighbour_matrix,
batch_size=batch_size)
else:
index = AnnoyIndex(X.shape[1], metric='angular')
index.load(index_path)
return LabeledAnnoyTripletGenerator(X, Y, index,
k=k, batch_size=batch_size,
search_k=search_k)