SlideShare a Scribd company logo
1 of 27
RECOMMENDATION SYSTEM
By Anamta Sayyed
OUTLINE
 Introduction Recommendations
 Model For Recommendations.
 Recommendations Types
 Collaborative Filtering with Examples.
 Content based Filtering with Examples.
 R code for Collaborative Filtering (item based)
 Hybrid Recommendation
 Recommendation Technologies
WHAT IS RECOMMENDATION SYSTEM?
 Data Filtering tools that make use of Algorithm &
Data to Recommend
 They’re in Automated form to analyze the need of
users & also relates which items could be/or user
could buy along with some other items
RECOMMENDATIONS
 Software tools and techniques providing
suggestions for items/products/people etc.
 The suggestions relate to various Decision –Making
process.
 Focused for individual who lack sufficient personnel
experience or data to take decision.
 It’s a information filtering system to predict the
rating or preference that user give to item.
Ex. What item to buy. What music to listen. What
online news to listen.
EXAMPLES
EXAMPLES
WANT SOME EVIDENCES?
 Netflix:
2/3 Rented movies are from Recommendation
 Google News:
38% more clicks are due to Recommendation
 Amazon:
35% sales are from Recommendation
RECOMMENDATION PROCESS
TYPES
Recommendation System
Content-Based Approach
Hybrid Model (Content-
Based Approach)
Collaborative Filtering (CF)
TYPES..
COLLABORATIVE FILTERING
•It Recommends Items based on similarity measures between Users &
Items.
COLLABORATIVE FILTERING TYPES
COLLABORATIVE FILTERING
MEASURING SIMILARITIES
 Jaccard Distance
dj(I1,I2) = │AUB│-│A∩B│
 Cosine Distance
cos = ∑(A*B)
√ ∑(A*A)* √ ∑(B*B)
 Rounding the Data
eg. Ratings from 1-5
3/4/51
1/2 Null
 Many More...
│AUB│
The data set contains information about users and
which song they have listened to on Last.FM.
# Read data from Last.FM frequency matrix
data<-read.csv(file.choose())
head(data[,c(1,3:8)])
#drop Column user
data.content <- (data[,!(names(data) %in% c("user"))])
R CODE FOR ITEM BASED COLLABORATIVE
FILTERING
#Create a helper function to calculate the cosine
between two vectors
getCosine function(x,y)
{
this.cosine sum(x*y) / (sqrt(sum(x*x)) *
sqrt(sum(y*y)))
return(this.cosine)
}
#Create a placeholder to store results of our cosine
similarities (dataframe listing item vs. Item)
data.content.similaritymatrix(NA,nrow=ncol(data.cont
ent),ncol=ncol(data.content),dimnames=list(colname
s(data.content),colnames(data.content)))
Head(data.content.similarity)
will now put similarities between items
Lets fill in those empty spaces with cosine similarities
Loop through the columns
for(i in 1:ncol(data.content)) {
# Loop through the columns for each column
for(j in 1:ncol(data.content)) {
# Fill in placeholder with cosine similarities
data.content.similarity[i,j] <-
getCosine(as.matrix(data.content[i]),as.matrix(data.content[j]))
}
}
data.content.similarity <- as.data.frame(data.content.similarity)
# Get the top 10 neighbours for each and convert data frame to matrix form
data.content.neighbours matrix(NA,
nrow=ncol(data.content.similarity),ncol=11,
dimnames=list(colnames(data.content.similarity)))
#Then we need to find the neighbours. This is another loop but runs much
faster
for(i in 1:ncol(data.content))
{
data.content.neighbours[i,] 
(t(head(n=11,rownames(data.content.similarity[order
(data.content.similarity[,i],decreasing=TRUE),][i]))))
}
we use t() to rotate the similarity matrix since the neighbour one is shaped
differently
head(data.content.neighbours)
This means for those listening to Abba we would recommend
Madonna and Robbie Williams.
Likewise for people listening to ACDC we would recommend
the Red Hot Chilli Peppers and Metallica
CONTENT BASED
•It is based on properties of items recommended.
•Eg. If user reads about big data articles, so the articles
related to big data willbe recommended to user.
•It is based on topic or features of the product
What can we do with these?
 Query Items that are similar to these items
 Match Items’s content and user’s Profile
