Databases Reference
In-Depth Information
Figure 2-6. Modeling a user's order history in a graph
Now we can start to make recommendations. If we notice that users who buy strawberry
ice cream also buy espresso beans, we can start to recommend those beans to users who
normally only buy the ice cream. But this is a rather one-dimensional recommendation,
even if we traverse lots of orders to ensure there's a strong correlation between straw‐
berry ice cream and espresso beans. We can do much better. To increase our graph's
power, we can join it to graphs from other domains. Because graphs are naturally multi-
dimensional structures, it's then quite straightforward to ask more sophisticated ques‐
tions of the data to gain access to a fine-tuned market segment. For example, we can
ask the graph to find for us “all the flavors of ice cream liked by people who live near a
user, and enjoy espresso, but dislike Brussels sprouts.”
For the purpose of our interpretation of the data, we can consider the degree to which
someone repeatedly buys a product to be indicative of whether or not he likes that
product. But how might we define “living near”? Well, it turns out that geospatial co‐
ordinates are best modeled as graphs. One of the most popular structures for repre‐
senting geospatial coordinates is called an R-Tree . An R-Tree is a graph-like index that
describes bounded boxes around geographies. Using such a structure we can describe
overlapping hierarchies of locations. For example, we can represent the fact that London
is in the UK, and that the postal code SW11 1BD is in Battersea, which is a district in
 
Search WWH ::




Custom Search