Social Network Analysis

Login |

Fast Context-aware Recommendations with Factorization Machines

Authors: Steffen Rendle, Zeno Gantner, Christoph Freudenthaler, Lars Schmidt-Thieme
Conference: SIGIR 2011

Abstract The situation in which a choice is made is an important information for recommender systems. Context-aware recommenders take this information into account to make predictions. So far, the best performing method for context-aware rating prediction in terms of predictive accuracy is Multiverse Recommendation based on the Tucker tensor factorization model. However this method has two drawbacks: (1) its model complexity is exponential in the number of context variables and polynomial in the size of the factorization and (2) it only works for categorical context variables. On the other hand there is a large variety of fast but specialized recommender methods which lack the generality of context-aware methods.
We propose to apply Factorization Machines (FMs) to model contextual information and to provide context-aware rating predictions. This approach results in fast context-aware recommendations because the model equation of FMs can be computed in linear time both in the number of context variables and the factorization size. For learning FMs, we develop an iterative optimization method that analytically finds the least-square solution for one parameter given the other ones. Finally, we show empirically that our approach outperforms Multiverse Recommendation in prediction quality and runtime.

Download paper (PDF format)


In the experiments of this paper, FMs are compared to Multiverse Recommendation. For experimental reproducibility, we provide implementations for both methods.


  • libFM can be used for context-aware recommendation for many kinds of context including categorical, set-categorical or real-valued context variables.
  • libFM is a library for Factorization Machines [ICDM 2010]. In this paper ([SIGIR 2011]) a new optimization method for regression FMs using alternating least squares (ALS) has been proposed.
  • To use the ALS optimization in libFM, use the command line option --method als when calling libFM. You can switch to SGD optimization by using --method sgd.
  • Download libFM software

Multiverse Recommendation

  • Multiverse Recommendation is a tensor factorization method based on Tucker decomposition working only with categorical context variables.
  • The implementation uses a stochastic gradient descent (SGD) optimization algorithm with L2-regularization/ ridge regression terms/ Gaussian priors.
  • This approach has been introduced for context-aware rating prediction in [Recsys 2010]
  • Download Multiverse Recommendation software


Context-enrichment of Webscope dataset

Convert triple format to libfm format

  • Most recommender datasets are provided in a triple format with a predefined number of columns where each column represents an entity (e.g. a user or item) by its ID and one column holds the prediction target (e.g. the rating). The libFM format is more generic allowing any real-valued vector as input.
  • The libFM package includes a script that converts the standard recommender to the libFM format. The script gives each entity a unique ID and a weight of 1.0.
  • This script can be used for example to convert the enriched Yahoo! webscope dataset (see above) into libFM format.
  • The script is included in the libFM package.


To cite this paper, please use the reference [SIGIR 2011]. Factorization Machines have been introduced in [ICDM 2010] and Multiverse Recommendation in [Recsys 2010]. Please cite the corresponding papers if you use the provided software.

[SIGIR 2011] Steffen Rendle, Zeno Gantner, Christoph Freudenthaler, Lars Schmidt-Thieme (2011): Fast Context-aware Recommendations with Factorization Machines, in Proceeding of the 34th international ACM SIGIR conference on Research and development in information retrieval (SIGIR 2011), Beijing, China. Supplementary Material BibTeX PDF
[ICDM 2010] Steffen Rendle (2010): Factorization Machines, in Proceedings of the 10th IEEE International Conference on Data Mining (ICDM 2010), Sydney, Australia. Supplementary Material BibTeX PDF
[Recsys 2010] A. Karatzoglou, X. Amatriain, L. Baltrunas, and N. Oliver (2010): Multiverse recommendation: n-dimensional tensor factorization for context-aware collaborative filtering, in Proceedings of the fourth ACM conference on Recommender systems (Recsys 2010), pages 79-86, New York, NY, USA, 2010. ACM.