Book Image

Apache Mahout Essentials

By : Jayani Withanawasam
Book Image

Apache Mahout Essentials

By: Jayani Withanawasam

Overview of this book

Table of Contents (13 chapters)
Apache Mahout Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Item-based recommenders


An item-based recommender measures the similarities between different items and picks the top k closest (in similarity) items to a given item in order to arrive at a rating prediction or recommendation for a given user for a given item.

For the movie recommendation scenario, an item-based recommender works as given in the following figure:

Let's say both Sunil and Roshan like the movies Interstellar (2014) and Star Wars (1977). Then, we can infer that Interstellar (2014) and Star Wars (1977) could be similar items. So, when Nimal likes Interstellar (2014), we recommend Star Wars (1977) to Nimal based on our previous observation.

The following is the Java code example for item-based recommenders:

DataModel model = new FileDataModel (new File("movie.csv"));

ItemSimilarity itemSimilarity = new EuclideanDistanceSimilarity (model);

Recommender itemRecommender = new GenericItemBasedRecommender(model,itemSimilarity);

List<RecommendedItem> itemRecommendations = itemRecommender...