2.5 Engineering Recommenders
Our vision of recommender engineering is heavily influenced by the principles of human- recommender interaction put forward by McNee, Riedl, and Konstan [MRK06b]. HRI de- velops and evaluates a recommender application by analyzing the application requirements in terms of the recommendation dialogue, recommender personality, and user task. We extend this model by explicitly acknowledging the recommendation domain as a distinct component for analysis — different algorithms may be more suitable to meeting the needs of the same type of task in different domains — and take significant, concrete steps to bring the analytic design of recommender systems closer to reality.
At the same time, McNee, Riedl, and Konstan [MRK06a] wrote of the particular prob- lems caused by focusing myopically on recommender accuracy and ignoring other needs and criteria such as diversity and serendipity. This work has had significant impact, with a lot of research looking at non-accuracy aspects of recommender systems. There does not seem to be as much work to date advancing the broader vision of human-recommender in- teraction or, as we have framed it, recommender engineering. The work of Knijnenburg et al. [Kni+12] contains several significant advancements in the science needed to make HRI and recommender engineering possible; in this thesis, we focus on the tools and exper- iments for understanding the algorithms themselves. Algorithms and user-centered evalu- ation converge in the work we present in chapter 7, and further experiments and synthesis will increasingly fill in the knowledge gaps that prevent recommender systems from being directly engineered and built.
Chapter 3
Tools for Recommender Research
LK1is an open-source software package for building, researching, and learning about recommender systems. It is intended to support reproducible research on recommender systems and provide a flexible, robust platform for experimenting with different recom- mendation techniques in a variety of research settings.2
In support of these goals, LensKit provides several key facilities:
• Common APIs for recommendation tasks, such as recommend and predict, allow researchers and developers to build applications and experiments in an algorithm- agnostic manner.
• Implementations of standard algorithms for recommendation and rating predic- tion, making it easy to incorporate state-of-the-art recommendation techniques into applications or research.
• An evaluation toolkit to measure recommender performance on common data sets with a variety of metrics.
• Extensive support code to allow developers to build new algorithms, evaluation methodologies, and other extensions with a minimum of new work. In particular, 1http://lenskit.org
2This chapter is adapted and updated from material previously published by Ekstrand et al. [Eks+11]. Several members of GroupLens have contributed to this work, most significantly Michael Ludwig, Jack Kolb, and John Riedl.
3.1. Introduction to LensKit
// Load a recommender configuration (item-item CF)
LenskitConfiguration config = ConfigHelpers.load("item-item.groovy");
// Set up a data source
config.bind(EventDAO.class)
.to(SimpleFileRatingDAO.create(new File("ratings.csv"), "\t"));
// Create the recommender
Recommender rec = LenskitRecommender.build(config);
ItemRecommender itemRec = rec.getItemRecommender();
// generate 10 recommendations for user 42
List<ScoredId> recommendations = irec.recommend(42, 10);
Listing 3.1: Example code to create and use a recommender.
LensKit provides infrastructure to help developers write algorithms that integrate eas- ily into both offline evaluation harnesses and live applications using many different types of data sources, and to make these algorithms extensively configurable.
We started LensKit in 2010 and published it in 2011 [Eks+11]. As of 2014, it consists of 44K lines of code, primarily in Java, and contains code from 12 contributors3. We develop LensKit in public, using GitHub4for source code management and bug tracking and Maven Central for distributing releases and managing dependencies.
The remainder of this chapter describes how LensKit can be used by researchers and developers, and the design and implementation that enable those uses.
3.1 Introduction to LensKit
Listing 3.1 demonstrates the basic steps that a program needs to perform in order to use LensKit to generate recommendations:
3Statistics from Ohloh (https://www.ohloh.net/p/lenskit). 4https://github.com/lenskit/lenskit
3.1. Introduction to LensKit
1. Configure the recommender algorithm. This is done here by loading theitem-item.groovy
configuration file, which configures an item-item collaborative filtering recommender. The LensKit documentation contains example configuration files for several different algorithms.
2. Set up a data source; in this case, tab-separated rating data fromratings.tsv.
3. Construct the LensKit recommender, represented in the Recommender object. This provides access to all of the facilities provided by the configured recommender. 4. Get the ItemRecommender component, responsible for producing recommendation
lists for users, and use it to compute 10 recommendations for user 42.
Using and integrating LensKit revolves around a recommender. A LensKit recom- mender comprises a set of interfaces providing recommendation, rating prediction, and other recommender-related services using one or more recommender algorithms connected to a data source. These services are exposed via individual interfaces — ItemRecom- mender, RatingPredictor, ItemScorer, etc. — reflecting different capabilities of the rec- ommender.
Experimenters wanting to use LensKit to compare a set of algorithms can write an eval- uation script, specifying three primary things:
• The data set(s) to use • The algorithms to test • The metrics to use
Listing 3.2 shows simple evaluation script that will perform a cross-validation experi- ment on three algorithms. Experiments can be substantially more sophisticated — recording