O'Reilly logo

Building a Recommendation System with R by Suresh K. Gorakala

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User-based collaborative filtering on binary data

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:

User-based collaborative filtering on binary data

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required