Chapter 8: GPS Clustering and Analytics

Similar documents
Clustering Lecture 4: Density-based Methods

University of Florida CISE department Gator Engineering. Clustering Part 4

Clustering Part 4 DBSCAN

DS504/CS586: Big Data Analytics Big Data Clustering II

DBSCAN. Presented by: Garrett Poppe

CSE 347/447: DATA MINING

Clustering CS 550: Machine Learning

Lecture-17: Clustering with K-Means (Contd: DT + Random Forest)

DS504/CS586: Big Data Analytics Big Data Clustering II

CS 528 Mobile and Ubiquitous Computing Lecture 5b: Location-Aware Computing Emmanuel Agu

Clustering to Reduce Spatial Data Set Size

In this exercise you will display the Geo-tagged Wikipedia Articles Fusion Table in Google Maps.

DATA MINING LECTURE 7. Hierarchical Clustering, DBSCAN The EM Algorithm

Cluster Analysis: Basic Concepts and Algorithms

Density-based clustering algorithms DBSCAN and SNN

Clustering in Data Mining

(Refer Slide Time: 02.06)

Network Traffic Measurements and Analysis

Working with Unlabeled Data Clustering Analysis. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Data Mining 4. Cluster Analysis

Google Analytics. Gain insight into your users. How To Digital Guide 1

Data Mining Algorithms

Unsupervised Learning : Clustering

This is a book about using Visual Basic for Applications (VBA), which is a

Development of an application using a clustering algorithm for definition of collective transportation routes and times

MultiDimensional Signal Processing Master Degree in Ingegneria delle Telecomunicazioni A.A

Density-Based Clustering. Izabela Moise, Evangelos Pournaras

数据挖掘 Introduction to Data Mining

CHAPTER 4: CLUSTER ANALYSIS

K Nearest Neighbor Wrap Up K- Means Clustering. Slides adapted from Prof. Carpuat

Data organization. So what kind of data did we collect?

Faster Clustering with DBSCAN

COMPARISON OF DENSITY-BASED CLUSTERING ALGORITHMS

What is Cluster Analysis?

Introduction to Trajectory Clustering. By YONGLI ZHANG

kjhf MIS 510 sharethisdeal - Final Project Report Team Members:- Damini Akash Krittika Karan Khurana Agrawal Patil Dhingra

Supervised Learning: Nearest Neighbors

This book is about using Visual Basic for Applications (VBA), which is a

ADAPTIVE K MEANS CLUSTERING FOR HUMAN MOBILITY MODELING AND PREDICTION Anu Sharma( ) Advisor: Prof. Peizhao Hu

2. (a) Briefly discuss the forms of Data preprocessing with neat diagram. (b) Explain about concept hierarchy generation for categorical data.

Notes. Reminder: HW2 Due Today by 11:59PM. Review session on Thursday. Midterm next Tuesday (10/10/2017)

University of Florida CISE department Gator Engineering. Clustering Part 5

Notes. Reminder: HW2 Due Today by 11:59PM. Review session on Thursday. Midterm next Tuesday (10/09/2018)

DS595/CS525: Urban Network Analysis --Urban Mobility Prof. Yanhua Li

Pinpoint AVM 4.0 Quick Reports Detailed User Manual

University of Florida CISE department Gator Engineering. Clustering Part 2

Could you make the XNA functions yourself?

Distance-based Methods: Drawbacks

Large-Scale Flight Phase identification from ADS-B Data Using Machine Learning Methods

Knowledge Discovery in Databases

ADCN: An Anisotropic Density-Based Clustering Algorithm for Discovering Spatial Point Patterns with Noise

Introduction to Data Science Lecture 8 Unsupervised Learning. CS 194 Fall 2015 John Canny

Predicting Bus Arrivals Using One Bus Away Real-Time Data

Intro to Analytics Learning Web Analytics

Data Mining Cluster Analysis: Advanced Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining, 2 nd Edition

Intro to Algorithms. Professor Kevin Gold

Mobility Data Management & Exploration

Tizen apps with. Context Awareness, powered by AI. by Shashwat Pradhan, CEO Emberify

MicroStrategy Academic Program

An Efficient Clustering Algorithm for Moving Object Trajectories

Unsupervised learning on Color Images

COSC 311: ALGORITHMS HW1: SORTING

CSE 5243 INTRO. TO DATA MINING

Ctrack Online User Guide

DATA MINING I - CLUSTERING - EXERCISES

Lifehack #1 - Automating Twitter Growth without Being Blocked by Twitter

DATA MINING - 1DL105, 1Dl111. An introductory class in data mining

Clustering Algorithm (DBSCAN) VISHAL BHARTI Computer Science Dept. GC, CUNY

BBS654 Data Mining. Pinar Duygulu. Slides are adapted from Nazli Ikizler

Foundations of Machine Learning CentraleSupélec Fall Clustering Chloé-Agathe Azencot

International Journal of Data Mining & Knowledge Management Process (IJDKP) Vol.7, No.3, May Dr.Zakea Il-Agure and Mr.Hicham Noureddine Itani

Real-Time Insights from the Source

A System of Image Matching and 3D Reconstruction

COPYRIGHTED MATERIAL. Getting Started with Google Analytics. P a r t

ABSTRACTING CONNECTIVITY FOR IOT WITH A BACKHAUL OPERATOR

City, University of London Institutional Repository

Feature Extractors. CS 188: Artificial Intelligence Fall Nearest-Neighbor Classification. The Perceptron Update Rule.

METRO BUS TRACKING SYSTEM

Clustering in Ratemaking: Applications in Territories Clustering

If you re a Facebook marketer, you re likely always looking for ways to

6. Object Identification L AK S H M O U. E D U

CIS 45, The Introduction. What is a database? What is data? What is information?

Task Minder: An Intelligent Task Suggestion Agent

Exploratory Analysis: Clustering

Cluster Analysis (b) Lijun Zhang

An Enhanced Density Clustering Algorithm for Datasets with Complex Structures

Clustering part II 1

Data Preprocessing. Slides by: Shree Jaswal

Data Mining. Part 2. Data Understanding and Preparation. 2.4 Data Transformation. Spring Instructor: Dr. Masoud Yaghini. Data Transformation

Data Reduction and Partitioning in an Extreme Scale GPU-Based Clustering Algorithm

Six Core Data Wrangling Activities. An introductory guide to data wrangling with Trifacta

Trip Reconstruction and Transportation Mode Extraction on Low Data Rate GPS Data from Mobile Phone

understanding media metrics WEB METRICS Basics for Journalists FIRST IN A SERIES

ISSN: (Online) Volume 2, Issue 2, February 2014 International Journal of Advance Research in Computer Science and Management Studies

Extracting Stops from Noisy Trajectories: A Sequence Oriented Clustering Approach

Mining GPS logs to augment location models

Pouya Kousha Fall 2018 CSE 5194 Prof. DK Panda

Grades 7 & 8, Math Circles 31 October/1/2 November, Graph Theory

Infographics and Visualisation (or: Beyond the Pie Chart) LSS: ITNPBD4, 1 November 2016

ENHANCED DBSCAN ALGORITHM

Transcription:

Chapter 8: GPS Clustering and Analytics Location information is crucial for analyzing sensor data and health inferences from mobile and wearable devices. For example, let us say you monitored your stress levels throughout the day and wanted to visualize the data. Location and time is crucial to analyzing the data --- for example, you might detect that stress is highest at work rather than home, or that stress is highest in evenings. But how do you take location data, and visualize it in a way that makes it possible for you to draw such conclusions? If you took all the points where you took measurements and plotted it on a map (such as in the figure on the left), it wouldn t be particularly meaningful. It would be quite useless to tell someone, You were at 33.93885N, 84.33697W at 5pm on 3/17/2014. Clearly, we need a more logical way to find points that an individual might consider significant is to look at where the individual spends her time. For example, the figure on the right shows a logical representation of the location data, where locations have been clustered into logical places. Here, the size of the clusters show how much time you spent in a particular logical place -- you spent a lot of time in the CS building and at the Dorm. The lines between the clusters show how you typically moved between places -- you typically go from your Dorm to Amherst downtown rather than from the CS department to Amherst downtown. Once you have such a representation, you can overlay the data with information about other parameters like heart rate (higher at the gym, presumably), and so on. But how do we go from the raw data plotted on the left to the logical place representation shown on the right? In this chapter, we provide some ideas on how to cluster raw GPS data into meaningful places. Clustering location data Before we launch into the algorithm, let us start by looking at the challenges that one faces while clustering GPS data. Noise: GPS data is noisy. You might be standing at the same location, but GPS readings can be off by several meters. The GPS error depends on numerous factors including the number of satellites visible to the device, indoor vs outdoor environment, tall buildings in the vicinity, weather, and GPS device characteristics. In clustering GPS data to determine the significant places, care needs to be taken to filter this data. Meaningful clusters: One of the major challenges is identifying which GPS co-ordinates correspond to meaningful clusters. For example, there may be GPS points recorded while you

are driving on the freeway, but you are less likely to be interested in freeway than work or home. So, we need a way to identify meaningful clusters, and discard irrelevant ones. Semantic location: While clustering is useful, the ultimate goal is to get semantic location i.e. Home, Work, Coffee Shop, etc rather than Cluster 1 and Cluster 2. So, another challenge is how we convert from clusters to places. GPS Clustering We are going to address these problems in three phases. First, we pre-process data to filter out noisy readings, to reduce the number of readings, and to remove readings that correspond to meaningless locations. Second, we are going to use one of the most common clustering algorithms, referred to as k- means, to cluster the remaining data points. Third, we are going to convert from clusters to semantic locations. Phase 1: Pre-processing (removing noise and outliers) The pre-processing step has the following goals: a) remove noisy data, b) remove meaningless points where you did not spend sufficient time, c) reduce the amount of GPS data that a clustering algorithm (dbscan or k-means) has to process in-order to speed it up. 1. Remove low density points: We look for points that have few neighbors --- in other words, it doesn t look like you spent substantial enough time in that location to be worthwhile to process. For example, you could choose a radius of 20 meters, and threshold of at least 50 neighbors within the 20 meter threshold. Assuming that you were collecting GPS data once a minute, that means that you want to have spent at least 50 minutes in that location, else it is not something that you care about. This approach also filters out noisy readings that are far out since these points will have few neighbors. 2. Remove points with movement. GPS returns speed in addition to co-ordinates. If speed > 0 (or something small, like 0.1), then discard the GPS point. This makes sure that you don t process data while you are walking or driving, which we are not interested in. (Note that if you are interested in travel patterns, you may want to keep data involving movement, but this is not important for identifying semantic locations, which is our objective) 3. Reduce data for stationary locations. When you are stationary (e.g. sitting at a chair), your GPS location will not change for a long time. This will result in too many redundant points that you need to process, which will slow down any clustering algorithm (e.g. k-means). You can address this by not storing points where the change from the previously stored location is less than a small threshold (e.g. 1 meter). Note that you may not want to remove too many such samples, since otherwise it can change the k-means clustering result too much. Try running k-means without this step, and only use this method if you find that it is too slow! Phase II: Clustering There are many methods for clustering GPS points into semantic locations. We will describe two such approaches in this document - k-means clustering and DBSCAN clustering.

K-means Clustering The key parameter that you have to select for k-means is k, the number of clusters. You may typically choose k based on the number of clusters you expect in the data, perhaps you expect about 10 clusters as the places where you typically stay in a day. Given k, the k-means algorithm consists of an iterative algorithm with four steps. 1. Select K initial centroids at random from the points. 2. repeat a. Assign each object to the cluster with the nearest centroid (in terms of distance). b. Re-compute each centroid as the mean of the objects assigned to it. 3. until centroids do not change. While this algorithm sometimes produces suboptimal clusterings, it is fast and really easy to to implement. Lets look at a simple SQL implementation (from Joni Salonen [2]). Suppose we have some location data, already geocoded into latitude-longitude pairs, and we want to find clusters of locations that lie close to each other. We ll use two tables, gps_data to store the data and the cluster assigned to each point, and gps_clusters for the cluster centers: create table gps_data (id int primary key, cluster_id int, lat double, lng double); create table gps_clusters (id int auto_increment primary key, lat double, lng double); The K-means algorithm can now be implemented with the following procedure. DELIMITER // CREATE PROCEDURE kmeans(v_k int) BEGIN TRUNCATE gps_clusters; -- initialize cluster centers INSERT INTO gps_clusters (lat, lng) SELECT lat, lng FROM gps_data LIMIT v_k; REPEAT -- assign clusters to data points UPDATE gps_data d SET cluster_id = (SELECT id FROM gps_clusters c ORDER BY POW(d.lat-c.lat,2)+POW(d.lng-c.lng,2) ASC LIMIT 1); -- calculate new cluster center UPDATE gps_clusters C, (SELECT cluster_id, AVG(lat) AS lat, AVG(lng) AS lng FROM gps_data GROUP BY cluster_id) D SET C.lat=D.lat, C.lng=D.lng WHERE C.id=D.cluster_id; UNTIL ROW_COUNT() = 0 END REPEAT; END// The above code should be quite useful for your assignment as well

