1
$\begingroup$

My data is:
userID, gameID, rating (1.0 through 10.0) First, I normalize the values the ratings of each row. I use cosine similarity to create a similarity matrix where each cell represents similarity between a pair of userIDs (value 0.0 through 1.0). For each unrated gameID, I find the 10 most similar users that have rated the gameID. The predicted rating is equal to the sum of each neighbors rating times similarity, then divided by 10 (number of neighbors).

This seems fine for finding the best predictions, just take the top N rating values, but for actually predicting the values it doesn't perform so well. Intuitively, the average of a group of similar userID's ratings would be an accurate prediction. When each rating is made smaller by multiplying by a value that is always less than 1.0, the predicted value is consistently smaller than expected.

This seemed to follow formulas that I found, but I feel like I missed something. I am using Python, Pandas, and Numpy.

Edit I am seeing that this final value is sometimes referred to as a "weighted predicted rating". I am wondering how to "de-weight".

$\endgroup$
0
$\begingroup$

The predicted rating is equal to the sum of each neighbors rating times similarity, then divided by 10 (number of neighbors).

You want to obtain a weighted-average of ratings, where the weight is the similarity score. Instead of dividing by 10 above, you should divide by the sum of similarities, to get a correct normalized score. Dividing by 10 is the likely reason for the predictions to be smaller than expected.

The formula you should use is:

Final score = Sum_over_neighbours(Rating * Similarity) / Sum_over_neighbours(Similarity)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.