Database Reference
In-Depth Information
Recommendations based on product
purchases
Let's build this thingfromthegroundup.Theirstquerywewanttowriteisbased
onpastpurchasingbehavior.Wewouldliketoindpeoplethatalreadysharea
couple of products that they have purchased in the past, but that also explicitly do
not share a number of other products. In our data model, this Cypher query would
go something like this:
match (p1:Person)-[:BOUGHT]->(prod1:Product)<-[:BOUGHT]-(p2:Person)-
[:BOUGHT]->(prod2:Product)
where not(p1-[:BOUGHT]->prod2)
return p1.name as FirstPerson, p2.name as SecondPerson, prod1.name as
CommonProduct, prod2.name as RecommendedProduct;
In this query, the match clause gathers the pattern of users ( p1 and p2 ) that have
bought a common product ( prod1 ), but ensures that p2 has actually bought one or
more product(s) that p1 has not bought.
The result is actually quite an extensive list of recommendations, as shown in the
following screenshot:
Sowecanprobablydowithsomereiningthere.
The next step in our recommendation process would therefore be to look at two
people that have a stronger similarity. This means that the two people would need
to have bought more than two products in common before the recommended
product would actually be assumed to be attractive to the target audience.
 
Search WWH ::




Custom Search