1
$\begingroup$

I try to understand item based collaborative filtering by studying the recommenderlab documentation. On page 7 the calculation of expected ratings for items unrated by the user is very nicely illustrated but I cannot reproduce the results.

For item $i_3$ (row three of the matrix) the bold matrix elements are the $k = 3$ other most similar components and $\mathcal{S}(i_3) = \{i_2,i_5,i_8 \}$. The estimated rating for the third product is $$\hat{r}_{u3} = \frac{0.8\cdot 0 +0.4 \cdot 4+0.5 \cdot 5}{0.8+0.4+0.5} = 2.41$$ but it is supposed to equal 4.6.

what am I doing wrong here?

Screenshot of Page 7 of the recommenderlab documentation

$\endgroup$
3
$\begingroup$

My equation in the vignette of recomenderlab is unfortunately slightly incorrect since the weight is only the sum of the most similar components $S(i)$ for which we have user ratings (i.e., $r_{ai} \ne ?$).

The corrected equation is:

\begin{equation} \hat{r}_{ai} = \frac{1}{\sum_{j \in S(i)\cap \{l\,;\,r_{al} \ne ?\}}{s_{ij}}} \sum_{j \in S(i)\cap \{l\,;\,r_{al} \ne ?\}}{s_{ij} r_{aj}} \end{equation}

This gives: $$ \hat{r}_{a3} = \frac{0.4 \cdot 4+0.5 \cdot 5}{0.4+0.5} = 4.6 $$

Unfortunately, the figure was also quite misleading, so I changed it as well (basically $u_a$ is now where $r_a$ was and vice versa).

Hope I got it right this time! Thanks for spotting the mistake. I will update the vignette for the next version of the package.

-Michael

$\endgroup$
  • $\begingroup$ I have a question regarding this calculation. I am trying to build an item based recommendation system. My question is what prediction do you assign if the intersection of the top k items and the user ratings are empty? $\endgroup$ – RDizzl3 Sep 11 '17 at 23:17
  • $\begingroup$ Then you just have no recommendation. In an actual implementation of a recommender system, you probably will resort to recommending popular items instead. $\endgroup$ – Michael Hahsler Sep 13 '17 at 3:30

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.