Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
R Data Science Essentials

You're reading from  R Data Science Essentials

Product type Book
Published in Jan 2016
Publisher
ISBN-13 9781785286544
Pages 154 pages
Edition 1st Edition
Languages

Table of Contents (15) Chapters

R Data Science Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Getting Started with R Exploratory Data Analysis Pattern Discovery Segmentation Using Clustering Developing Regression Models Time Series Forecasting Recommendation Engine Communicating Data Analysis Index

Recommendations using item-based CF


We have completed the recommendations based on user similarity, and now you will learn how to implement the recommendations based on the item-based filtering methodology. We can implement the item-based CF method with some simple changes to the user-based filtering method.

In the item-based CF method, we identify the similarity between the items. Hence, while pivoting the dataset, we will pivot in such a way that the items become the column names and users become the row names so that we can compute the item similarity and also use the majority of the previous code with simple modifications. The following code can be used to pivot the dataset by making the items as the columns names:

library(data.table)
pivoting <- data.table(rdata)
pivotdataItem<-dcast.data.table(pivoting, UserID ~ Items, fun.aggregate=length, value.var="Items")
colnames(pivotdataItem)
write.csv(pivotdataItem, "Data/pivot-followsItem.csv")
head(pivotdataItem)

The output of the preceding...

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 $15.99/month. Cancel anytime}