Measuring Similarity
• Cosine,TF-IDF as in standard Information.
• Euclidean Dimensionality reduction if you want.
DIFFERENCE
HYBRID
EXAMPLE
SOURCE OF INFORMATION
 Explicit ratings on a numeric/ 5-star/3-star etc. scale
• Explicit binary ratings (thumbs up/thumbs down)
 Implicit information, e.g.,
– who bookmarked/linked to the item?
– how many times was it viewed?
– how many units were sold?
– how long did users read the page?
• Item descriptions/features
• User profiles/preferences
RECOMMENDATION TECHNOLOGIES
THANK YOU!

More Related Content

What's hot

Recommender system introduction
Recommender system   introductionRecommender system   introduction
Recommender system introduction
Liang Xiang
 
Recommender system algorithm and architecture
Recommender system algorithm and architectureRecommender system algorithm and architecture
Recommender system algorithm and architecture
Liang Xiang
 
Recommender Systems! @ASAI 2011
Recommender Systems! @ASAI 2011Recommender Systems! @ASAI 2011
Recommender Systems! @ASAI 2011
Ernesto Mislej
 
Item Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation AlgorithmsItem Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation Algorithms
nextlib
 
Survey of Recommendation Systems
Survey of Recommendation SystemsSurvey of Recommendation Systems
Survey of Recommendation Systems
youalab
 

What's hot (20)

Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
 
Recommender system introduction
Recommender system   introductionRecommender system   introduction
Recommender system introduction
 
Recommender system algorithm and architecture
Recommender system algorithm and architectureRecommender system algorithm and architecture
Recommender system algorithm and architecture
 
Collaborative Filtering Recommendation System
Collaborative Filtering Recommendation SystemCollaborative Filtering Recommendation System
Collaborative Filtering Recommendation System
 
Recommendation Systems Basics
Recommendation Systems BasicsRecommendation Systems Basics
Recommendation Systems Basics
 
Movie lens movie recommendation system
Movie lens movie recommendation systemMovie lens movie recommendation system
Movie lens movie recommendation system
 
Recommender Systems! @ASAI 2011
Recommender Systems! @ASAI 2011Recommender Systems! @ASAI 2011
Recommender Systems! @ASAI 2011
 
An introduction to Recommender Systems
An introduction to Recommender SystemsAn introduction to Recommender Systems
An introduction to Recommender Systems
 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
 
Movie Recommender System Using Artificial Intelligence
Movie Recommender System Using Artificial Intelligence Movie Recommender System Using Artificial Intelligence
Movie Recommender System Using Artificial Intelligence
 
Overview of recommender system
Overview of recommender systemOverview of recommender system
Overview of recommender system
 
Recommendation Systems
Recommendation SystemsRecommendation Systems
Recommendation Systems
 
Movies Recommendation System
Movies Recommendation SystemMovies Recommendation System
Movies Recommendation System
 
Movie recommendation system using collaborative filtering system
Movie recommendation system using collaborative filtering system Movie recommendation system using collaborative filtering system
Movie recommendation system using collaborative filtering system
 
Item Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation AlgorithmsItem Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation Algorithms
 
Recommendation System Explained
Recommendation System ExplainedRecommendation System Explained
Recommendation System Explained
 
Recent advances in deep recommender systems
Recent advances in deep recommender systemsRecent advances in deep recommender systems
Recent advances in deep recommender systems
 
Movie Recommendation engine
Movie Recommendation engineMovie Recommendation engine
Movie Recommendation engine
 
Survey of Recommendation Systems
Survey of Recommendation SystemsSurvey of Recommendation Systems
Survey of Recommendation Systems
 
Collaborative Filtering using KNN
Collaborative Filtering using KNNCollaborative Filtering using KNN
Collaborative Filtering using KNN
 

Similar to Recommendation System

Cssu dw dm
Cssu dw dmCssu dw dm
Cssu dw dm
sumit621
 
Discovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender SystemsDiscovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender Systems
Gabriel Moreira
 
Lesson 2 data preprocessing
Lesson 2   data preprocessingLesson 2   data preprocessing
Lesson 2 data preprocessing
AbdurRazzaqe1
 

Similar to Recommendation System (20)

EE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptxEE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptx
 
