Item-based models

This is a model-based approach. From a given ratings matrix, this method explores the relationship between the items. Based on the ratings, different users provide different items, and an item-to-item similarity matrix is derived. Once again, as in the user-based model, Pearson coefficient or cosine distance is used as a similarity metric. For each item, we store the top K similar items, rather than storing all the items for efficiency purposes. A weighted sum idea is used to finally make a recommendation for a user. Refer to the paper from Amazon for more about item-based filtering: https://dl.acm.org/citation.cfm?id=642471

The following code shows how to perform item-based recommendations:

> plan <- evaluationScheme(data, method="cross", train=0.9, given = 10, goodRating=5)
> results <- evaluate(plan, method = "IBCF", type = "topNList", n = c(5,10,15) )
IBCF run fold/sample [model time/prediction time]
1 [0.096sec/0.038sec]
2 [0.086sec/0.028sec]
3 [0.092sec/0.032sec]
4 [0.098sec/0.035sec]
5 [0.347sec/0.03sec]
6 [0.093sec/0.026sec]
7 [0.099sec/0.033sec]
8 [0.087sec/0.03sec]
9 [0.094sec/0.035sec]
10 [0.1sec/0.03sec]
> avg(results)
TP FP FN TN precision recall TPR FPR
5 0.7533333 4.246667 15.68600 69.31400 0.1506667 0.03764956 0.03764956 0.05794888
10 1.5920000 8.408000 14.84733 65.15267 0.1592000 0.09053889 0.09053889 0.11464379
15 2.5126667 12.487333 13.92667 61.07333 0.1675111 0.14731668 0.14731668 0.16999810

As you can see, the class structure of recommenderlab is very elegant; the only change we made was to use IBCF as the value to the method parameter.

Let us also look at the RMSE metrics for this model:

> results.1 <- evaluate(plan, method = "IBCF", type = "ratings" )
> avg(results.1)
RMSE MSE MAE
res 5.352557 28.67655 4.154455

The RMSE is higher than the user-based model. Which is not surprising. Item-based model typically performs slightly poorer than the user-based model. The trade off is memory usage. User-based model consumes more memory but gives better results.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset