Part two of a pair of posts about online recommendation systems and graph theory.
In Part One of the Recommendation System Blog series, we looked at the underpinnings of an online retailer’s recommendation system using a graph database in addition to an online recommendation system of movie titles. Our visualizations however, only introduced three actors into the system; how might the problem change if we had thousands or millions of other data points to consider? And how does this system have the potential to connect you with better healthcare? In this post, we will explore how to use graph traversals and ranking algorithms to provide more complex product, or in our case healthcare provider recommendations.
Let us revisit a similar example as before, but this time, let’s look at recommendations from a healthcare system standpoint.
Rank by Most Views: GroupCount()
In this example, we want to rank providers by how many people who are similar to you, viewed the same provider you are viewing. One of the most basic ways to quickly calculate a recommendation of providers within this type of system is to do a quick group count on the set of providers who were viewed by people like you (we’ll get to how we can do that later).
In the image above, we take a set of people (shown on the left as vertices of a graph) and look at the entire set of doctors they have viewed. In this system, GroupCount() sorts the providers according to who was viewed the most. “Dr. E” is the highest recommended provider as he was viewed by 5 separate people in the system, while “Dr. B” is the least recommended provider as he was viewed by only one.
At PokitDok, we use Gremthon, a Python implementation of gremlin, to perform graph traversals. Gremthon was created by PokitDok’s Engineer #1, Brian Corbin; you can check out Gremthon on GitHub: https://github.com/pokitdok/gremlin-python
The Gremthon traversal to apply a group count on the providers viewed by consumers who also viewed a certain doctor would be:
>sorted(ranked_providers, key=lambda votes: vote)
What about this notion of finding people “like you”?
While there is a whole field of mathematics which examines different ways to rank the above list, let us look at applying
filters for improved personal recommendations. First, the input set into this ranking system, shown in the animated gif at the top of this page, was selected according to the one doctor that you viewed and all other consumers who also viewed that doctor. If you’re willing and opt in, we can easily provide a much more personalized recommendation with a few more pieces of information, like your gender and age. Then, once you view a doctor, we can provide a more personal recommendation which ranks the doctors according to those viewed by people with similar age and gender:
With Gremthon, the graph traversal which provides recommendations from people who are either 5 years older or younger than you would be:
>consumers.filter(lambda consumer: consumer.age sorted(ranked_providers, key=lambda votes: vote)
We can also apply filters in other areas of this traversal. For example we can apply a filter to only recommend providers that match in specialty with the provider you first viewed. When we, as patients, look for personalized health recommendations, we prefer to visit doctors who have been seen by people we know. Right now, the only way to do this is to ask around or post to social media for recommendations from friends and family. With this technology however, PokitDok, like the movie recommendation system from our last post, has the ability to recommend doctors to you based on the doctors your social media friends have previously visited (if they’re willing of course). The recommendation now looks like this:
Now, because we are HIPAA compliant, we’ll never tell you which friends went to which doctor (and we won’t know either). What we can do is give you provider recommendations based on the doctors visited by your online friend group at large. Now, you can hold off on that Facebook post for a general practitioner for that rash of yours…and instead find a recommendation based on your trusted digital network of ‘people like you’. We can give you the personalized recommendation you need... and save you some embarrassment.
- Snake_Byte #28: Term x Document Matrices via Sklearn's DictVectorizer - April 21, 2017
- DC Blockchain Codeathon - April 11, 2017
- Snake_Bytes #5: Vector Distances - October 12, 2016
- TinkerPop and Titan from a Python State of Mind: A Tutorial via Docker - December 15, 2015
- Online Recommendation Systems: Getting Personal with Gremthon - Part 2 - April 14, 2015
- Online Recommendation Systems: What it Really Means to be 'Somebody Like You' - Part 1 - April 7, 2015
- The top 3 things we love most about the PokitDok HealthGraph - January 27, 2015
- The PokitDok HealthGraph - January 20, 2015