Here is how we proceed with collaborating filtering systems:
- First, define ratings_movies, the matrix containing users who have rated at least 50 movies and the movies that have been watched at least 100 times:
> ratings_movies <- MovieLense[rowCounts(MovieLense) > 50, colCounts(MovieLense) > 100]
- Now split the ratings_movies matrix into training and test sets using an 80/20 ratio:
> which_train <- sample(x = c(TRUE, FALSE), size = nrow(ratings_movies), replace = TRUE, prob = c(0.8, 0.2)) > recc_data_train <- ratings_movies[which_train, ] > recc_data_test <- ratings_movies[!which_train, ]
The Recommenderlab package provides you with the evaluationScheme function to perform advance splitting of datasets. Refer to the ...