Hands-On Recommendation Systems with Python by Rounak Banik

Hands-On Recommendation Systems with Python by Rounak Banik

Author:Rounak Banik
Language: eng
Format: epub
Tags: COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM042000 - COMPUTERS / Natural Language Processing, COM018000 - COMPUTERS / Data Processing
Publisher: Packt Publishing
Published: 2018-07-31T08:18:12+00:00


#Compute the cosine similarity score (equivalent to dot product for tf-idf vectors)

cosine_sim2 = cosine_similarity(count_matrix, count_matrix)

Since we dropped a few movies with bad indices, we need to construct our reverse mapping again. Let's do that as the next step:

# Reset index of your df and construct reverse mapping again

df = df.reset_index()

indices2 = pd.Series(df.index, index=df['title'])

With the new reverse mapping constructed and the similarity scores computed, we can reuse the content_recommender function defined in the previous section by passing in cosine_sim2 as an argument. Let's now try out our new model by asking recommendations for the same movie, The Lion King:

content_recommender('The Lion King', cosine_sim2, df, indices2)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.