Book Image

Building a Recommendation System with R

Book Image

Building a Recommendation System with R

Overview of this book

Table of Contents (13 chapters)
Building a Recommendation System with R
About the Authors
About the Reviewer


Recommender systems are machine learning techniques that predict user purchases and preferences. There are several applications of recommender systems, such as online retailers and video-sharing websites.

This book teaches the reader how to build recommender systems using R. It starts by providing the reader with some relevant data mining and machine learning concepts. Then, it shows how to build and optimize recommender models using R and gives an overview of the most popular recommendation techniques. In the end, it shows a practical use case. After reading this book, you will know how to build a new recommender system on your own.

What this book covers

Chapter 1, Getting Started with Recommender Systems, describes the book and presents some real-life examples of recommendation engines.

Chapter 2, Data Mining Techniques Used in Recommender Systems, provides the reader with the toolbox to built recommender models: R basics, data processing, and machine learning techniques.

Chapter 3, Recommender Systems, presents some popular recommender systems and shows how to build some of them using R.

Chapter 4, Evaluating the Recommender Systems, shows how to measure the performance of a recommender and how to optimize it.

Chapter 5, Case Study – Building Your Own Recommendation Engine, shows how to solve a business challenge by building and optimizing a recommender.

What you need for this book

You will need the R 3.0.0+, RStudio (not mandatory), and Samba 4.x Server software.

Who this book is for

This book is intended for people who already have a background in R and machine learning. If you're interested in building recommendation techniques, this book is for you.


To cite the recommenderlab package (R package version 0.1-5) in publications, refer to recommenderlab: Lab for Developing and Testing Recommender Algorithms by Michael Hahsler at

LaTeX users can use the following BibTeX entry:

  title = {recommenderlab: Lab for Developing and Testing
  Recommender Algorithms},
  author = {Michael Hahsler},
  year = {2014},
  note = {R package version 0.1-5},
  url = { http://CRAN.R-},


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We used the e1071 package to run SVM."

A block of code is set as follows:

vector_ratings <- factor(vector_ratings)qplot(vector_ratings) + ggtitle("Distribution of the ratings")
exten => i,1,Voicemail(s0)

New terms and important words are shown in bold.


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from:


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.