Building a real-time recommendation engine with Neo4j OSCON 2017 William Lyon @lyonwj
William Lyon Developer Relations Engineer @neo4j will@neo4j.com @lyonwj lyonwj.com
Agenda • • • • Use cases • Recommender systems • Hands-on! • Graph data modeling • Cypher
Neo4j Graph Database • • • • •
Graph Data Model
Labeled Property Graph Model
Labeled Property Graph Model
The Graph
The Graph
The Graph
The Graph
The Graph
openCypher (queryLanguage)-[:FOR]->(graphs)
Cypher
Use Case: Personalized Recommendations
Personalized Real-Time Personalized Real-Time Personalized Promotions Recommendations Recommendations
Collaborative Filtering Content Based An algorithm that considers users An algorithm that considers Algorithm Types interactions with products, with the similarities between products and assumption that other users will categories of products. behave in similar ways. Product Product Category Customer Product Product Data-Model (Expressed as a graph) Product Product Category Customer
Polyglot Persistence Products Customers / Users Inventory Inventory Location Location Category Category Price Price Purchase Purchase Configurations Configurations Return Return Review Review View View In-store Purchases In-store Purchases Location Location RELATIONAL DB WIDE COLUMN DOCUMENT STORE RELATIONAL DB KEY VALUE STORE DOCUMENT STORE STORE Purchases Product Views User Review In-Store Shopping Cart Catalogue Purchase
Recommendations require an operational workload — it’s in the moment, real-time! Good for Analytics, BI, Map Reduce Non-Operational, Slow Data Lake Queries RELATIONAL DB WIDE COLUMN DOCUMENT STORE RELATIONAL DB KEY VALUE STORE DOCUMENT STORE STORE Purchases Product Views User Review In-Store Shopping Cart Catalogue Purchase
Apps and Systems Drivers: Java | JavaScript | Python | .Net | PHP | Go | Ruby Real-Time Queries Connector RELATIONAL DB WIDE COLUMN DOCUMENT STORE RELATIONAL DB KEY VALUE STORE DOCUMENT STORE STORE Purchases Product Views User Review In-Store Shopping Cart Catalogue Purchase
Graph-based recommendations
Collaborative Filtering
Collaborative Filtering
Collaborative Filtering
Collaborative Filtering
In Cypher
In Cypher
Content Filtering
Content Filtering
Content Filtering w/ Cypher
Content Filtering - Concept Hierarchy
Content Filtering - Concept Hierarchy
Content Filtering - Concept Hierarchy
Content Filtering - Concept Hierarchy w/ Cypher
Content Filtering - Concept Hierarchy w/ Cypher
Neo4j Sandbox
● → ○ ○ ● → ○ ○
Click “Neo4j Browser”
You should see this: Neo4j Browser ● Query workbench / visualization for Neo4j ● Interactive “guides” for our tutorial today ● Embed content, queries
(you)-[:HAVE]->(?) (?)<-[:ANSWERS]-(will)
Recommend
More recommend