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 ...