Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def similar_products(v, n = 6):
# extract most similar products for the input vector
ms = model.similar_by_vector(v, topn= n+1)[1:]
# extract name and similarity score of the similar products
new_ms = []
for j in ms:
pair = (products_dict[j[0]][0], j[1])
return new_ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment