Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Recommendation Engines with Neo4j, Symfony and Reco4PHP

528 views

Published on

Graph Databases are naturally well-suited for building recommendation engines. In this talk, Christophe will share his experience building a number of production-ready recommendation engines using Neo4j and introduce the
open-source GraphAware Reco4PHP Library, which enables PHP developers to rapidly build their own recommendation systems.

This presentation starts by a brief explanation of why graphs are a suitable data model for building recommendation systems. A summary of typical recommendation engine requirements follows, including the business and technical challenges these requirements introduce.

What follows is a demonstration of how this open-source recommendation engine skeleton solves many of the issues and how it handles the "plumbing", so that developers can focus on expressing the business logic specific to their domain. We will then see how this can be used in a Micro Edition of Symfony in order to isolate your recommendation as a microservice.

A majority of examples in this talk are drawn from real-world use cases and the speaker's personal experience building recommendation engines. Attendees should have a very basic understanding of graph theory. Prior experience with Neo4j and the Cypher query language is a plus, but not necessary.

Published in: Software
  • Be the first to comment

Recommendation Engines with Neo4j, Symfony and Reco4PHP

  1. 1. Recommendation engine services
  2. 2. About me • Christophe Willemsen • Neo4j & Elasticsearch Senior Consultant @GraphAware • Belgium
  3. 3. What we’ll talk about • Recommendation engines overview • Graph databases – Neo4j (the best fit for reco engines) • There is a library for that – Reco4PHP • Build a reco engine for recommanding people to follow on Github
  4. 4. Recommendations : Overview • News you should read • Books you should buy • Persons you may know • Which version of a package to use • Which service is best suited to handle given failure • Finding the right candidates for medical proofs • …
  5. 5. Main types of recommendations • Content based (features) • Collaborative filtering (relations user <-> item)
  6. 6. The good news Features as well as relationships are naturally represented in a graph database.
  7. 7. Neo4j – a quick intro
  8. 8. The good news The recommendation logic can be represented in a graph traversal.
  9. 9. Example
  10. 10. Recommendation : Business Side Identify business rules in order to provide recommendations that matters
  11. 11. Example
  12. 12. Recommendation : Business Side Recommend to Alice movies rated by persons who rated the same movies than her but that she didn’t actually already rated yet
  13. 13. Your first recommendation query - Cypher
  14. 14. Recommandation : Business Side If the Movie has a Genre that interest Alice, add 1 to the score
  15. 15. Your second recommendation query
  16. 16. The real life is more complex The specifications of a recommendation engine are far more complex in the real life
  17. 17. Real life is more complex Imagine that you should implement the feature “People you may know” on LinkedIn
  18. 18. Real life is more complex After a brainstorming session, you come up with the following ways of finding people you may know
  19. 19. Life is more complex • Common contacts • Facebook friends in common • Mobile/email contacts in common • All contacts of your contacts • Worked for same company • Studied at same school • Share same interests • Lives in same city
  20. 20. Real life is more complex But it’s just the beginning. Let’s go back.
  21. 21. Real life is more complex More contacts in common: More relevant?
  22. 22. Real life is more complex… Same city or studied at same school: Does the size matters?
  23. 23. Real life is more complex What to do with emails that actually don’t represent a person? Should we recommend info@inviqa.com ?
  24. 24. Real life is more complex What should we do with contacts Who are pending? Who are rejected? Who are always ignored?
  25. 25. Real life is more complex Base steps of a recommendation engine • Discover • Qualify • Remove non relevant • Measure quality
  26. 26. #Reco4PHP Open-Source Recommendation Engine Skeleton atop Neo4j
  27. 27. Reco4PHP • Standalone PHP Library • Opinionated architecture • Flexible • Handle all the glue
  28. 28. #Reco4PHP composer require graphaware/reco4php
  29. 29. Let’s build a recommendation engine
  30. 30. Your first recommendation engine Imagine we have a graph representing interactions on Github
  31. 31. Your first recommendation engine Our intention is to recommend people you may follow based on the following : • More followers in common => best score • Contributed to the same repository • Penalize too much followers • Exclude bots • People you already follow shouldn’t be recommended • We don’t want to recommend the user itself of course
  32. 32. Discover
  33. 33. Qualify
  34. 34. Qualify
  35. 35. Blacklists et filtres We could create a blacklist or a filter for excluding the user for whom we are recommending people, but let’s use something built-in.
  36. 36. Bind all together
  37. 37. demo
  38. 38. Questions ?
  39. 39. #thank_you Twitter : @ikwattro - @graph_aware http://graphaware.com https://github.com/graphaware

×