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?
def recommend_movies(movie_input):
movie_index = mapping[movie_input]
similarity_score = list(enumerate(similarity_matrix[movie_index]))
similarity_score = sorted(similarity_score, key=lambda x: x[1], reverse=True)
similarity_score = similarity_score[1:15]
movie_indices = [i[0] for i in similarity_score]
return (movies['title'].iloc[movie_indices])
print(recommend_movies('Life Begins for Andy Hardy'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment