In a previous blog post we announced our demographic segmentation service as part of the Data Observatory. In today's post we will discuss how we generate these segments and how we went about giving them names.
Finding Segments in the Census
Each one of us is a precious individual snowflake of data… but if you look around your neighborhood you will start noticing similarities to your fellow humans. You might all be roughly the same age have the same income drive to work or take the subway. There are patterns in groups of people everywhere you look.
Luckily we can train computers to pick out these kinds of groupings or clusters of people. We can take each census tract and a selection of the census variables which describe it then using a method called K-means clustering we can identify groups of tracts that are statistical similar to each other.
To see how this might work let's consider a simple example. Imagine we collected data on people's ages and the probability they own a record player. We plot the data and it looks something like this
As humans it's really easy for us to pick out that there are three clusters of people. K-means attempts to find these clusters programmatically. It does this by:
- Randomly guessing where the center of each cluster is
- Finding all points closest to that cluster
- Moving the cluster centers to the mean location of all the points that belong to that cluster
- Repeat until the cluster centers don't move much between iterations.
The end result of this process is to label each point on the graph a 1 2 or 3 depending on what cluster it belongs to. If we color the points by the labels k-means gave them the data looks like this:
Awesome the algorithm has done programmatically what we as humans do instinctively. This simple example is trivial and we didn't need k-means to find the clusters but what if we had 150 different variables to sift through and wanted to find 55 independent clusters as we do with the census? Then its essential to use an algorithm.
Unfortunately the algorithm can't determine meaningful names for these clusters thats up to us. In this example we might decide to call the yellow cluster: 'young hipsters ' the blue cluster: 'parents with mp3 players ' and the green cluster: 'original record player owners.' These names are subjective but informed by our intuition and the data.
Applying the procedure outlined above allows us to segment the census into neighborhoods that fall into one of 55 different clusters. And after many hours of staring at plots of the census variables in each cluster give a to name them. No doubt some of these names can be improved and we are going to keep working on getting more accurate descriptions of these neighborhoods but we wanted to set you lose on them early.
To get a feel for just how diverse a place the U.S. is here are the neighborhood segments for multiple U.S. cities:
##_NOT_FOUND_IMAGE_## https://observatory.cartodb.com/api/v1/map/static/named/tpl_141d46d6_1c85_11e6_9708_0ecfd53eb7d3/300/300.png?bbox=-87.940102%2041.643917%20-87.523979%2042.023026 ##_NOT_FOUND_IMAGE_##
##_NOT_FOUND_IMAGE_## https://observatory.cartodb.com/api/v1/map/static/named/tpl_141d46d6_1c85_11e6_9708_0ecfd53eb7d3/300/300.png?bbox=-74.259094%2040.477398%20-73.700165%2040.91758 ##_NOT_FOUND_IMAGE_##
##_NOT_FOUND_IMAGE_## https://observatory.cartodb.com/api/v1/map/static/named/tpl_141d46d6_1c85_11e6_9708_0ecfd53eb7d3/300/300.png?bbox=-122.459702%2047.480999%20-122.224426%2047.734138 ##_NOT_FOUND_IMAGE_##
##_NOT_FOUND_IMAGE_## https://observatory.cartodb.com/api/v1/map/static/named/tpl_141d46d6_1c85_11e6_9708_0ecfd53eb7d3/300/300.png?bbox=-122.557009%2037.637554%20-122.204649%2037.874373 ##_NOT_FOUND_IMAGE_##
You can explore the 55 segments in more detail using this deep insights dashboard:
To create similar or even better visualizations you can watch our Data Observatory webinar as many times as you need to!
We are working hard to generate segmentation for other countries outside of the U.S. Keep an eye on the blog and CartoDB to find out when we will be launching these.
Until then happy data mapping!