Cssu dw dm
Cssu dw dmCssu dw dm
Cssu dw dm
 
Data Science - Part XI - Text Analytics
Data Science - Part XI - Text AnalyticsData Science - Part XI - Text Analytics
Data Science - Part XI - Text Analytics
 
Data Patterns - A Native Open Source Data Profiling Tool for HPCC Systems
Data Patterns - A Native Open Source Data Profiling Tool for HPCC SystemsData Patterns - A Native Open Source Data Profiling Tool for HPCC Systems
Data Patterns - A Native Open Source Data Profiling Tool for HPCC Systems
 
Movie Recommendation System.pptx
Movie Recommendation System.pptxMovie Recommendation System.pptx
Movie Recommendation System.pptx
 
Discovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender SystemsDiscovering User's Topics of Interest in Recommender Systems
Discovering User's Topics of Interest in Recommender Systems
 
Data_Structure_and_Algorithms_Using_C++ _ Nho Vĩnh Share.pdf
Data_Structure_and_Algorithms_Using_C++ _ Nho Vĩnh Share.pdfData_Structure_and_Algorithms_Using_C++ _ Nho Vĩnh Share.pdf
Data_Structure_and_Algorithms_Using_C++ _ Nho Vĩnh Share.pdf
 
Lesson 2 data preprocessing
Lesson 2   data preprocessingLesson 2   data preprocessing
Lesson 2 data preprocessing
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
Chapter 1.pdf
Chapter 1.pdfChapter 1.pdf
Chapter 1.pdf
 
Sistemas de Recomendação sem Enrolação
Sistemas de Recomendação sem Enrolação Sistemas de Recomendação sem Enrolação
Sistemas de Recomendação sem Enrolação
 
End-to-End Machine Learning Project
End-to-End Machine Learning ProjectEnd-to-End Machine Learning Project
End-to-End Machine Learning Project
 
fINAL ML PPT.pptx
fINAL ML PPT.pptxfINAL ML PPT.pptx
fINAL ML PPT.pptx
 
Data Mining Presentation on Science Day 2023
Data Mining Presentation on Science Day 2023Data Mining Presentation on Science Day 2023
Data Mining Presentation on Science Day 2023
 
Algorithms and Data Structures~hmftj
Algorithms and Data Structures~hmftjAlgorithms and Data Structures~hmftj
Algorithms and Data Structures~hmftj
 
Popular Text Analytics Algorithms
Popular Text Analytics AlgorithmsPopular Text Analytics Algorithms
Popular Text Analytics Algorithms
 
Data Mining with SQL Server 2008
Data Mining with SQL Server 2008Data Mining with SQL Server 2008
Data Mining with SQL Server 2008
 
Tableau Interview Questions
Tableau Interview QuestionsTableau Interview Questions
Tableau Interview Questions
 
Ui path interview questions
Ui path interview questionsUi path interview questions
Ui path interview questions
 
Haystacks slides
Haystacks slidesHaystacks slides
Haystacks slides
 

Recently uploaded

Call Girls in G.T.B. Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in G.T.B. Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in G.T.B. Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in G.T.B. Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get CytotecAbortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...
Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...
Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...
HyderabadDolls
 
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
HyderabadDolls
 
Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...
Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...
Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...
HyderabadDolls
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 

Recently uploaded (20)

5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
 
Call Girls in G.T.B. Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in G.T.B. Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in G.T.B. Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in G.T.B. Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get CytotecAbortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
 
Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...
Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...
Belur $ Female Escorts Service in Kolkata (Adult Only) 8005736733 Escort Serv...
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
Call Girls In GOA North Goa +91-8588052666 Direct Cash Escorts Service
Call Girls In GOA North Goa +91-8588052666 Direct Cash Escorts ServiceCall Girls In GOA North Goa +91-8588052666 Direct Cash Escorts Service
Call Girls In GOA North Goa +91-8588052666 Direct Cash Escorts Service
 
社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction
 
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
 
Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...
Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...
Diamond Harbour \ Russian Call Girls Kolkata | Book 8005736733 Extreme Naught...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
👉 Bhilai Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl Ser...
👉 Bhilai Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl Ser...👉 Bhilai Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl Ser...
👉 Bhilai Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl Ser...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
 

