SlideShare a Scribd company logo
1 of 20
Download to read offline
Cegeka AI/ML Competence Center




  Recommendation
  engines
  Theory and intro to




                                 Georgian Micsa
Georgian Micsa
●   Software engineer with 6+ years of experience, mainly Java but also
    JavaScript and .NET
●   Interested on OOD, architecture and agile software development
    methodologies
●   Currently working as Senior Java Developer @ Cegeka
●   georgian.micsa@gmail.com
●   http://ro.linkedin.com/in/georgianmicsa
What is it?
●   Recommender/recommendation system/engine/platform
●   A subclass of information filtering system
●   Predict the 'rating' or 'preference' that a user would give to a new item
    (music, books, movies, people or groups etc)
●   Can use a model built from the characteristics of an item (content-based
    approaches)
●   Can use the user's social environment (collaborative filtering approaches)
Examples

●   Amazon.com
    β—‹   Recommend additional books
    β—‹   Frequently bought together books
    β—‹   Implemented using a sparse matrix of book cooccurrences
●   Pandora Radio
    β—‹   Plays music with similar characteristics
    β—‹   Content based filtering based on properties of song/artist
    β—‹   Based also on user's feedback
    β—‹   Users emphasize or deemphasize certain characteristics
Examples 2

●   Last.fm
    β—‹   Collaborative filtering
    β—‹   Recommends songs by observing the tracks played by user and
        comparing to behaviour of other users
    β—‹   Suggests songs played by users with similar interests
●   Netflix
    β—‹   Predictions of movies
    β—‹   Hybrid approach
    β—‹   Collaborative filtering based on user`s previous ratings and watching
        behaviours (compared to other users)
    β—‹   Content based filtering based on characteristics of movies
Collaborative filtering
●   Collect and analyze a large amount of information on users’ behaviors,
    activities or preferences
●   Predict what users will like based on their similarity to other users
●   It does not rely on the content of the items
●   Measures user similarity or item similarity
●   Many algorithms:
    β—‹   the k-nearest neighborhood (k-NN)
    β—‹   the Pearson Correlation
    β—‹   etc.
Collaborative filtering 2
●   Build a model from user's profile collecting explicit and implicit data
●   Explicit data:
    β—‹   Asking a user to rate an item on a sliding scale.
    β—‹   Rank a collection of items from favorite to least favorite.
    β—‹   Presenting two items to a user and asking him/her to choose the
        better one of them.
    β—‹   Asking a user to create a list of items that he/she likes.
●   Implicit data:
    β—‹   Observing the items that a user views in an online store.
    β—‹   Analyzing item/user viewing times
    β—‹   Keeping a record of the items that a user purchases online.
    β—‹   Obtaining a list of items that a user has listened to or watched
    β—‹   Analyzing the user's social network and discovering similar likes and
        dislikes
Collaborative filtering 3
●   Collaborative filtering approaches often suffer from three problems:
    β—‹   Cold Start: needs a large amount of existing data on a user in order
        to make accurate recommendations
    β—‹   Scalability: a large amount of computation power is often necessary
        to calculate recommendations.
    β—‹   Sparsity: The number of items sold on major e-commerce sites is
        extremely large. The most active users will only have rated a small
        subset of the overall database. Thus, even the most popular items
        have very few ratings.
Content-based filtering
●   Based on information about and characteristics of the items
●   Try to recommend items that are similar to those that a user liked in the
    past (or is examining in the present)
●   Use an item profile (a set of discrete attributes and features)
●   Content-based profile of users based on a weighted vector of item
    features
●   The weights denote the importance of each feature to the user
●   To compute the weights:
    β—‹   average values of the rated item vector
    β—‹   Bayesian Classifiers, cluster analysis, decision trees, and artificial
        neural networks
Content-based filtering 2
●   Can collect feedback from user to assign higher or lower weights on the
    importance of certain attributes
●   Cross-content recommendation: music, videos, products, discussions etc.
    from different services can be recommended based on news browsing.
●   Popular for movie recommendations: Internet Movie Database, See This
    Next etc.
Hybrid Recommender Systems
●   Combines collaborative filtering and content-based filtering
●   Implemented in several ways:
    β—‹   by making content-based and collaborative-based predictions
        separately and then combining them
    β—‹   by adding content-based capabilities to a collaborative-based
        approach (and vice versa)
    β—‹   by unifying the approaches into one model
●   Studies have shown that hybrid methods can provide more accurate
    recommendations than pure approaches
●   Overcome cold start and the sparsity problems
●   Netflix and See This Next
What is Apache Mahout?
●   A scalable Machine Learning library
●   Apache License
●   Scalable to reasonably large datasets (core algorithms implemented in
    Map/Reduce, runnable on Hadoop)
●   Distributed and non-distributed algorithms
●   Community
●   Usecases
    β€’   Clustering (group items that are topically related)
    β€’   Classification (learn to assign categories to documents)
    β€’   Frequent Itemset Mining (find items that appear together)
    β€’   Recommendation Mining (find items a user might like)
Non-distributed recommenders
●   Non-distributed, non Hadoop, collaborative recommender algorithms
●   Java or external server which exposes recommendation logic to your
    application via web services and HTTP
●   Key interfaces:
    β—‹   DataModel: CSV files or database
    β—‹   UserSimilarity: computes similarity between users
    β—‹   ItemSimilarity: computes similarity between items
    β—‹   UserNeighborhood: used for similarity of users
    β—‹   Recommender: produces recommendations
●   Different implementations based on your needs
●   Input in this format: UserId,ItemId,[Preference or Rating]
●   Preference is not needed in case of associations (pages viewed by users)
User-based recommender example
DataModel model = new FileDataModel(new File("data.txt"));

UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(model);
// Optional:
userSimilarity.setPreferenceInferrer(new AveragingPreferenceInferrer());

UserNeighborhood neighborhood =
         new NearestNUserNeighborhood(3, userSimilarity, model);
Recommender recommender =
    new GenericUserBasedRecommender(model, neighborhood, userSimilarity);

Recommender cachingRecommender = new CachingRecommender(recommender);

List<RecommendedItem> recommendations =
         cachingRecommender.recommend(1234, 10);
Item-based recommender example
DataModel model = new FileDataModel(new File("data.txt"));
// Construct the list of pre-computed correlations
Collection<GenericItemSimilarity.ItemItemSimilarity> correlations = ...;
ItemSimilarity itemSimilarity = new GenericItemSimilarity(correlations);

Recommender recommender =
     new GenericItemBasedRecommender(model, itemSimilarity);

Recommender cachingRecommender = new CachingRecommender(recommender);

List<RecommendedItem> recommendations =
       cachingRecommender.recommend(1234, 10);
Recommender evaluation
For preference data models:
DataModel myModel = ...;
RecommenderBuilder builder = new RecommenderBuilder() {
     public Recommender buildRecommender(DataModel model) {
       // build and return the Recommender to evaluate here
     }
};
RecommenderEvaluator evaluator =
     new AverageAbsoluteDifferenceRecommenderEvaluator();

double evaluation = evaluator.evaluate(builder, myModel, 0.9, 1.0);


For boolean data models, precision and recall can be computed.
Distributed Item Based
●   Mahout offers 2 Hadoop Map/Reduce jobs aimed to support Itembased
    Collaborative Filtering
●   org.apache.mahout.cf.taste.hadoop.similarity.item.ItemSimilarityJob
    β—‹   computes all similar items
    β—‹   input is a CSV file with theformat userID,itemID,value
    β—‹   output is a file of itemIDs with their associated similarity value
    β—‹   different configuration options: eg. similarity measure to use (co
        occurrence, Euclidian distance, Pearson correlation, etc.)
●   org.apache.mahout.cf.taste.hadoop.item.RecommenderJob
    β—‹   Completely distributed itembased recommender
    β—‹   input is a CSV file with the format userID,itemID,value
    β—‹   output is a file of userIDs with associated recommended itemIDs and
        their scores
    β—‹   also configuration options
Mahout tips
●   Start with non-distributed recommenders
●   100M user-item associations can be handled by a modern server with 4GB
    of heap available as a real-time recommender
●   Over this scale distributed algorithms make sense
●   Data can be sampled, noisy and old data can be pruned
●   Ratings: GenericItemBasedRecommender and
    PearsonCorrelationSimilarity
●   Preferences: GenericBooleanPrefItemBasedRecommender and
    LogLikelihoodSimilarity
●   Content-based item-item similarity => your own ItemSimilarity
Mahout tips 2
●   CSV files
    β—‹   FileDataModel
    β—‹   push new files periodically
●   Database
    β—‹   XXXJDBCDataModel
    β—‹   ReloadFromJDBCDataModel
●   Offline or live recommendations?
    β—‹   Distributed algorithms => Offline periodical computations
    β—‹   Data is pushed periodically as CSV files or in DB
    β—‹   SlopeOneRecommender deals with updates quickly
    β—‹   Real time update of the DataModel and refresh recommander after
        some events (user rates an item etc.)
References

●   http://en.wikipedia.org/wiki/Recommender_system
●   https://cwiki.apache.org/confluence/display/MAHOUT/Mahout+Wiki
●   http://www.ibm.com/developerworks/java/library/j-mahout/
●   http://www.slideshare.net/sscdotopen/mahoutcf
●   http://www.philippeadjiman.com/blog/2009/11/11/flexible-
    collaborative-filtering-in-java-with-mahout-taste/

More Related Content

What's hot

Recommender Engines
Recommender EnginesRecommender Engines
Recommender Engines
Thomas Hess
Β 
Recommender system introduction
Recommender system   introductionRecommender system   introduction
Recommender system introduction
Liang Xiang
Β 
Item Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation AlgorithmsItem Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation Algorithms
nextlib
Β 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
Lior Rokach
Β 

What's hot (20)

Collaborative Filtering using KNN
Collaborative Filtering using KNNCollaborative Filtering using KNN
Collaborative Filtering using KNN
Β 
Boston ML - Architecting Recommender Systems
Boston ML - Architecting Recommender SystemsBoston ML - Architecting Recommender Systems
Boston ML - Architecting Recommender Systems
Β 
Recommendation system
Recommendation systemRecommendation system
Recommendation system
Β 
Recommendation System
Recommendation SystemRecommendation System
Recommendation System
Β 
Recommender Engines
Recommender EnginesRecommender Engines
Recommender Engines
Β 
An introduction to Recommender Systems
An introduction to Recommender SystemsAn introduction to Recommender Systems
An introduction to Recommender Systems
Β 
Recommender systems: Content-based and collaborative filtering
Recommender systems: Content-based and collaborative filteringRecommender systems: Content-based and collaborative filtering
Recommender systems: Content-based and collaborative filtering
Β 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
Β 
Recommender system introduction
Recommender system   introductionRecommender system   introduction
Recommender system introduction
Β 
A Hybrid Recommendation system
A Hybrid Recommendation systemA Hybrid Recommendation system
A Hybrid Recommendation system
Β 
How to build a recommender system?
How to build a recommender system?How to build a recommender system?
How to build a recommender system?
Β 
Recommender Systems: Advances in Collaborative Filtering
Recommender Systems: Advances in Collaborative FilteringRecommender Systems: Advances in Collaborative Filtering
Recommender Systems: Advances in Collaborative Filtering
Β 
Recommendation System Explained
Recommendation System ExplainedRecommendation System Explained
Recommendation System Explained
Β 
Overview of recommender system
Overview of recommender systemOverview of recommender system
Overview of recommender system
Β 
Recommendation system
Recommendation systemRecommendation system
Recommendation 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 Systems Basics
Recommendation Systems BasicsRecommendation Systems Basics
Recommendation Systems Basics
Β 
[Final]collaborative filtering and recommender systems
[Final]collaborative filtering and recommender systems[Final]collaborative filtering and recommender systems
[Final]collaborative filtering and recommender systems
Β 
Entity2rec recsys
Entity2rec recsysEntity2rec recsys
Entity2rec recsys
Β 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
Β 

Viewers also liked

Building a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engineBuilding a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engine
NYC Predictive Analytics
Β 
Recommender system algorithm and architecture
Recommender system algorithm and architectureRecommender system algorithm and architecture
Recommender system algorithm and architecture
Liang Xiang
Β 
Project Progress Report - Recommender Systems for Social Networks
Project Progress Report - Recommender Systems for Social NetworksProject Progress Report - Recommender Systems for Social Networks
Project Progress Report - Recommender Systems for Social Networks
amirhhz
Β 
Recommender Systems in E-Commerce
Recommender Systems in E-CommerceRecommender Systems in E-Commerce
Recommender Systems in E-Commerce
Roger Chen
Β 
Summary, Conclusions and Recommendations
Summary, Conclusions and RecommendationsSummary, Conclusions and Recommendations
Summary, Conclusions and Recommendations
Roqui Malijan
Β 

Viewers also liked (20)

A content based movie recommender system for mobile application
A content based movie recommender system for mobile applicationA content based movie recommender system for mobile application
A content based movie recommender system for mobile application
Β 
Building a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engineBuilding a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engine
Β 
Recommender system algorithm and architecture
Recommender system algorithm and architectureRecommender system algorithm and architecture
Recommender system algorithm and architecture
Β 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
Β 
Movie Recommendation engine
Movie Recommendation engineMovie Recommendation engine
Movie Recommendation engine
Β 
Business Intelligence Services
Business Intelligence ServicesBusiness Intelligence Services
Business Intelligence Services
Β 
Project Progress Report - Recommender Systems for Social Networks
Project Progress Report - Recommender Systems for Social NetworksProject Progress Report - Recommender Systems for Social Networks
Project Progress Report - Recommender Systems for Social Networks
Β 
Book Recommendation System using Data Mining for the University of Hong Kong ...
Book Recommendation System using Data Mining for the University of Hong Kong ...Book Recommendation System using Data Mining for the University of Hong Kong ...
Book Recommendation System using Data Mining for the University of Hong Kong ...
Β 
Recommendation Engine Project Presentation
Recommendation Engine Project PresentationRecommendation Engine Project Presentation
Recommendation Engine Project Presentation
Β 
Collaborative filtering
Collaborative filteringCollaborative filtering
Collaborative filtering
Β 
Business use of Social Media and Impact on Enterprise Architecture
Business use of Social Media and Impact on Enterprise ArchitectureBusiness use of Social Media and Impact on Enterprise Architecture
Business use of Social Media and Impact on Enterprise Architecture
Β 
Recommender Systems in E-Commerce
Recommender Systems in E-CommerceRecommender Systems in E-Commerce
Recommender Systems in E-Commerce
Β 
Collaborative Filtering and Recommender Systems By Navisro Analytics
Collaborative Filtering and Recommender Systems By Navisro AnalyticsCollaborative Filtering and Recommender Systems By Navisro Analytics
Collaborative Filtering and Recommender Systems By Navisro Analytics
Β 
Recommendation at Netflix Scale
Recommendation at Netflix ScaleRecommendation at Netflix Scale
Recommendation at Netflix Scale
Β 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
Β 
Summary, Conclusions and Recommendations
Summary, Conclusions and RecommendationsSummary, Conclusions and Recommendations
Summary, Conclusions and Recommendations
Β 
Buidling large scale recommendation engine
Buidling large scale recommendation engineBuidling large scale recommendation engine
Buidling large scale recommendation engine
Β 
Collaborative Filtering Recommendation System
Collaborative Filtering Recommendation SystemCollaborative Filtering Recommendation System
Collaborative Filtering Recommendation System
Β 
Recommendation system
Recommendation system Recommendation system
Recommendation system
Β 
Recommender Systems (Machine Learning Summer School 2014 @ CMU)
Recommender Systems (Machine Learning Summer School 2014 @ CMU)Recommender Systems (Machine Learning Summer School 2014 @ CMU)
Recommender Systems (Machine Learning Summer School 2014 @ CMU)
Β 

Similar to Recommendation engines

3e recommendation engines_meetup
3e recommendation engines_meetup3e recommendation engines_meetup
3e recommendation engines_meetup
Pranab Ghosh
Β 

Similar to Recommendation engines (20)

Recommender systems
Recommender systemsRecommender systems
Recommender systems
Β 
Building a Recommender systems by Vivek Murugesan - Technical Architect at Cr...
Building a Recommender systems by Vivek Murugesan - Technical Architect at Cr...Building a Recommender systems by Vivek Murugesan - Technical Architect at Cr...
Building a Recommender systems by Vivek Murugesan - Technical Architect at Cr...
Β 
Recommandation systems -
Recommandation systems - Recommandation systems -
Recommandation systems -
Β 
Introduction to Recommendation Systems
Introduction to Recommendation SystemsIntroduction to Recommendation Systems
Introduction to Recommendation Systems
Β 
Recommender.system.presentation.pjug.01.21.2014
Recommender.system.presentation.pjug.01.21.2014Recommender.system.presentation.pjug.01.21.2014
Recommender.system.presentation.pjug.01.21.2014
Β 
Mahout
MahoutMahout
Mahout
Β 
Recommendation Systems
Recommendation SystemsRecommendation Systems
Recommendation Systems
Β 
Tag based recommender system
Tag based recommender systemTag based recommender system
Tag based recommender system
Β 
Introduction to Recommendation Systems (Vietnam Web Submit)
Introduction to Recommendation Systems (Vietnam Web Submit)Introduction to Recommendation Systems (Vietnam Web Submit)
Introduction to Recommendation Systems (Vietnam Web Submit)
Β 
SDEC2011 Mahout - the what, the how and the why
SDEC2011 Mahout - the what, the how and the whySDEC2011 Mahout - the what, the how and the why
SDEC2011 Mahout - the what, the how and the why
Β 
Modern Perspectives on Recommender Systems and their Applications in Mendeley
Modern Perspectives on Recommender Systems and their Applications in MendeleyModern Perspectives on Recommender Systems and their Applications in Mendeley
Modern Perspectives on Recommender Systems and their Applications in Mendeley
Β 
recommendation system techunique and issue
recommendation system techunique and issuerecommendation system techunique and issue
recommendation system techunique and issue
Β 
Architecting AI Solutions in Azure for Business
Architecting AI Solutions in Azure for BusinessArchitecting AI Solutions in Azure for Business
Architecting AI Solutions in Azure for Business
Β 
Recommender Systems In Industry
Recommender Systems In IndustryRecommender Systems In Industry
Recommender Systems In Industry
Β 
REAL-TIME RECOMMENDATION SYSTEMS
REAL-TIME RECOMMENDATION SYSTEMS REAL-TIME RECOMMENDATION SYSTEMS
REAL-TIME RECOMMENDATION SYSTEMS
Β 
3e recommendation engines_meetup
3e recommendation engines_meetup3e recommendation engines_meetup
3e recommendation engines_meetup
Β 
Real-Time Recommendations with Hopsworks and OpenSearch - MLOps World 2022
Real-Time Recommendations  with Hopsworks and OpenSearch - MLOps World 2022Real-Time Recommendations  with Hopsworks and OpenSearch - MLOps World 2022
Real-Time Recommendations with Hopsworks and OpenSearch - MLOps World 2022
Β 
Recommender systems
Recommender systemsRecommender systems
Recommender systems
Β 
Web usage mining
Web usage miningWeb usage mining
Web usage mining
Β 
Lecture Notes on Recommender System Introduction
Lecture Notes on Recommender System IntroductionLecture Notes on Recommender System Introduction
Lecture Notes on Recommender System Introduction
Β 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
Β 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
Β 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
Β 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Β 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Β 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Β 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
Β 
Navi Mumbai Call Girls πŸ₯° 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls πŸ₯° 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls πŸ₯° 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls πŸ₯° 8617370543 Service Offer VIP Hot Model
Β 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Β 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Β 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Β 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Β 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Β 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Β 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
Β 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
Β 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Β 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Β 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Β 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Β 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
Β 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Β 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
Β 

Recommendation engines

  • 1. Cegeka AI/ML Competence Center Recommendation engines Theory and intro to Georgian Micsa
  • 2. Georgian Micsa ● Software engineer with 6+ years of experience, mainly Java but also JavaScript and .NET ● Interested on OOD, architecture and agile software development methodologies ● Currently working as Senior Java Developer @ Cegeka ● georgian.micsa@gmail.com ● http://ro.linkedin.com/in/georgianmicsa
  • 3. What is it? ● Recommender/recommendation system/engine/platform ● A subclass of information filtering system ● Predict the 'rating' or 'preference' that a user would give to a new item (music, books, movies, people or groups etc) ● Can use a model built from the characteristics of an item (content-based approaches) ● Can use the user's social environment (collaborative filtering approaches)
  • 4. Examples ● Amazon.com β—‹ Recommend additional books β—‹ Frequently bought together books β—‹ Implemented using a sparse matrix of book cooccurrences ● Pandora Radio β—‹ Plays music with similar characteristics β—‹ Content based filtering based on properties of song/artist β—‹ Based also on user's feedback β—‹ Users emphasize or deemphasize certain characteristics
  • 5. Examples 2 ● Last.fm β—‹ Collaborative filtering β—‹ Recommends songs by observing the tracks played by user and comparing to behaviour of other users β—‹ Suggests songs played by users with similar interests ● Netflix β—‹ Predictions of movies β—‹ Hybrid approach β—‹ Collaborative filtering based on user`s previous ratings and watching behaviours (compared to other users) β—‹ Content based filtering based on characteristics of movies
  • 6. Collaborative filtering ● Collect and analyze a large amount of information on users’ behaviors, activities or preferences ● Predict what users will like based on their similarity to other users ● It does not rely on the content of the items ● Measures user similarity or item similarity ● Many algorithms: β—‹ the k-nearest neighborhood (k-NN) β—‹ the Pearson Correlation β—‹ etc.
  • 7. Collaborative filtering 2 ● Build a model from user's profile collecting explicit and implicit data ● Explicit data: β—‹ Asking a user to rate an item on a sliding scale. β—‹ Rank a collection of items from favorite to least favorite. β—‹ Presenting two items to a user and asking him/her to choose the better one of them. β—‹ Asking a user to create a list of items that he/she likes. ● Implicit data: β—‹ Observing the items that a user views in an online store. β—‹ Analyzing item/user viewing times β—‹ Keeping a record of the items that a user purchases online. β—‹ Obtaining a list of items that a user has listened to or watched β—‹ Analyzing the user's social network and discovering similar likes and dislikes
  • 8. Collaborative filtering 3 ● Collaborative filtering approaches often suffer from three problems: β—‹ Cold Start: needs a large amount of existing data on a user in order to make accurate recommendations β—‹ Scalability: a large amount of computation power is often necessary to calculate recommendations. β—‹ Sparsity: The number of items sold on major e-commerce sites is extremely large. The most active users will only have rated a small subset of the overall database. Thus, even the most popular items have very few ratings.
  • 9. Content-based filtering ● Based on information about and characteristics of the items ● Try to recommend items that are similar to those that a user liked in the past (or is examining in the present) ● Use an item profile (a set of discrete attributes and features) ● Content-based profile of users based on a weighted vector of item features ● The weights denote the importance of each feature to the user ● To compute the weights: β—‹ average values of the rated item vector β—‹ Bayesian Classifiers, cluster analysis, decision trees, and artificial neural networks
  • 10. Content-based filtering 2 ● Can collect feedback from user to assign higher or lower weights on the importance of certain attributes ● Cross-content recommendation: music, videos, products, discussions etc. from different services can be recommended based on news browsing. ● Popular for movie recommendations: Internet Movie Database, See This Next etc.
  • 11. Hybrid Recommender Systems ● Combines collaborative filtering and content-based filtering ● Implemented in several ways: β—‹ by making content-based and collaborative-based predictions separately and then combining them β—‹ by adding content-based capabilities to a collaborative-based approach (and vice versa) β—‹ by unifying the approaches into one model ● Studies have shown that hybrid methods can provide more accurate recommendations than pure approaches ● Overcome cold start and the sparsity problems ● Netflix and See This Next
  • 12. What is Apache Mahout? ● A scalable Machine Learning library ● Apache License ● Scalable to reasonably large datasets (core algorithms implemented in Map/Reduce, runnable on Hadoop) ● Distributed and non-distributed algorithms ● Community ● Usecases β€’ Clustering (group items that are topically related) β€’ Classification (learn to assign categories to documents) β€’ Frequent Itemset Mining (find items that appear together) β€’ Recommendation Mining (find items a user might like)
  • 13. Non-distributed recommenders ● Non-distributed, non Hadoop, collaborative recommender algorithms ● Java or external server which exposes recommendation logic to your application via web services and HTTP ● Key interfaces: β—‹ DataModel: CSV files or database β—‹ UserSimilarity: computes similarity between users β—‹ ItemSimilarity: computes similarity between items β—‹ UserNeighborhood: used for similarity of users β—‹ Recommender: produces recommendations ● Different implementations based on your needs ● Input in this format: UserId,ItemId,[Preference or Rating] ● Preference is not needed in case of associations (pages viewed by users)
  • 14. User-based recommender example DataModel model = new FileDataModel(new File("data.txt")); UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(model); // Optional: userSimilarity.setPreferenceInferrer(new AveragingPreferenceInferrer()); UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, userSimilarity, model); Recommender recommender = new GenericUserBasedRecommender(model, neighborhood, userSimilarity); Recommender cachingRecommender = new CachingRecommender(recommender); List<RecommendedItem> recommendations = cachingRecommender.recommend(1234, 10);
  • 15. Item-based recommender example DataModel model = new FileDataModel(new File("data.txt")); // Construct the list of pre-computed correlations Collection<GenericItemSimilarity.ItemItemSimilarity> correlations = ...; ItemSimilarity itemSimilarity = new GenericItemSimilarity(correlations); Recommender recommender = new GenericItemBasedRecommender(model, itemSimilarity); Recommender cachingRecommender = new CachingRecommender(recommender); List<RecommendedItem> recommendations = cachingRecommender.recommend(1234, 10);
  • 16. Recommender evaluation For preference data models: DataModel myModel = ...; RecommenderBuilder builder = new RecommenderBuilder() { public Recommender buildRecommender(DataModel model) { // build and return the Recommender to evaluate here } }; RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator(); double evaluation = evaluator.evaluate(builder, myModel, 0.9, 1.0); For boolean data models, precision and recall can be computed.
  • 17. Distributed Item Based ● Mahout offers 2 Hadoop Map/Reduce jobs aimed to support Itembased Collaborative Filtering ● org.apache.mahout.cf.taste.hadoop.similarity.item.ItemSimilarityJob β—‹ computes all similar items β—‹ input is a CSV file with theformat userID,itemID,value β—‹ output is a file of itemIDs with their associated similarity value β—‹ different configuration options: eg. similarity measure to use (co occurrence, Euclidian distance, Pearson correlation, etc.) ● org.apache.mahout.cf.taste.hadoop.item.RecommenderJob β—‹ Completely distributed itembased recommender β—‹ input is a CSV file with the format userID,itemID,value β—‹ output is a file of userIDs with associated recommended itemIDs and their scores β—‹ also configuration options
  • 18. Mahout tips ● Start with non-distributed recommenders ● 100M user-item associations can be handled by a modern server with 4GB of heap available as a real-time recommender ● Over this scale distributed algorithms make sense ● Data can be sampled, noisy and old data can be pruned ● Ratings: GenericItemBasedRecommender and PearsonCorrelationSimilarity ● Preferences: GenericBooleanPrefItemBasedRecommender and LogLikelihoodSimilarity ● Content-based item-item similarity => your own ItemSimilarity
  • 19. Mahout tips 2 ● CSV files β—‹ FileDataModel β—‹ push new files periodically ● Database β—‹ XXXJDBCDataModel β—‹ ReloadFromJDBCDataModel ● Offline or live recommendations? β—‹ Distributed algorithms => Offline periodical computations β—‹ Data is pushed periodically as CSV files or in DB β—‹ SlopeOneRecommender deals with updates quickly β—‹ Real time update of the DataModel and refresh recommander after some events (user rates an item etc.)
  • 20. References ● http://en.wikipedia.org/wiki/Recommender_system ● https://cwiki.apache.org/confluence/display/MAHOUT/Mahout+Wiki ● http://www.ibm.com/developerworks/java/library/j-mahout/ ● http://www.slideshare.net/sscdotopen/mahoutcf ● http://www.philippeadjiman.com/blog/2009/11/11/flexible- collaborative-filtering-in-java-with-mahout-taste/