Similar to IBCF, we need to use the Jaccard index for UBCF. Given two users, the index is computed as the number of items purchased by both the users divided by the number of items purchased by at least one of them. The mathematical symbols are the same as in the previous section:
Let's build the recommender model:
recc_model < Recommender(data = recc_data_train, method = "UBCF", parameter = list(method = "Jaccard"))
Using the same commands as IBCF, let's recommend six movies to each user, and let's take a look at the first four users:
n_recommended < 6 recc_predicted < predict(object = recc_model, newdata = recc_data_test,n = n_recommended) recc_matrix < sapply(recc_predicted@items, function(x){colnames(ratings_movies)[x] }) dim(recc_matrix) ## [1] 6 109 recc_matrix[, 1:4]







