recommenderlab - Lab for Developing and Testing Recommender Algorithms - R package

CRAN version CRAN RStudio mirror downloads R-CMD-check AppVeyor Build Status

This R package provides an infrastructure to test and develop recommender algorithms. The package supports rating (e.g., 1-5 stars) and unary (0-1) data sets. Supported algorithms are:

For evaluation, the framework supports given-n and all-but-x protocols with

Evaluation measures are:


Stable CRAN version: install from within R with


Current development version: Download package from AppVeyor or install from GitHub (needs devtools).



Load the package and prepare a dataset (included in the package).

### use only users with more than 100 ratings
MovieLense100 <- MovieLense[rowCounts(MovieLense) >100,]
358 x 1664 rating matrix of class ‘realRatingMatrix’ with 73610 ratings.

Train a user-based collaborative filtering recommender using a small training set.

train <- MovieLense100[1:50]
rec <- Recommender(train, method = "UBCF")
Recommender of type ‘UBCF’ for ‘realRatingMatrix’ 
learned using 50 users.

Create top-N recommendations for new users (users 101 and 102)

pre <- predict(rec, MovieLense100[101:102], n = 10)
Recommendations as ‘topNList’ with n = 10 for 2 users. 
as(pre, "list")
 [1] "Alien (1979)"              "Titanic (1997)"           
 [3] "Contact (1997)"            "Aliens (1986)"            
 [5] "Amadeus (1984)"            "Godfather, The (1972)"    
 [7] "Henry V (1989)"            "Sting, The (1973)"        
 [9] "Dead Poets Society (1989)" "Schindler's List (1993)"  

 [1] "Usual Suspects, The (1995)" "Amadeus (1984)"            
 [3] "Raising Arizona (1987)"     "Citizen Kane (1941)"       
 [5] "Titanic (1997)"             "Brazil (1985)"             
 [7] "Stand by Me (1986)"         "M*A*S*H (1970)"            
 [9] "Babe (1995)"                "GoodFellas (1990)"   

A simple Shiny App running recommenderlab can be found at (source code).


Try the recommenderlab package in your browser

Any scripts or data that you put into this service are public.

recommenderlab documentation built on Feb. 27, 2021, 1:06 a.m.