Created
July 19, 2020 05:05
-
-
Save vaibhavgehani/1bad0c7e852315945b905e605058780f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def recommend_movie(movieName,cosine_sim=cosine_sim): | |
try: | |
indx=indices[movieName] | |
score_tuple=list(enumerate(cosine_sim[indx])) | |
sorted_tuple=sorted(score_tuple,key=lambda x: x[1],reverse=True) | |
top_10_score=sorted_tuple[1:6] | |
top_10_index=[i[0] for i in top_10_score] | |
return movie_data[['title','spoken_languages','popularity','release_date','runtime','poster_path']].iloc[top_10_index] | |
except(Exception): | |
print('Erorr') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment