<!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>Alpenglow: Open Source Recommender Framework with Time-aware Learning and Evaluation∗</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Erzsébet Frigó</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>András A. Benczúr</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Algorithm 1: An Alpenglow experiment in Python</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Róbert Pálovics Domokos Kelen Levente Kocsis Institute for Computer Science and Control Hungarian Academy of Sciences</institution>
          ,
          <addr-line>MTA SZTAKI</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2017</year>
      </pub-date>
      <abstract>
        <p>Alpenglow1 is a free and open source C++ framework with easy-touse Python API. Alpenglow is capable of training and evaluating industry standard recommendation algorithms including variants of popularity, nearest neighbor, and factorization models. Traditional recommender algorithms may periodically rebuild their models, but they cannot adjust online to quick changes in trends. Besides batch training and evaluation, Alpenglow supports online training of recommendation models capable of adapting to concept drift in non-stationary environments. ∗Support from the EU H2020 grant Streamline No 688191 and the “Big Data-Momentum” grant of the Hungarian Academy of Sciences. 1https://github.com/rpalovics/Alpenglow 2https://github.com/grahamjenson/list_of_recommender_systems import alpenglow from alpenglow.experiments import BatchAndOnlineExperiment import pandas</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>
        Available free and open source recommender systems2 mostly
