How to use Google's Universal Sentence Encoder to find the most similar document based on several documents?

Viewed 201

I'm trying to build a simple recommendation system which uses Google's Universal Sentence Encoder to transform the description of different products into vector space. I am pre-computing the embeddings for all the different products. Currently I can give the top N recommendations based upon a single product by calculating the cosine distance between the chosen product and all the other products.

   chosen_product_idx = product_df.index[product_df['Name']== chosen_product][0] 
   ranking_list = []
      for i in products['names']
         ranking_list.append((products['names'][i],cosine_distance(products['product_vector'][chosen_product_idx],products['product_vector'][i]))
       ... 
       ...

But if a user would say that "I like these 10 products", what is the best way to take that into consideration when making a recommendation? I do not have any data regarding which companies the user does NOT like. Is it to take the average vector of all those 10 products and then find the closest vectors to that?

Or treat them as a cluster and find the centroid and make a recommendation based on that?

Does anyone know any good practices for this?

0 Answers
Related