Practice lab2, week2, course3

Hi everyone,

I’m working on Practice Lab 2, Week 2, Course 3 (C3_W2_RecSysNN_Assignment) and encountered an issue. When I ran the code snippet below to print the ratings for all 847 movies, I noticed that every movie has the same rating value of 5. it means that based on the trained model, the new user will rate all the movies 5. This seems unusual and I suspect there might be an error. Has anyone else experienced this, or can provide some insight into what might be going wrong?
Thank you!
(mohamad.fe842@gmail.com)

generate and replicate the user vector to match the number of movies in the data set.

user_vecs = gen_user_vecs(user_vec,len(item_vecs))

scale our user and item vectors

suser_vecs = scalerUser.transform(user_vecs)
sitem_vecs = scalerItem.transform(item_vecs)

make a prediction

y_p = model.predict([suser_vecs[:, u_s:], sitem_vecs[:, i_s:]])

unscale y prediction

y_pu = scalerTarget.inverse_transform(y_p)

sort the results, highest prediction first

sorted_index = np.argsort(-y_pu,axis=0).reshape(-1).tolist() #negate to get largest rating first
sorted_ypu = y_pu[sorted_index]
sorted_items = item_vecs[sorted_index] #using unscaled vectors for display

print_pred_movies(sorted_ypu, sorted_items, movie_dict, maxcount = 847)

1 Like

Hi @Mohammad_ferdosian

First, make sure that the scalerUser, scalerItem, and scalerTarget are fitted and applied properly. Additionally, check that the slicing of vectors fed into the model is appropriate and the functions that are being called are correct.

You can print variables is each step to find out where the problem is!

2 Likes