<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>LibRec: A Java Library for Recommender Systems</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Guibing Guo</string-name>
          <email>gbguo@smu.edu.sg</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jie Zhangy</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Zhu Suny</string-name>
          <email>sunzhu@ntu.edu.sg</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Neil Yorke-Smithz</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>School of Information Systems, Singapore Management University</institution>
          ,
          <country country="SG">Singapore</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The large array of recommendation algorithms proposed over the years brings a challenge in reproducing and comparing their performance. This paper introduces an open-source Java library that implements a suite of state-of-the-art algorithms as well as a series of evaluation metrics. We empirically nd that LibRec performs faster than other such libraries, while achieving competitive evaluative performance.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Recommender systems have been developed for decades, and a large number
of algorithms have been proposed by the community. As more and more
algorithms are being designed, the concern of reproducibility of algorithm
performance grows [1]. Although multiple open-source frameworks exist for the
purpose of algorithm reproduction and comparison, many of them only implement
a set of classic algorithms which are now outdated [2]. Hence, we posit that more
e orts are warranted in comparing the current state-of-the-art algorithms with
new algorithms that are rapidly emerging.</p>
      <p>This paper proposes an open-source Java library for recommender systems,
called LibRec1. The LibRec library implements a suite of state-of-the-art
recommendation algorithms as well as the traditional methods. In addition, a series of
evaluation metrics are implemented including diversity-based metrics which are
rarely enabled in other libraries. LibRec provides a platform for fair comparisons
among di erent algorithms in multiple aspects, given the fact that the evaluative
performance depends on data characteristic. It also provides a high exibility for
expansion with new algorithms.
LibRec is GPL-licensed Java software2 (version 1.7 or higher required), which
can be easily deployed and executed in platforms including MS Windows, Linux,
1 http://www.librec.net. Version 1.3 of LibRec is described in this paper
2 Source code hosted in GitHub: https://github.com/guoguibing/librec</p>
      <p>Generic Interfaces</p>
      <p>Recommender</p>
      <p>IterativeRecommender
GraphicRecommender</p>
      <p>SocialRecommender
ContextRecommender
Data Structures
SparseMatrix
SparseVector
DenseMatrix
DenseVector
SymmMatrix
DiagMatrix
DataDAO
DataSplitter
DataConverter
and Mac OS. It facilitates the study of the two classic problems of recommender
systems, namely rating prediction and item recommendation. The LibRec
framework consists of three major components, namely generic interfaces, data
structures and recommendation algorithms, as illustrated in Figure 1.
2.1</p>
      <sec id="sec-1-1">
        <title>Generic Interfaces</title>
        <p>Generic interfaces de ne a set of abstract recommenders that can be extended
and implemented by speci c recommendation algorithms. In LibRec version 1.3,
ve generic recommenders are implemented. Recommender de nes a general
recommender which is extended by baselines and some other algorithms such as
SlopeOne. IterativeRecommender de nes a recommender usually based on
iterative learning techniques. Matrix factorization-based approaches (e.g., SVD++,
BiasedMF) are often derived from it. GraphicRecommender suits for the
algorithms based on probabilistic graphic models (e.g., LDA, BUCM).
SocialRecommender de nes a recommender that incorporates social information, such as
SocialMF and TrustSVD. Lastly, ContextRecommender de nes a recommender
that integrates additional contextual information into recommendations, for
example, temporal information by TimeSVD. Although social connections are
indeed a form of contextual information, we determine to expand from
IterativeRecommender rather than from ContexRecommender. This is because many social
recommenders have been proposed and the format of social connections is
relatively simple and consistent across di erent data sets. Additional generic
interfaces can be de ned by further development. By de ning those interfaces, new
algorithms can be easily implemented by focusing on their own logics.
2.2</p>
      </sec>
      <sec id="sec-1-2">
        <title>Data Structures</title>
        <p>
          At least four data structures are widely and heavily used to implement
recommender systems, namely sparse matrices and vectors, and dense matrices and
vectors. Other structures include symmetric and diagonal matrices. The data
structures have a great in uence on the execution time of recommenders. An
LibRec: A Java Library for Recommender Systems
important characteristic of LibRec is that it runs much faster than other
counterparts3. Our implementations are mainly inspired by a Java matrix library
MTJ4, one of the most powerful matrix libraries in Java. MTJ implements
several sparse matrix structures in a compressed row (column) storage for e ective
row (column) operations. Since it is often necessary to operate both in rows and
columns, we choose to implement a sparse matrix class by keeping both
compressed row and column storages, whereby additional utility functions can be
easily added. Similarly, our sparse vector is an enhanced version of that in MTJ
by incorporating a number of functionalities. For dense matrix and vector, we
discard the implementations of MTJ which only stores data in a single array
and hence not suitable for large-scale data storage. In contrast, we implement
our own versions using two-dimensional Java arrays. Java caching techniques are
also adopted to further boost algorithm executions. In addition, LibRec includes
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) DataDAO, a data access object (DAO) for input/output data operations;
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) DataSplitter, a utility class to split a data set into the training and test
subsets; (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) DataConverter, a converter to transform a format of source data sets
into another; and (4) other data structures and classes.
2.3
        </p>
      </sec>
      <sec id="sec-1-3">
        <title>Recommendation Algorithms</title>
        <p>
          We identify and implement three kinds of recommendation algorithms: (
          <xref ref-type="bibr" rid="ref1">1</xref>
          )
