# Recommendation Engine With Neo4j {{tag>recommendation neo4j}} Algorithm Types - [[Collaborative Filtering]] - An algorithm that considers users interactions with products, with the assumption that other users will behave in similar ways. - [[Content Based Filtering]] - An algorithm that considers similarities between products and categories of products ## Using Data Relationships for Recommendations [[Content based filtering]] - Recommend items based on what users have liked in the past [[Collaborative filtering]] - Predict what users like based on the similarity of their behaviors, activities and preference to others ### Collaborative Filtering {{ https://i.imgur.com/ntVbKMN.jpg }} In Cypher MATCH (will:Person {name:"Will"})-[:PURCHASED]->(b:Book)<-[:PURCHASED]-(o:Person) MATCH (o)-[:PURHCASED]->(rec:BooK) WHERE NOT exists((will)-[:PURCHASED]->(rec)) RETURN rec Basic initial approach. Improvements: - aggregate across all purchases - scoring / normalize - compute similarity metrics ### Content Filtering {{ https://i.imgur.com/YD1eWbb.jpg }} In Cypher MATCH (will:Person {name:"Will})-[:PURCHASED]->(b:Book)<-[:HAS_TAG]-(t:Tag) MATCH (t)<-[:HAS_TAG]-(other:Book) WHERE NOT exists((will)-[:PURCHASED]->(other)) RETURN other #### Content Filtering - Concept Hierarchy {{ https://i.imgur.com/qZ3NPrh.jpg }} {{ https://i.imgur.com/qKEer5c.jpg }} ## Ref - https://www.youtube.com/watch?v=wbI5JwIFYEM - https://bit.ly/neo4josconslides - https://bit.ly/neo4jnotebook