data("MovieLense")
MovieLense100 <- MovieLense[rowCounts(MovieLense) >100,]
train <- MovieLense100[1:100]
test <- MovieLense100[101:103]
## mix popular movies with a random recommendations for diversity and
## rerecommend some movies the user liked.
recom <- HybridRecommender(
Recommender(train, method = "POPULAR"),
Recommender(train, method = "RANDOM"),
Recommender(train, method = "RERECOMMEND"),
weights = c(.6, .1, .3)
)
recom
getModel(recom)
as(predict(recom, test), "list")
## create a hybrid recommender using the regular Recommender interface.
## This is needed to use hybrid recommenders with evaluate().
recommenders <- list(
RANDOM = list(name = "POPULAR", param = NULL),
POPULAR = list(name = "RANDOM", param = NULL),
RERECOMMEND = list(name = "RERECOMMEND", param = NULL)
)
weights <- c(.6, .1, .3)
recom <- Recommender(train, method = "HYBRID",
parameter = list(recommenders = recommenders, weights = weights))
recom
as(predict(recom, test), "list")
Run the code above in your browser using DataLab