Counting 1,690 Big Data & Machine Learning Frameworks, Toolsets, and Examples...
Suggestion? Feedback? Tweet @stkim1

Last Commit
Aug. 15, 2017
May. 10, 2017

What is this?

R package which implement several algrithms for matrix factorization targeting recommender systems.

Package is quite efficient - extensively use BLAS and parallelized with OpenMP, see benchmarks below.



  1. Introduction to matrix factorization with Weighted-ALS algorithm - collaborative filtering for implicit feedback datasets.
  2. Music recommendations using LastFM-360K dataset
    • evaluation metrics for ranking
    • setting up proper cross-validation
    • possible issues with nested parallelism and thread contention
    • making recommendations for new users
    • complimentary item-to-item recommendations
  3. Benchmark against other good implementations


At the moment following algorithms are implemented:

Alternating Least Squares for implicit feedback

Current implementation used RcppArmadillo and extensively uses BLAS and LAPACK, so on my 4-core PC with OpenBLAS it is ~1.7x faster than highly optimized Quora's qmf library.

See Collaborative Filtering for Implicit Feedback Datasets paper by (Yifan Hu, Yehuda Koren, Chris Volinsky) for details.

VERY IMPORTANT if you use multithreaded BLAS (you generally should) such as OpenBLAS, Intel MKL, Apple Accelerate, I highly recommend disable its internal multithreading ability. This leads to substantial speedups (can be 10x!) for this package (since matrix factorization is already parallelized in package with OpenMP). This can be done by setting corresponding environment variables before starting R:

  2. Intel MKL: export MKL_NUM_THREADS=1
  3. Apple Accelerate: export VECLIB_MAXIMUM_THREADS=1

It it also possible to change number of threads in runtime, see for example OpenBlasThreads and RhpcBLASctl packages.

Alternating Least Squares for explicit feedback


We follow mlapi conventions.

Quice reference