Home › Forums › KDB.AI › Get the cosine similarity scores along with the retrieved docs › Reply To: Get the cosine similarity scores along with the retrieved docs
-
Hi @Sosycs
As an example I’ve used snippets from our Document Search sample (screenshot below):
Simply change the metric to: “metric” : “CS”.
To see the distance print the results of the similarity search (the distance will be in a column in the result called “__nn_distance”:
print(table.search(query_vector, n=3))
Also take a look at our documentation on cosine similarity for extra help – KDB.AI Similarity Metrics – Documentation (kx.com)
Hope this helps!
Thanks,
Megan