Process Query

To process the query, we find out its similarity with other questions, we do it by taking a dot product of training data matrix with the transpose of query data:

XX_similarity=np.dot(X_train.todense(), X_query.transpose().todense())

Now, we take out the similarity between the query and train data as a list:

XX_sim_scores= np.array(XX_similarity).flatten().tolist()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.97.40