Building a Recommendation System with R
Format: PDF / Kindle (mobi) / ePub
Learn the art of building robust and powerful recommendation engines using R
About This Book
- Learn to exploit various data mining techniques
- Understand some of the most popular recommendation techniques
- This is a step-by-step guide full of real-world examples to help you build and optimize recommendation engines
Who This Book Is For
If you are a competent developer with some knowledge of machine learning and R, and want to further enhance your skills to build recommendation systems, then this book is for you.
What You Will Learn
- Get to grips with the most important branches of recommendation
- Understand various data processing and data mining techniques
- Evaluate and optimize the recommendation algorithms
- Prepare and structure the data before building models
- Discover different recommender systems along with their implementation in R
- Explore various evaluation techniques used in recommender systems
- Get to know about recommenderlab, an R package, and understand how to optimize it to build efficient recommendation systems
A recommendation system performs extensive data analysis in order to generate suggestions to its users about what might interest them. R has recently become one of the most popular programming languages for the data analysis. Its structure allows you to interactively explore the data and its modules contain the most cutting-edge techniques thanks to its wide international community. This distinctive feature of the R language makes it a preferred choice for developers who are looking to build recommendation systems.
The book will help you understand how to build recommender systems using R. It starts off by explaining the basics of data mining and machine learning. Next, you will be familiarized with how to build and optimize recommender models using R. Following that, you will be given an overview of the most popular recommendation techniques. Finally, you will learn to implement all the concepts you have learned throughout the book to build a recommender system.
Style and approach
This is a step-by-step guide that will take you through a series of core tasks. Every task is explained in detail with the help of practical examples.
lapply(recommender_models, "[[", "description") ## $IBCF_realRatingMatrix ##  "Recommender based on item-based collaborative filtering (real data)." ## ## $PCA_realRatingMatrix ##  "Recommender based on PCA approximation (real data)." ## ## $POPULAR_realRatingMatrix##  "Recommender based on item popularity (real data)." ## ## $RANDOM_realRatingMatrix ##  "Produce random recommendations (real ratings)." ## ## $SVD_realRatingMatrix ##  "Recommender based on SVD approximation (real
column counts are the same as the original matrix, so we can still apply rowCounts and colCounts on ratings_movies: min_movies_binary <- quantile(rowCounts(ratings_movies), 0.95) min_users_binary <- quantile(colCounts(ratings_movies), 0.95) Let's build the heat map: image(ratings_movies_watched[rowCounts(ratings_movies) > min_movies_binary,colCounts(ratings_movies) > min_users_binary], main = "Heatmap of the top users and movies") The following image shows the heat map of the top users and
similarity matrix based on the item descriptions.Combine the two matrices. Starting from recc_model, we can define the purchases similarity matrix. All we need to do is to convert the dgCMatrix object into matrix: dist_ratings <- as(recc_model@model$sim, "matrix") In order to build the matrix based on item descriptions, we can use the dist function. Given that it's based on a category column only, the distance will be as follows: 1, if the two items belong to the same category0, if the two
test setabout / Defining the training and test sets training setabout / Defining the training and test sets True Positive Rate (TPR)about / Evaluating the recommendations U user-based collaborative filteringabout / User-based collaborative filteringrecommendation model, building / Building the recommendation modelrecommender model, applying on test set / Applying the recommender model on the test seton binary data / Collaborative filtering on binary data, User-based collaborative filtering on
specifications, and then recommendations are made. These types of system are called constraint-based recommender systems, which we will learn more about in subsequent chapters. Before building these types of recommender systems, we take into consideration the following questions: What kind of information about the items is taken into the model?How are user preferences captured explicitly? Hybrid systems We build hybrid recommender systems by combining various recommender systems to build a