SlideShare a Scribd company logo
1 of 78
Download to read offline
Il Machine Learning per la creazione di
raccomandazioni, personalizzazioni e
suggerimenti dei prodotti per il vostro
e-commerce
Francesco Fullone | ideato
vogliamo
suggerire
alle persone
cosa
comprare…
vogliamo
un bot 

che suggerisca
alle persone
cosa
comprare!
vogliamo
un bot 

che suggerisca
alle persone
cosa
comprare!
un bot
vogliamo
un bot 

che suggerisca
alle persone
cosa
comprare!
un bot
un bot
un bot
che SISTEMA DI RACCOMANDAZIONE usare?
Facciamo un passo indietro…
Motori di ricerca
Fonte dati statica (anche se ampia), query dinamiche
Motori di suggerimenti
Fonte dati dinamica (ma su un dominio preciso), query statiche
Non personalizzati
Content-Based
Filtraggio Collaborativo
Motori di suggerimenti
Non personalizzati
Hotel A Hotel B Hotel C
John 3 5
Jane 3
Fred 1 0
Tom 4
AVG 3.5 3 0
Content-Based
Gli utenti votano item (film, libri, …)
Noi costruiamo un modello sui gusti
degli utenti
Cerchiamo per item simili basandoci
sul modello creato
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
Problemi/Limitazioni
Bisogna conoscere il contenuto degli item
Cold start per gli utenti: è necessario
molto tempo per conoscere i gusti di tutti
gli utenti
Cosa succede se i gusti cambiano?
Si perde l’effetto serendipity
Filtraggio
Collaborativo
User-User
Seleziono persone con gusti simili a
me. Se altri utenti condividono i
miei gusti, voglio conoscere la loro
opinione.
Item-Item
Cerco item su cui ho espresso una
mia opinione e la confronto con
quella degli altri utenti.
Problemi/Limitazioni
Sparsità
In un set ampio di item, solo alcuni di
questi saranno votati da utenti
User Cold start
Non si conosce abbastanza di un
nuovo utente per dargli suggerimenti
efficaci
Item cold start
Non si può predire il rating di nuove item
finché gli utenti non le voteranno
[Non è un problema per i rating content-
based]
Scalabilità
All’aumentare del numero
dei rating il costo di
aggiornamento diventa
computazionalmente molto
alto
Un esempio
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
Joe e Tom quanto sono simili?
Joe e Bob quanto sono simili?
Consideriamo solo gli item votati da entrambi
Per ogni item
- Calcoliamo la differenza di rating
- Estrapoliamo la media tra tutte le differenze degli
item votati
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 Joe Vs
Bob 1.57
Alice 0.33
Tom 0.18
D = 1 / (1 + d)

[normalizziamo per semplicità]
Raccomandiamo gli item a cui utenti simili hanno
dato un voto alto
Per calcolare il rating di un oggetto da raccomandare
dobbiamo fase una somma pesata sull’indice di
similitudine tra gli utenti
Rating(Joe, Item3) = (1.57 * 7 + 0.33 * 7 + 0.18 * 5) / 3
10.99 + 2.31 + 0.9 / 3 = 4.3
Similarity Joe Vs Item 3
Bob 1.57 7
Alice 0.33 7
Tom 0.18 5
possiamo calcolare il rating su tutta la
matrice di dati
OPPURE
usare un algoritmo K-nn (o nearest
neighbours): cioè su un sottoinsieme di
utenti con gusti simili ai miei.
il nostro case study
e-commerce di libri
sia digitali che cartacei,
carrelli separati, diverse
tipologie categorie di prodotti
Raccomandare titoli (nuovi e vecchi)
- Chi ha comprato X ha comprato
anche Y
- Ti potrebbe interessare
PredictionIO
L’event server
Pattern: utente -- azione -- item
User 1 ha comprato il prodotto X
User 2 ha visto il prodotto Y
User 1 ha aggiunto il prodotto Z nel carrello
Modellazione degli Eventi
cosa dovremmo modellare?
rating, like, acquisto, visita, in base al
tipo di algoritmo scelto
Engines
Implementazione
Due tipi di suggerimenti
- chi ha comprato X ha comprato
anche… (raccomandazione)
- Ti potrebbe anche interessare
(similitudine)
I nostri eventi
Vista
Like (aggiunta al carrello o alla
wishlist)
Conversione (acquisto)
La nostra
implementazione
4 engines
2 per i libri, 2 per gli ebooks
Training ogni notte dell’algoritmo
Registrazione degli eventi in batch
per evitare lentezza del sistema
Cold start
se non abbiamo un numero
sufficiente di suggerimenti il sistema
passa in automatico ad un motore di
suggerimenti non personalizzati
(anche per utenti anonimi): ie.
mostrando solo i Best Sellers
Fine?
No, c’è di più…
https://neo4j.com/developer/guide-build-a-recommendation-engine/
Prossima release
suggerimenti sui
comportamenti degli utenti
ie. tracking della navigazione
ie. suggerimenti basati sul contesto/contenuto
email
personalizzate sui
gusti degli utenti
[ e nuovi eventi correlati ai click su email ]
suggerimenti/offerte
su item presenti sui
carrelli abbandonati
chatbot per
suggerire nuovi
titoli
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
mi chiamo 

