Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/contentbased.py Secret

Created Feb 10, 2021
Embed
What would you like to do?
tfidf = TfidfVectorizer(stop_words='english')
movies['overview'] = movies['overview'].fillna('')
overview_matrix = tfidf.fit_transform(movies['overview'])
similarity_matrix = linear_kernel(overview_matrix,overview_matrix)
mapping = pd.Series(movies.index,index = movies['title'])
print(mapping)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment