Learn R Programming

⚠️There's a newer version (1.0.6) of this package.Take me there.

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

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.
  • Current development version: Download package from AppVeyor or install via intall_git("mhahsler/recommenderlab") (needs devtools)

Example

A Shiny App running recommenderlab can be found at https://mhahsler-apps.shinyapps.io/Jester/.

> 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 <- MovieLense100[1:50]
> 
> ### learn user-based collaborative filtering recommender
> 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)"   

Further Information

Maintainer: Michael Hahsler

Copy Link

Version

Install

install.packages('recommenderlab')

Monthly Downloads

1,021

Version

0.2-1

License

GPL-2

Maintainer

Michael Hahsler

Last Published

September 16th, 2016

Functions in recommenderlab (0.2-1)

Error

Error Calculation
funkSVD

Funk SVD for Matrices with Missing Data
dissimilarity

Dissimilarity and Similarity Calculation Between Rating Data
evaluationScheme

Creator Function for evaluationScheme
evaluationResults-class

Class "evaluationResults": Results of the Evaluation of a Single Recommender Method
calcPredictionAccuracy

Calculate the Prediction Error for a Recommendation
evaluationResultList-class

Class "evaluationResultList": Results of the Evaluation of a Multiple Recommender Methods
evaluate

Evaluate a Recommender Models
binaryRatingMatrix

Class "binaryRatingMatrix": A Binary Rating Matrix
evaluationScheme-class

Class "evaluationScheme": Evaluation Scheme
plot

Plot Evaluation Results
normalize

Normalize the ratings
getList

List and Data.frame Representation for Recommender Matrix Objects
HybridRecommender

Create a Hybrid Recommender
internalFunctions

Internal Utility Functions
MovieLense

MovieLense Dataset (100k)
MSWeb

Anonymous web data from www.microsoft.com
Jester5k

Jester dataset (5k sample)
predict

Predict Recommendations
ratingMatrix

Class "ratingMatrix": Virtual Class for Rating Data
Recommender-class

Class "Recommender": A Recommender Model
topNList

Class "topNList": Top-N List
Recommender

Create a Recommender Model
realRatingMatrix

Class "realRatingMatrix": Real-valued Rating Matrix
sparseNAMatrix-class

Sparse Matrix Representation With NAs Not Explicitly Stored