Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Background changes and additional tab #89

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
99a0b8c
Add files via upload
Mmabatho-08 Jul 12, 2023
73f8bb6
Add files via upload
Matsawela-Precious Jul 17, 2023
bb951a0
Add files via upload
Matsawela-Precious Jul 17, 2023
5898429
Replacements in the 'Home' page and made additions in the 'About Us' …
MatlalaNyama Jul 18, 2023
5379e90
Update edsa_recommender.py
MatlalaNyama Jul 19, 2023
7be492f
Merge pull request #2 from DN-2-Unsupervised/MatlalaNyama-Unsupervised
nassau-carstens Jul 19, 2023
77b4f33
Add files via upload
Mmabatho-08 Jul 20, 2023
6f85650
Add files via upload
Mmabatho-08 Jul 20, 2023
29388c4
Merge branch 'master' into Mmabatho
Mmabatho-08 Jul 21, 2023
7e0c31c
Merge pull request #3 from DN-2-Unsupervised/Mmabatho
Mmabatho-08 Jul 21, 2023
6a7a48d
Add files via upload
Mmabatho-08 Jul 24, 2023
02b97e3
Add files via upload
Mmabatho-08 Jul 24, 2023
17debfc
Merge pull request #4 from DN-2-Unsupervised/Mmabatho
Mmabatho-08 Jul 24, 2023
029808d
Adding SVD and fixing collab model
nassau-carstens Jul 25, 2023
07de782
Merge pull request #5 from DN-2-Unsupervised:feat/nc/models2-25-07-2023
nassau-carstens Jul 25, 2023
e8d1294
Reuploading pkl file
nassau-carstens Jul 25, 2023
d518ec3
Merge pull request #6 from DN-2-Unsupervised:feat/nc/pkl-25-07-2023
nassau-carstens Jul 25, 2023
fd97157
Feat/nc/libs-25-07-2023
nassau-carstens Jul 25, 2023
de3e019
Merge pull request #8 from DN-2-Unsupervised:feat/nc/libs-25-07-2023
nassau-carstens Jul 25, 2023
5537c24
Squashed commit of the following:
MatlalaNyama Jul 26, 2023
eb5393d
Squashed commit of the following:
MatlalaNyama Jul 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
344 changes: 338 additions & 6 deletions edsa_recommender.py

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions recommenders/collaborative_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,33 @@ def collab_model(movie_list,top_n=10):

"""

indices = pd.Series(movies_df['title'])
movie_ids = pred_movies(movie_list)
df_init_users = ratings_df[ratings_df['userId']==movie_ids[0]]
for i in movie_ids :
df_init_users=df_init_users.append(ratings_df[ratings_df['userId']==i])
# Getting the cosine similarity matrix
cosine_sim = cosine_similarity(np.array(df_init_users), np.array(df_init_users))
idx_1 = indices[indices == movie_list[0]].index[0]
idx_2 = indices[indices == movie_list[1]].index[0]
idx_3 = indices[indices == movie_list[2]].index[0]
# Creating a Series with the similarity scores in descending order
rank_1 = cosine_sim[idx_1]
rank_2 = cosine_sim[idx_2]
rank_3 = cosine_sim[idx_3]
# Calculating the scores
score_series_1 = pd.Series(rank_1).sort_values(ascending = False)
score_series_2 = pd.Series(rank_2).sort_values(ascending = False)
score_series_3 = pd.Series(rank_3).sort_values(ascending = False)
# Appending the names of movies
listings = score_series_1.append(score_series_1).append(score_series_3).sort_values(ascending = False)
recommended_movies = []
# Choose top 50
top_50_indexes = list(listings.iloc[1:50].index)
# Removing chosen movies
top_indexes = np.setdiff1d(top_50_indexes,[idx_1,idx_2,idx_3])
for i in top_indexes[:top_n]:
recommended_movies.append(list(movies_df['title'])[i])
return recommended_movies
user_movie_titles = movie_list

title_to_id = movies_df.set_index('title')['movieId'].to_dict()

title_to_id = movies_df.set_index('title')['movieId'].to_dict()

id_to_title = movies_df.set_index('movieId')['title'].to_dict()

new_user_ratings = []

for title in user_movie_titles:
movie_id = title_to_id[title]
new_user_ratings.append((9999, movie_id, 5))

new_ratings_df = ratings_df.append(pd.DataFrame(new_user_ratings, columns=['userId', 'movieId', 'rating']), ignore_index=True)

predictions = []
for movie_id in movies_df['movieId']:
prediction = model.predict(9999, movie_id)
predictions.append((id_to_title[movie_id], prediction.est))

sorted_predictions = sorted(predictions, key=lambda x: x[1], reverse=True)

top_10_movies = sorted_predictions[:10]
for title, rating in top_10_movies:
print(f"{title}: {rating}")

top_10_movie_titles = [title for title, rating in top_10_movies]

return top_10_movie_titles
417 changes: 417 additions & 0 deletions requirements.txt

Large diffs are not rendered by default.

Binary file added resources/imgs/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/Flix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/Home.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/Logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/M.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/Test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/W.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/back_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/back_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/cap1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/contact.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/direct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/feedback.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/feedback3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/film2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/genres.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/istockphoto.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/movie_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/photo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/red-white-bucket.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/red6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/top15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/imgs/ziDycY.webp
Binary file not shown.
Binary file modified resources/models/SVD.pkl
Binary file not shown.