Skip to content

Commit

Permalink
fix: fixed the second argument of the get_recommendation function to …
Browse files Browse the repository at this point in the history
…add 1 to whatever the input is since python does lists inclusive-to-exclusive
  • Loading branch information
BfdCampos committed Jun 20, 2022
1 parent 06d6835 commit 5a64239
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_recommendations(title, top, cosine_sim=cosine_sim):
idx = indices[title]
sim_scores = list(enumerate(cosine_sim[idx]))
sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)
sim_scores = sim_scores[1:int(top)]
sim_scores = sim_scores[1:int(top) + 1]
movie_indices = [i[0] for i in sim_scores]
return metadata['title'].iloc[movie_indices]

Expand Down

0 comments on commit 5a64239

Please sign in to comment.