follow the needs of static research data such as the Netflix prize
competition with a predefined subset of the data for training and another
for evaluation. In a real service, users request one or a few
recommendations at a time and get exposed to new information that may
change their preferences for their next visit. Furthermore,
recommendation applications usually require top-k list recommendations
and provide implicit feedback for training recommender models [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        In a real application, top item recommendation by online learning
is hence more relevant than batch rating prediction. We target
topk recommendation in highly non-stationary environments with
implicit feedback [
        <xref ref-type="bibr" rid="ref1 ref2 ref4">1, 2, 4</xref>
        ]. Our goal is to promptly update the
recommender models after each user interaction by online learning.
      </p>
      <p>We present Alpenglow, a conjoint batch and online learning
recommender framework. When Alpenglow reads a stream of user–
item interaction events, first it constructs a recommendation top
list for the user. Next, the consumed item is revealed, the relevance
of the top list is assessed, and the model is immediately updated.
Alpenglow works in a single server shared memory multithreaded
architecture.</p>
    </sec>
    <sec id="sec-2">
      <title>ALPENGLOW IMPLEMENTATION</title>
      <p>Alpenglow is capable of training various factorization, similarity,
recency, and popularity based models including
• temporal popularity and item-to-item models;
• time sensitive variants of nearest neighbor, e.g. with the
introduction of a time-decay;
data = pandas.read_csv("/path/to/ sample_dataset")
factor_model_experiment = BatchAndOnlineExperiment (
top_k =100,
dimension =10,
online_learning_rate =0.2,
batch_learning_rate =0.07 ,
number_of_iterations =9,
period_length =608400 # 1 week in sec
)
rankings = factor_model_experiment .run(data , verbose=True)
results = alpenglow.DcgScore(rankings)
• batch and online matrix factorization (MF), including asymmetric</p>
      <p>
        MF, SVD++ and other MF variants;
• time-aware online combination [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] of all these models.
      </p>
      <p>The framework is composed of a large number of components
written in C++ and a thin Python API for combining them into
reusable experiments. It is compatible with popular packages such
as the Jupyter Notebook, and is able to process data from Pandas
data frames. Furthermore, the framework provides a scikit-learn
style API as well, for traditional batch training and evaluation.</p>
      <p>The Python API is illustrated in Algorithm 1. In the code sample,
user–item pairs are read into a data frame. Then we set up an
experiment, in which 10-dimensional factor models are periodically
batch trained and then continuously updated by online learning.
The learning rates, the batch iterations, the batch training periods
and possibly negative and past event sample counts and other
parameters are passed to the object. When running the experiment,
we obtain the list of rankings, which is finally evaluated by online
DCG (see Section 3). Both rankings and online DCG scores are
stored in data frames. Ongoing work includes further modularizing
the components of mixed batch and online models.</p>
      <p>Another advantage of the Python API is that it gives access to the
modular construction of the C++ core implementation. Users may
construct recommenders from various models, objectives, updaters,
learners and run their experiments in diferent experimental settings.
After a new record is evaluated, the training process is orchestrated
by learners, which execute batch, online or sampling learning
strategies. Updaters train the models by altering their states, which in turn
use the trained states to provide predictions to be evaluated. The
updaters are often defined using modular objectives. The framework
time
also provides a number of preconfigured experiments ready to be
run on a given data set. For evaluation, both rating and ranking
based measures are available in an online evaluation framework
including MSE, DCG, recall, or precision, which are all continuously
updated.
3</p>
    </sec>
    <sec id="sec-3">
      <title>TEMPORAL EVALUATION</title>
      <p>
        In an online setting as in Fig. 1, whenever a new user-item
interaction is observed, we assume that the user becomes active and
requests a recommendation. Hence for every single unique event,
Alpenglow executes the following steps:
(1) generates top-k recommendation for the active user,
(2) evaluates the list against the single relevant item that the user
interacted with,
(3) updates its model on the revealed user-item interaction.
We use DCG computed individually for each event and averaged in
time as an appropriate measure for real-time recommender
evaluation [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. If i is the next consumed item by the user, the online
DCG@K is defined as the following function of the rank of i
returned by the recommender system,
4
0

DCG@K(i ) =  1
 log2 (rank(i ) + 1)

      </p>
    </sec>
    <sec id="sec-4">
      <title>ONLINE LEARNING</title>
      <p>if rank(i ) &gt; K ;
otherwise.</p>
      <p>Online algorithms read the data in temporal order and may process
each record only once. For example, the online variant of a matrix
factorization model with gradient descent updates the
corresponding user and item latent vectors after each observed interaction.
Compared to batch recommenders, online models may be
advantageous, as they
• can adopt to temporal efects, hence may handle concept drift,
• can often be trained significantly faster than their batch variant.</p>
      <p>
        Next we present an experiment of the simplest batch and online
trained Alpenglow models. We use data carefully distilled from the
(user, artist, timestamp) tuples crawled from Last.fm [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
• We deleted artists appearing less than 10 times.
• For each user-artist pair, we kept only the first occurrence and
deleted all others so that we only recommend new artists.
• We discarded playlist efects: to avoid learning automatically
generated sequences of items, we kept only those user-item
interactions that start a user session.
      </p>
      <p>The final data contains 1,500-2,000 events per day for over one year.</p>
      <p>Figure 2 shows the best performing 10-dimensional factor models
by batch and online training. All of them are trained with stochastic
gradient descent (SGD) for mean squared error (MSE) on implicit
data. The batch model is only retrained weekly, with several
iterations of lower learning rate lr = 0.07. In contrast, the online
0.05
batch
online
batch &amp; online
40
50
0
10
20</p>
      <p>30
time (weeks)
model uses a single iteration and processes each record only once,
immediately after it is observed, and applies higher learning rate
lr = 0.2. We evaluated top-k recommendation for each single
interaction by using DCG and then computed weekly averages. As
seen in Figure 2, the performance of the online model is close to
the batch model, despite the fact that it cannot iterate in the data.</p>
      <p>Finally, we describe the batch&amp;online model, which is
implemented in Algorithm 1. In this model, we periodically re-train the
model at the end of each week by batch SGD. Afterwards, we train
the model during the next week via lightweight online updates.
Batch&amp;online results in significant improvement over both
individual models.
5</p>
    </sec>
    <sec id="sec-5">
      <title>CONCLUSIONS AND FUTURE WORK</title>
      <p>We presented Alpenglow, a C++ recommender framework with
Python API. The current version of the code is able to produce
recommender models that can adapt to non-stationary efects in real
recommendation scenarios. It includes batch and online variants of
several standard recommendation models.</p>
      <p>The goal of Alpenglow is twofold. First, it produces temporal
recommendation models that can be combined to batch models to
achieve significant performance gains. Second, the framework can
simulate the streaming recommendation scenario ofline. Hence
it supports the selection and hyperparameter tuning of models
trained on streaming data.</p>
      <p>In our future work, we intend to connect Alpenglow with other
popular Python packages. Furthermore, our plan is to advance the
architecture of the framework towards distributed recommender
APIs (Apache Flink, Apache Spark) and data streams, thus
making it possible to rapidly prototype and evaluate online learning
recommenders.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>X.</given-names>
            <surname>Amatriain</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Basilico</surname>
          </string-name>
          . Past, present, and
          <article-title>future of recommender systems: An industry perspective</article-title>
          .
          <source>In Proceedings of the 10th ACM RecSys</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>R.</given-names>
            <surname>Pálovics</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Benczúr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Kocsis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Kiss</surname>
          </string-name>
          , and
          <string-name>
            <given-names>E.</given-names>
            <surname>Frigó</surname>
          </string-name>
          .
          <article-title>Exploiting temporal influence in online recommendation</article-title>
          .
          <source>In Proceedings of the 8th ACM RecSys</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>R.</given-names>
            <surname>Turrin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Quadrana</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Condorelli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Pagano</surname>
          </string-name>
          , and
          <string-name>
            <given-names>P.</given-names>
            <surname>Cremonesi</surname>
          </string-name>
          .
          <article-title>30music listening and playlists dataset</article-title>
          .
          <source>In RecSys Posters</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J.</given-names>
            <surname>Vinagre</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. M.</given-names>
            <surname>Jorge</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Gama</surname>
          </string-name>
          .
          <article-title>Evaluation of recommender systems in streaming environments</article-title>
          .
          <source>In Workshop on Recommender Systems Evaluation, October</source>
          <volume>10</volume>
          ,
          <year>2014</year>
          ,
          <string-name>
            <given-names>Silicon</given-names>
            <surname>Valley</surname>
          </string-name>
          , United States,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>