Recommendation System

  • 2. OUTLINE  Introduction Recommendations  Model For Recommendations.  Recommendations Types  Collaborative Filtering with Examples.  Content based Filtering with Examples.  R code for Collaborative Filtering (item based)  Hybrid Recommendation  Recommendation Technologies
  • 3. WHAT IS RECOMMENDATION SYSTEM?  Data Filtering tools that make use of Algorithm & Data to Recommend  They’re in Automated form to analyze the need of users & also relates which items could be/or user could buy along with some other items
  • 4. RECOMMENDATIONS  Software tools and techniques providing suggestions for items/products/people etc.  The suggestions relate to various Decision –Making process.  Focused for individual who lack sufficient personnel experience or data to take decision.  It’s a information filtering system to predict the rating or preference that user give to item. Ex. What item to buy. What music to listen. What online news to listen.
  • 7. WANT SOME EVIDENCES?  Netflix: 2/3 Rented movies are from Recommendation  Google News: 38% more clicks are due to Recommendation  Amazon: 35% sales are from Recommendation
  • 9. TYPES Recommendation System Content-Based Approach Hybrid Model (Content- Based Approach) Collaborative Filtering (CF)
  • 11. COLLABORATIVE FILTERING •It Recommends Items based on similarity measures between Users & Items.
  • 14. MEASURING SIMILARITIES  Jaccard Distance dj(I1,I2) = │AUB│-│A∩B│  Cosine Distance cos = ∑(A*B) √ ∑(A*A)* √ ∑(B*B)  Rounding the Data eg. Ratings from 1-5 3/4/51 1/2 Null  Many More... │AUB│
  • 15. The data set contains information about users and which song they have listened to on Last.FM. # Read data from Last.FM frequency matrix data<-read.csv(file.choose()) head(data[,c(1,3:8)]) #drop Column user data.content <- (data[,!(names(data) %in% c("user"))]) R CODE FOR ITEM BASED COLLABORATIVE FILTERING
  • 16. #Create a helper function to calculate the cosine between two vectors getCosine function(x,y) { this.cosine sum(x*y) / (sqrt(sum(x*x)) * sqrt(sum(y*y))) return(this.cosine) } #Create a placeholder to store results of our cosine similarities (dataframe listing item vs. Item) data.content.similaritymatrix(NA,nrow=ncol(data.cont ent),ncol=ncol(data.content),dimnames=list(colname s(data.content),colnames(data.content)))
  • 17. Head(data.content.similarity) will now put similarities between items Lets fill in those empty spaces with cosine similarities Loop through the columns for(i in 1:ncol(data.content)) { # Loop through the columns for each column for(j in 1:ncol(data.content)) { # Fill in placeholder with cosine similarities data.content.similarity[i,j] <- getCosine(as.matrix(data.content[i]),as.matrix(data.content[j])) } } data.content.similarity <- as.data.frame(data.content.similarity)
  • 18. # Get the top 10 neighbours for each and convert data frame to matrix form data.content.neighbours matrix(NA, nrow=ncol(data.content.similarity),ncol=11, dimnames=list(colnames(data.content.similarity))) #Then we need to find the neighbours. This is another loop but runs much faster for(i in 1:ncol(data.content)) { data.content.neighbours[i,]  (t(head(n=11,rownames(data.content.similarity[order (data.content.similarity[,i],decreasing=TRUE),][i])))) } we use t() to rotate the similarity matrix since the neighbour one is shaped differently
  • 19. head(data.content.neighbours) This means for those listening to Abba we would recommend Madonna and Robbie Williams. Likewise for people listening to ACDC we would recommend the Red Hot Chilli Peppers and Metallica
  • 20. CONTENT BASED •It is based on properties of items recommended. •Eg. If user reads about big data articles, so the articles related to big data willbe recommended to user. •It is based on topic or features of the product
  • 21. What can we do with these?  Query Items that are similar to these items  Match Items’s content and user’s Profile Measuring Similarity • Cosine,TF-IDF as in standard Information. • Euclidean Dimensionality reduction if you want.
  • 25. SOURCE OF INFORMATION  Explicit ratings on a numeric/ 5-star/3-star etc. scale • Explicit binary ratings (thumbs up/thumbs down)  Implicit information, e.g., – who bookmarked/linked to the item? – how many times was it viewed? – how many units were sold? – how long did users read the page? • Item descriptions/features • User profiles/preferences