Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building a Recommendation System with R

You're reading from  Building a Recommendation System with R

Product type Book
Published in Sep 2015
Publisher
ISBN-13 9781783554492
Pages 158 pages
Edition 1st Edition
Languages

Data exploration


In this section, we will explore the MovieLense dataset. For this purpose, we will use recommenderlab to build recommender systems and ggplot2 to visualize their results. Let's load the packages and the data:

library("recommenderlab")
library("ggplot2")
data(MovieLense)
class(MovieLense)
## [1] "realRatingMatrix"
## attr(,"package")
## [1] "recommenderlab"

MovieLense is a realRatingMatrix object containing a dataset about movie ratings. Each row corresponds to a user, each column to a movie, and each value to a rating.

Exploring the nature of the data

Let's take a quick look at MovieLense. As explained in the previous section, there are some generic methods that can be applied to realRatingMatrix objects. We can extract their size using dim:

dim(MovieLense)
## [1]  943 1664

There are 943 users and 1664 movies. Since realRatingMatrix is an S4 class, the components of the objects are contained in MovieLense slots. We can see all the slots using slotNames, which displays all the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}