Algorithm · Pinterest · Medium
Suppose you are building a feature that recommends related Pins. For this exercise, assume every Pin is represented by a dense embedding: a fixed-length list of floating-point numbers. All embeddings, including the query embedding, have the same dimension. Write a function top_similar(query_id, query_vec, candidates, k) that takes a query Pin identifier, its embedding vector query_vec, a dictionary candidates mapping candidate Pin identifiers to their embedding vectors, and…
Checking your access…