You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you calculate the predictions for in the recommenders, the user mean is calculated, but then substracted from each rating, resulting in it being canceled out. Example:
**user_mean** = sum(movie_ids.values()) / len(movie_ids)
candidate_items = Similarity.objects.filter(Q(source__in=movie_ids.keys())
& ~Q(target__in=movie_ids.keys())
& Q(similarity__gt=self.min_sim)
)
candidate_items = candidate_items.order_by('-similarity')[:self.max_candidates]
recs = dict()
for candidate in candidate_items:
target = candidate.target
pre = 0
sim_sum = 0
rated_items = [i for i in candidate_items if i.target == target][:self.neighborhood_size]
if len(rated_items) > 1:
for sim_item in rated_items:
r = Decimal(movie_ids[sim_item.source] - **user_mean**)
pre += sim_item.similarity * r
sim_sum += sim_item.similarity
if sim_sum > 0:
recs[target] = {'prediction': Decimal(**user_mean**) + pre / sim_sum,
'sim_items': [r.source for r in rated_items]}
I illustrated what is happening with equations. You can see that the user mean is cancelled out and the result we get is not the same formula as the one in the book:
Formula in the book:
The text was updated successfully, but these errors were encountered:
ksiar137
changed the title
User mean is cancelled out in reccomenders
User mean is cancelled out in recomenders
Mar 10, 2024
ksiar137
changed the title
User mean is cancelled out in recomenders
User mean is cancelled out in recommenders
Mar 10, 2024
When you calculate the predictions for in the recommenders, the user mean is calculated, but then substracted from each rating, resulting in it being canceled out.
Example:
I illustrated what is happening with equations. You can see that the user mean is cancelled out and the result we get is not the same formula as the one in the book:
Formula in the book:
The text was updated successfully, but these errors were encountered: