SlideShare a Scribd company logo
A recommendation engine
for your applications
Michele Orselli | ideato
AMSTERDAM 16 - 17 MAY 2017
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
Search Engines
Recommender systems
Non personalised
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
Hotel A Hotel B Hotel C
John 3 5
Jane 3
Fred 1 0
Tom 4
AVG 3.5 3 0
Content based
User rate items
We build a model of user preference
Look for similar items based on the model
Action 0.7
Sci Fi 3.2
Vin Diesel 1.2
… …
Title Star Trek
Genre Sci Fi
Actors
William Shatner
LeonardNimoy
User Model
Title XXX
Genre Action
Actors
Vin Diesel
Asia Argento
Title Kick Ass
Genre Action
Actors
Nicholas Cage
Mark Strong
Problems/Limitations
Need to know items content
User cold start: time to learn important features
for the user
What if user interest change?
Lack of serendipity: accidentally discover
something you like
Collaborative
filtering
User-User
Select people of my neighbourhood with
similar taste. If other people share my taste I
want their opinion combined
Item-Item
Find an items where I have expressed an
opinion and look how other people felt about
it
Problems/Limitations
Sparsity
When recommending from a large item set,
users will have rated only some of the items
User Cold start
Not enough known about new user to decide
who is similar
Item cold start
Cannot predict ratings for new item till some
similar users have rated it [No problem for
content-based]
Scalability
With millions of ratings, computations
become slow
An example
Item1 Item2 Item3 Item4 Item5
Joe 8 1 ? 2 7
Tom 2 ? 5 7 5
Alice 5 4 7 4 7
Bob 7 1 7 3 8
How similar are Joe and Tom?
How similar are Joe and Bob?
Only consider items both users have rated
For each item
- Compute difference in the users’ ratings
- Take the average of this difference over the items
Item1 Item2 Item3 Item4 Item5
Joe 8 1 ? 2 7
Tom 2 ? 5 7 5
Alice 5 4 7 4 7
Bob 7 1 7 3 8
Sim(Joe, Tom) = (|8-2| + |2-7| + |7-5|)/3 = 13/3 = 4.3
Sim(Joe, Alice) = (|8-5| + |1-4| + |2-4| + |7-7|)/4 = 2
Sim(Joe, Bob) = (|8-7| + |1-1| + |2-3| + |7-8|)/4 = 0.75
Item1 Item2 Item3 Item4 Item5
Joe 8 1 ? 2 7
Tom 2 ? 5 7 5
Alice 5 4 7 4 7
Bob 7 1 7 3 8
Similarity
Bob 1.57
Alice 0.33
Tom 0.18
D = 1 / 1 + d
Recommend what similar user have rated highly
To calculate rating of an item to recommend, give
weight to each user’s recommendations based on how
similar they are to you.
Rating(Joe, Item3) = (1.57 * 7 + 0.33 * 7 + 0.18 * 5) / 3
10.99 + 2.31 + 0.9 / 3 = 4.3
Similarity
Bob 1.57
Alice 0.33
Tom 0.18
use entire matrix or
use a K-nn algorithm: people who historically
have the same tastes as me
aggregate using weighted sum
weights depends on similarity
Our domain
Domain: online book shop, both paper and
digital
Recommend titles, old and new
- Who bought this also bought
- You might like
PredictionIO
A recommendation engine for your applications codemotion ams
Installation
http://actionml.com/docs/pio_by_actionml
Pre-baked Amazon AMIs
The event server
A recommendation engine for your applications codemotion ams
Pattern: user -- action -- item
User 1 purchased product X
User 2 viewed product Y
User 1 added product Z in the cart
$ pio app new MyApp1
[INFO] [App$] Initialized Event Store for this app ID: 1.

[INFO] [App$] Created new app:

[INFO] [App$] Name: MyApp1

[INFO] [App$] ID: 1