baselines that make little use of personalized information; (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) core algorithms that are
state-of-the-art approaches based on user-item interactions and contextual
information; and (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) other algorithms. A list of enabled recommendation algorithms
with references are elaborated at: http://www.librec.net/tutorial.html.
        </p>
        <p>
          Recommendation algorithms can be evaluated in di erent settings: Given
N (ratio) ratings, K-fold cross validation and cold start, to name a few. Three
kinds of evaluation metrics are implemented: (
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) predictive error-based
measures including (normalized) mean absolute error (MAE), root mean square
error (RMSE) and mean prediction error (MPE); (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) ranking-based measures
including mean average precision (MAP), normalized discounted cumulative gain
(NDCG), mean reciprocal rank (MRR), area under the ROC curve (AUC),
precision and recall, etc.; and (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ) other novel measures: currently a similarity-based
diversity measure [3] is implemented. More measures will be added in future.
3
        </p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Comparison with Other Frameworks</title>
      <p>
        Many open-source libraries are available including Mahout5, Duine6, Co 7, LensKit8
MyMediaLite9 and PREA10. Lee et al. [2] provide a detailed comparison among
3 The comparison is elaborated at http://www.librec.net/example.html
4 Matrix Toolkits Java (MTJ): https://github.com/fommil/matrix-toolkits-java
5 Mahout: https://mahout.apache.org
6 Duine: http://www.duineframework.org
7 Co : http://www.nongnu.org/cofi/
8 LensKit: http://lenskit.org/
9 MyMediaLite: http://www.mymedialite.net
10 PREA: http://prea.gatech.edu
these di erent frameworks, and report that Mahout, Duine and Co focus only
on memory-based algorithms and hence are outdated. LensKit provides only a
few classic recommendation algorithms. We give a comparison with more
advanced packages, i.e., PREA and MyMediaLite. MyMediaLite is a well-known
recommendation library written in C#. Some toolkits, e.g., Rival11 and WrapRec12
are recently designed as a wrapper of MyMediaLite for better use (e.g., data split
and evaluation). PREA is a more recently released framework implemented in
Java. However, the two libraries become less active for further development.
The last update of MyMediaLite was September 2013 and that of PREA was
June 2014. Consequently, some newly proposed algorithms are not supported by
these libraries, e.g., TrustMF, FISM and TrustSVD as we do. We also note that
graphic recommenders are rarely provided by other libraries. Besides, LibRec
provides more baseline and extension algorithms than PREA and MyMediaLite,
such as UserCluster and NMF. To evaluate recommendation performance, PREA
only provides predictive error-based metrics while MyMediaLite does not provide
novel measures beyond accuracy. In contrast, our library provides novel measures
as well as the traditional accuracy-based measures. Lastly, we empirically
demonstrate that LibRec runs much faster than PREA and MyMediaLite while
achieving competitive recommendation performance. The amount of performance gain
di ers from algorithm to algorithm. A detailed comparison in training and
evaluation time can be found at: http://www.librec.net/example.html. Another
important characteristic of our library is that LibRec con gures recommenders
using a con guration le, while PREA and MyMydiaLite use command lines.
The advantages of a con guration le are (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) easier to con gure all possible
parameters; (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) portable and easier to reproduce algorithm performance; and (
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
easier to debug programs by using alternative parameter settings in one time.
4
      </p>
    </sec>
    <sec id="sec-3">
      <title>Conclusion</title>
      <p>
        LibRec contributes to the community of recommender systems by providing (
        <xref ref-type="bibr" rid="ref1">1</xref>
        )
a much faster implementation of a set of recent state-of-the-art recommendation
algorithms; (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) a fair and easy comparison among recommendation algorithms
in terms of multi-aspect evaluation metrics; and (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) a platform for others to
contribute more source codes of other algorithms as an open-source library.
11 http://rival.recommenders.net
12 https://github.com/babakx/WrapRec
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Ekstrand</surname>
            ,
            <given-names>M.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ludwig</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Konstan</surname>
            ,
            <given-names>J.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Riedl</surname>
            ,
            <given-names>J.T.</given-names>
          </string-name>
          :
          <article-title>Rethinking the recommender research ecosystem: reproducibility, openness, and lenskit</article-title>
          .
          <source>In: Proceedings of the fth ACM conference on Recommender systems (RecSys)</source>
          .
          <volume>133</volume>
          {
          <issue>140</issue>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Lee</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sun</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lebanon</surname>
          </string-name>
          , G.:
          <article-title>Prea: Personalized recommendation algorithms toolkit</article-title>
          .
          <source>Journal of Machine Learning Research 13</source>
          <volume>2699</volume>
          {
          <issue>2703</issue>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Smyth</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>McClave</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Similarity vs. diversity</article-title>
          .
          <source>In: Proceedings of the International Conference on Case-Based Reasoning Research and Development</source>
          .
          <volume>347</volume>
          {
          <issue>361</issue>
          (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>