To the right is a sample of the output, based on address data: While K-means is simple and effective, it has limitations that one needs to be aware of. Differing sizes: K-means clustering assumes that cluster are roughly similarly sized, so if you have clusters where you expect variable sizes, K-means may not do so well in separating them. An example is shown below. The original points separate into three clusters of unequal size, but the clustered points on the right have a more even distribution. Differing density: If the clusters have very different density in points, it can cause an issue for K-means clustering, which relies on the centroid of the points in-order to separate into clusters. The example below shows an instance where the original points (left) have one low-density cluster and two highdensity clusters. This is clearly visible to the naked eye, but when K-means clusters points, it splits the low-density points to two clusters and combines the high-density clusters into one. This is a limitation of the use of the centroid of the points as the clustering metric.

Non-globular shapes: K-means clustering cannot deal with shapes that are irregular and skewed like the example below. This also stems from the fact that the centroid of a cluster is calculated as the mean over all the points in that cluster, which assumes a globular cluster shape. DBSCAN Clustering Another approach to clustering is the use of DBSCAN, which does not assume that the cluster has a predefined shape (unlike k-means), but assumes that a cluster is a connected regions where the points are relatively dense. DBSCAN requires two parameters: ε (eps) and the minimum number of points required to form a dense region (minpts). Given these parameters, points can be separated into three classes: A point is a core point if it has more than a specified number of points (minpts) within ε (these are points that are at the interior of a cluster) A border point has fewer than minpts within ε, but is in the neighborhood of a core point A noise point is any point that is not a core point or a border point. On the right is an example with eps=1 and minpts=4. The core point (bottom right) has more than four neighbors; the border point (bottom left) has three neighbors, so it is not core, but one of the neighbors is a core point, so it is classified as a border point. The noise point on the top has two neighbors, but neither of these neighbors are core points, so it is classified a noise point. Once the points are divided into core, border and noise points, the DBScan algorithm first removes all the noise points since they are not needed for clustering. After this point, it performs clustering on the remaining points in an iterative manner by using the algorithm described below.

The algorithm is incremental. First, you take a core point that is unlabeled and label it (say as cluster ID i). Then you look for all neighbors of this core point, and label them with the same cluster ID i. This iterates until you finally have no remaining points that need to be labeled. An example is shown below. On the left is the original points, and on the right is the points separated into core, border and noise points. Once the points are clusters, you get the clusters shown on the right.

For more details, look at the detailed description of DBSCAN on Wikipedia. The Wikipedia page also describes the algorithm in pseudocode, which is what you will use for your assignment (reproduced below). DBSCAN(D, eps, MinPts) { C = 0 for each point P in dataset D { if P is visited continue next point mark P as visited NeighborPts = regionquery(p, eps) if sizeof(neighborpts) < MinPts mark P as NOISE else { C = next cluster expandcluster(p, NeighborPts, C, eps, MinPts) expandcluster(p, NeighborPts, C, eps, MinPts) { add P to cluster C for each point P' in NeighborPts { if P' is not visited { mark P' as visited NeighborPts' = regionquery(p', eps) if sizeof(neighborpts') >= MinPts NeighborPts = NeighborPts joined with NeighborPts' if P' is not yet member of any cluster add P' to cluster C regionquery(p, eps) return all points within P's eps-neighborhood (including P) Phase III: Clusters to Semantic Locations Lets now look at how to convert from clusters to semantic locations. This approach takes advantage of the fact that you have already reduced the data from a huge number of GPS locations to a small number of clusters (k). There are a few options to labeling the clusters with semantic location. One approach is to use reverse geo-coding on the cluster centroids, which refers to the process of going from GPS coordinates of the centroid to the name of the place (e.g. street address, place type, etc). There are many reverse geocoding APIs that you can use to get this mapping (e.g. Google or Foursquare API). But such APIs are typically limited to mapping from co-ordinates to address or eateries, and not so good for mapping to entities like gym or CS building, etc. These labels will need to be manually provided, which is not difficult given that you are only dealing with a small number of clusters.

Conclusion In conclusion, we have given you some ideas on how to go about processing GPS location data that you might collect over many days. The techniques that we have suggested are first steps, and more tuning of either the pre-processing step or clustering step will need to be done to get it to work well for your data. But our goal was to get you to a point where you could start exploring on your own, and we hope to have accomplished this. While our discussion is limited to GPS clustering, the problem of visualizing spatio-temporal data on health is broad and difficult to cover in a single chapter. One can imagine visualizing the data in many different ways to make it possible for a user to find useful insights from the data. For example, the figure below shows how you might show GPS clusters, and if a user clicked on a cluster, popup a window that shows a breakdown of social interactions with other individuals within that cluster. There are many such methods to explore on your own. References Discovering Personal Gazetteers: An Interactive Clustering Approach, GIS 2004. K-means Clustering in MySQL - Joni Salonen Personal Visualisation of Spatiotemporal and Social Data - Bo Stendal Sørensen