Lab for Developing and Testing Recommender Algorithms

Provides a research infrastructure to test and develop recommender algorithms including UBCF, IBCF, FunkSVD and association rule-based algorithms.


CRAN version CRAN RStudio mirror downloads Travis-CI Build Status 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 algoritms are:

  • User-based collborative filtering (UBCF)
  • Item-based collborative filtering (IBCF)
  • SVD with column-mean imputation (SVD)
  • Funk SVD (SVDF)
  • Association rule-based recommender (AR)
  • Popular items (POPULAR)
  • Randomly chosen items for comparison (RANDOM)
  • Re-recommend liked items (RERECOMMEND)
  • Hybrid recommendations (HybridRecommender)

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

  • Train/test split
  • Cross-validation
  • Repeated bootstrap sampling

Evaluation measures are:

  • Rating errors: MSE, RMSE, MAE
  • Top-N recommendations: TPR/FPR (ROC), precision and recall

Installation

Stable CRAN version: install from within R with

install.packages("recommenderlab")

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

library("devtools")
install_github("mhahsler/recommenderlab")

Usage

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

library("recommenderlab")
data("MovieLense")
### use only users with more than 100 ratings
MovieLense100 <- MovieLense[rowCounts(MovieLense) >100,]
MovieLense100
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")
rec
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)
pre
Recommendations as ‘topNList’ with n = 10 for 2 users. 
as(pre, "list")
$`291`
 [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)"  

$`292`
 [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 https://mhahsler-apps.shinyapps.io/Jester/ (source code).

References

News

Changes in version 0.2-3 (06/19/2018)

Bugfixes

  • Fixed bug in ALS_implicit (reported by equalise).
  • getData for binaryRatingMatrix data with type "known" and "unknown" preserves now user ids/rownames (reported by Kasia Kulma).
  • predict for HybridRecommender now retains user IDs (reported by homodigitus).
  • Removed warning about using drop in subsetting ratingMatrices (reported by donnydongchen).

Changes in version 0.2-2 (04/05/2017)

Bugfixes

  • predict for IBCF now returns top-N lists correctly.
  • (cross) dissimilarity for binary data now returns the correct data type (reported by inkrement).

Changes in version 0.2-1 (09/15/2016)

New Features

  • Added recommender method ALS and ALS_implicit based on latent factors and alternating least squares (contributed by Bregt Verreet).
  • Changes in recommendation method AR: Default for maxlen is now 3 to find more specific rules. Parameters measure and decreasing for sorting the rule base are now called sort_measure and sort_decreasing. New parameter apriori_control can be used to pass a control list to apriori in arules.
  • The registry now has a reference field.

Bugfixes

  • Fixed bug in method IBCF with n being ignored in predict (reported by Giorgio Alfredo Spedicato).

Changes in version 0.2-0 (05/31/2016)

  • Added recommender RERECOMMEND to recommend highly rated items again (e.g., movies to watch again).
  • Added a hybrid recommender (HybridRecommender).
  • realRatingMatrix supports now subset assignment with [.
  • RECOM_POPULAR now shows the parameters in the registry.
  • RECOM_RANDOM produced now random ratings from the estimated distribution of the available recommendations (from a normal distribution with the user's means and standard deviation).
  • predict now checks if newdata (number of items) is compatible with the model.
  • getTopNLists and bestN gained a randomized argument to increase prediction diversity.
  • Added getRatings method for topNList.

Changes in version 0.1-9 (05/18/2016)

  • FIX: rownames of newdata are now preserved in prediction output.
  • We use testthat now.
  • Normalization now can be done on rows and columns at the same time.
  • SVD with column-mean imputation now folds in new users.
  • Added Funk SVD (funkSVD and recommender SVDF).
  • Added function error measures: MAE, MSE, RMSE, frobenius (norm).
  • Jester5k contains now the jokes.
  • MovieLense contains now movie meta information.
  • topNLists now also contains ratings.
  • Removed obsolete PCA-based recommender.

Changes in version 0.1-8 (12/17/2015)

  • Fixed several problems in the vignette.
  • predict for realRatingMatrix accepts now type = "ratingMatrix" to returns a completed rating matrix.
  • Negative values for given in evaluationScheme implement all-but-given evaluation.
  • Method "SVD" used now EM-based approximation from package bcv.

Changes in version 0.1-7 (7/23/2015)

  • NAMESPACE now imports non standard R packages.

Changes in version 0.1-5 (8/18/2014)

  • Fixed NAMESPACE problems.
  • Evaluation of ratings is now better integrated into evaluate.
  • binarize keeps now dimnames.

Changes prior to 0.1-4 (1/11/2013)

  • Many.

Alpha version 0.1-0 (1/23/2010)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("recommenderlab")

0.2-4 by Michael Hahsler, a month ago


https://github.com/mhahsler/recommenderlab


Report a bug at https://github.com/mhahsler/recommenderlab/issues


Browse source code at https://github.com/cran/recommenderlab


Authors: Michael Hahsler [aut, cre, cph] , Bregt Vereet [ctb, cph]


Documentation:   PDF Manual  


GPL-2 license


Imports methods, utils, stats, irlba

Depends on Matrix, arules, proxy, registry

Suggests ROCR, testthat


Depended on by recommenderlabBX, recommenderlabJester.

Suggested by RMOA.


See at CRAN