Item-based collaborative filtering and recommendations

Item-based collaborative filtering is similar to the user-based approach, except that it is using the similarity measures between items, instead of between users or customers. We had to compute cosine similarities between users before, but now we are going to compute cosine similarities between items. Take a look at the following code:

# Item-to-Item Similarity MatrixitemToItemSimMatrix <- cosine(  as.matrix(    # excluding CustomerID column    customerItemMatrix[, 2:dim(customerItemMatrix)[2]]  ))

If you compare this code to the previous code, where we computed user-to-user similarity matrix, the only difference is the fact that we are not transposing the customerItemMatrix this time. We are ...

Get Hands-On Data Science for Marketing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.