[INFO] [App$] Access Key:
3mZWDzci2D5YsqAnqNnXH9SB6Rg3dsTBs8iHkK6X2i54IQsIZI1eEeQQyMfs7b3F
$ pio eventserver
Server runs on port 7070 by default
$ curl -i -X GET http://localhost:7070
{“status":"alive"}
$ curl -i -X GET “http://localhost:
7070/events.json?
accessKey=$ACCESS_KEY"
Events modeling
what can/should we model?
rate, like, buy, view, depending on the
algorithm
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
setUser($uid, array $properties=array(), $eventTime=null)
unsetUser($uid, array $properties, $eventTime=null)
deleteUser($uid, $eventTime=null)
setItem($iid, array $properties=array(), $eventTime=null)
unsetItem($iid, array $properties, $eventTime=null)
deleteItem($iid, $eventTime=null)
recordUserActionOnItem($event, $uid, $iid, array
$properties=array(), $eventTime=null)
createEvent(array $data)
getEvent($eventId)
Engines
A recommendation engine for your applications codemotion ams
$ pio template get apache/incubator-
predictionio-template-recommender
MyRecommendation
$ cd MyRecommendation
engine.json
"datasource": {

"params" : {

"appName": “MyApp1”,

"eventNames": [“buy”, “view”] 

}

},
$ pio build —verbose
$ pio train
$ pio deploy
Getting
recommendations
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
Implementation
A recommendation engine for your applications codemotion ams
2 kind of suggestions
- who bought this also bought
(recommendation)
- you may like (similarities)
View
Like (add to basket, add to wishlist)
Conversion (buy)
Recorded in batch
4 engines
2 for books, 2 for ebooks
(not needed now)
Retrained every night with new data
recordLike($user, array $item)
recordConversion($user, array $item)
recordView($user, array $item)
createUser($uid)
getRecommendation($uid, $itype, $n=self::N_SUGGESTION)
getSimilarity($iid, $itype, $n=self::N_SUGGESTION)
A recommendation engine for your applications codemotion ams
Cold start
if we don’t get enough suggestion switch to
non personalised (also for non logged users)
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
The end?
There’s more...
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
A recommendation engine for your applications codemotion ams
https://neo4j.com/developer/guide-build-a-recommendation-engine/
A recommendation engine for your applications codemotion ams
Do it on your own
https://github.com/grahamjenson/ger
https://github.com/grahamjenson/list_of_recommender_systems
Links
http://www.slideshare.net/NYCPredictiveAnalytics/building-a-recommendation-engine-an-example-of-a-product-recommendation-engine?next_slideshow=1
https://www.coursera.org/learn/recommender-systems-introduction
http://actionml.com/
https://github.com/grahamjenson/ger
http://www.emailvendorselection.com/recommendation-engines-for-email-marketing/
https://blog.mozilla.org/ux/2014/04/the-experience-of-mind-reading/
https://www.analyticsvidhya.com/blog/2015/08/beginners-guide-learn-content-based-recommender-systems/
https://www.analyticsvidhya.com/blog/2015/08/beginners-guide-learn-content-based-recommender-systems/
www.slideshare.net/treygrainger/building-a-real-time-solrpowered-recommendation-engine
Michele Orselli
CTO@Ideato
_orso_
micheleorselli / ideatosrl
mo@ideato.it

More Related Content

PDF
A recommendation engine for your applications phpday
PDF
A recommendation engine for your applications - M.Orselli - Codemotion Rome 17
PDF
A recommendation engine for your php application
PDF
Social Networks @ Epidata 6 24 08
PDF
Collaborative Filtering 1: User-based CF
PPTX
PPT
Beyond Usability
PDF
Semantic Optimization with Structured Data - SMX Munich
A recommendation engine for your applications phpday
A recommendation engine for your applications - M.Orselli - Codemotion Rome 17
A recommendation engine for your php application
Social Networks @ Epidata 6 24 08
Collaborative Filtering 1: User-based CF
Beyond Usability
Semantic Optimization with Structured Data - SMX Munich

Similar to A recommendation engine for your applications codemotion ams (16)

PDF
Mobile App Feature Configuration and A/B Experiments
PDF
PPT
Database Design in web and web database design
DOCX
Lab 8 User-CF Recommender System – Part I 50 points .docx
PPTX
User Story Mapping in Practice
PDF
Prashant Sridharan
PPT
USC Yahoo! BOSS, YAP and YQL Overview
PPT
Reinvent yourself - How to become a native iOS developer in nine steps
PPTX
Turning Data Into Meaningful Insights
PDF
iOS Ecosystem @ Fiera del Radioamatore Pordenone
PDF
Lessons from the Trenches of Learning Game Design
PDF
Introduction to Recommender System
PDF
Adam Smith Builds an App
PPTX
How to run conjoint analysis
PPTX
How to Run Conjoint Analysis
PPTX
Make Your Games Play, Teach, and Socialize Better: Usability & Playability Te...
Mobile App Feature Configuration and A/B Experiments
Database Design in web and web database design
Lab 8 User-CF Recommender System – Part I 50 points .docx
User Story Mapping in Practice
Prashant Sridharan
USC Yahoo! BOSS, YAP and YQL Overview
Reinvent yourself - How to become a native iOS developer in nine steps
Turning Data Into Meaningful Insights
iOS Ecosystem @ Fiera del Radioamatore Pordenone
Lessons from the Trenches of Learning Game Design
Introduction to Recommender System
Adam Smith Builds an App
How to run conjoint analysis
How to Run Conjoint Analysis
Make Your Games Play, Teach, and Socialize Better: Usability & Playability Te...
Ad

More from Michele Orselli (20)

PDF
Tackling Tech Debt with Rector
PDF
Comunicare, condividere e mantenere decisioni architetturali nei team di svil...
PDF
A dive into Symfony 4
PDF
Hopping in clouds - phpuk 17
PDF
Symfony e micro (non così tanto) services
PDF
Hopping in clouds: a tale of migration from one cloud provider to another
PDF
Vagrant for real (codemotion rome 2016)
PDF
Vagrant for real codemotion (moar tips! ;-))
PDF
Migrare a Symfony 3
PDF
Vagrant for real
PDF
Implementing data sync apis for mibile apps @cloudconf
PDF
Server side data sync for mobile apps with silex
PDF
Continuous, continuous, continuous
PDF
Deploy a PHP App on Google App Engine
PDF
Implementing Server Side Data Synchronization for Mobile Apps
PDF
Deploy a php app on Google App Engine
PDF
PDF
Manage a project portfolio
PDF
Developing sustainable php projects
PDF
Zend Framework 2 per chi viene da Symfony2
Tackling Tech Debt with Rector
Comunicare, condividere e mantenere decisioni architetturali nei team di svil...
A dive into Symfony 4
Hopping in clouds - phpuk 17
Symfony e micro (non così tanto) services
Hopping in clouds: a tale of migration from one cloud provider to another
Vagrant for real (codemotion rome 2016)
Vagrant for real codemotion (moar tips! ;-))
Migrare a Symfony 3
Vagrant for real
Implementing data sync apis for mibile apps @cloudconf
Server side data sync for mobile apps with silex
Continuous, continuous, continuous
Deploy a PHP App on Google App Engine
Implementing Server Side Data Synchronization for Mobile Apps
Deploy a php app on Google App Engine
Manage a project portfolio
Developing sustainable php projects
Zend Framework 2 per chi viene da Symfony2
Ad

Recently uploaded (20)

PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
history of c programming in notes for students .pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
ai tools demonstartion for schools and inter college
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Transform Your Business with a Software ERP System
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
How Creative Agencies Leverage Project Management Software.pdf
Digital Strategies for Manufacturing Companies
Navsoft: AI-Powered Business Solutions & Custom Software Development
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
history of c programming in notes for students .pptx
CHAPTER 2 - PM Management and IT Context
Design an Analysis of Algorithms II-SECS-1021-03
Which alternative to Crystal Reports is best for small or large businesses.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo Companies in India – Driving Business Transformation.pdf
L1 - Introduction to python Backend.pptx
Operating system designcfffgfgggggggvggggggggg
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
ai tools demonstartion for schools and inter college
Understanding Forklifts - TECH EHS Solution
Transform Your Business with a Software ERP System

A recommendation engine for your applications codemotion ams