Francesco Fullone
e sono il CEO di
fullo
fullo / ideatosrl
ff@ideato.it

More Related Content

More from Francesco Fullone

MVP & Startup, with OpenSource Software and Microsoft Azure
MVP & Startup, with OpenSource Software and Microsoft AzureMVP & Startup, with OpenSource Software and Microsoft Azure
MVP & Startup, with OpenSource Software and Microsoft AzureFrancesco Fullone
 
Help yourself, grow an healthy ecosystem
Help yourself, grow an healthy ecosystemHelp yourself, grow an healthy ecosystem
Help yourself, grow an healthy ecosystemFrancesco Fullone
 
Outsourcing, partners or suppliers?
Outsourcing, partners or suppliers?Outsourcing, partners or suppliers?
Outsourcing, partners or suppliers?Francesco Fullone
 
From brainstorming to product development
From brainstorming to product developmentFrom brainstorming to product development
From brainstorming to product developmentFrancesco Fullone
 
Compromises and not solution
Compromises and not solutionCompromises and not solution
Compromises and not solutionFrancesco Fullone
 
From webagency to...a better job, life and a lot of fun
From webagency to...a better job, life and a lot of funFrom webagency to...a better job, life and a lot of fun
From webagency to...a better job, life and a lot of funFrancesco Fullone
 
Open Source in the web enterprise world a secure success
Open Source in the web enterprise world a secure successOpen Source in the web enterprise world a secure success
Open Source in the web enterprise world a secure successFrancesco Fullone
 
Your browser, your storage (extended version)
Your browser, your storage (extended version)Your browser, your storage (extended version)
Your browser, your storage (extended version)Francesco Fullone
 
extended slow parts, HTML5 meets WPO
extended slow parts, HTML5 meets WPOextended slow parts, HTML5 meets WPO
extended slow parts, HTML5 meets WPOFrancesco Fullone
 
Don't touch the mobile parts
Don't touch the mobile partsDon't touch the mobile parts
Don't touch the mobile partsFrancesco Fullone
 

More from Francesco Fullone (20)

Continuous budgeting
Continuous budgetingContinuous budgeting
Continuous budgeting
 
Remote working istruzioni
Remote working istruzioniRemote working istruzioni
Remote working istruzioni
 
Remote working istruzioni
Remote working istruzioniRemote working istruzioni
Remote working istruzioni
 
MVP & Startup, with OpenSource Software and Microsoft Azure
MVP & Startup, with OpenSource Software and Microsoft AzureMVP & Startup, with OpenSource Software and Microsoft Azure
MVP & Startup, with OpenSource Software and Microsoft Azure
 
Remote working istruzioni
Remote working istruzioniRemote working istruzioni
Remote working istruzioni
 
Help yourself, grow an healthy ecosystem
Help yourself, grow an healthy ecosystemHelp yourself, grow an healthy ecosystem
Help yourself, grow an healthy ecosystem
 
Outsourcing, partners or suppliers?
Outsourcing, partners or suppliers?Outsourcing, partners or suppliers?
Outsourcing, partners or suppliers?
 
From brainstorming to product development
From brainstorming to product developmentFrom brainstorming to product development
From brainstorming to product development
 
Compromises and not solution
Compromises and not solutionCompromises and not solution
Compromises and not solution
 
PHP Goes Enterprise
PHP Goes EnterprisePHP Goes Enterprise
PHP Goes Enterprise
 
your browser, my storage
your browser, my storageyour browser, my storage
your browser, my storage
 
From webagency to...a better job, life and a lot of fun
From webagency to...a better job, life and a lot of funFrom webagency to...a better job, life and a lot of fun
From webagency to...a better job, life and a lot of fun
 
Open Source in the web enterprise world a secure success
Open Source in the web enterprise world a secure successOpen Source in the web enterprise world a secure success
Open Source in the web enterprise world a secure success
 
Compromessi e non soluzioni
Compromessi e non soluzioniCompromessi e non soluzioni
Compromessi e non soluzioni
 
Your browser, your storage (extended version)
Your browser, your storage (extended version)Your browser, your storage (extended version)
Your browser, your storage (extended version)
 
extended slow parts, HTML5 meets WPO
extended slow parts, HTML5 meets WPOextended slow parts, HTML5 meets WPO
extended slow parts, HTML5 meets WPO
 
Don't touch the mobile parts
Don't touch the mobile partsDon't touch the mobile parts
Don't touch the mobile parts
 
your browser, your storage
your browser, your storageyour browser, your storage
your browser, your storage
 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsday
 
Your browser, my storage
Your browser, my storageYour browser, my storage
Your browser, my storage
 

A recommendation engine for your applications