Does time change the answer?

Spatial vs space-time clustering · GGR444
Step 1

Where are the hotspots?

One year of incident reports across a 10 km × 10 km city. Each dot is one incident. Everything you will see is the same dataset, looked at in different ways.

Map of all incidents. Hover a point for its day of year. Scroll to zoom, drag to pan.

The dataset

incidents
10 × 10km study area
365days

Columns: x_km, y_km, day. That is all a clustering algorithm gets.

The data is synthetic and was generated with known patterns, revealed in Step 6.

Step 2

Spatial clustering: DBSCAN on x and y

DBSCAN finds dense regions: a point is a core point if at least minPts neighbours lie within radius ε. Clusters grow from core points; everything else is noise.

2D DBSCAN result. Grey = noise. Clusters are numbered by size.

Parameters

clusters found
points labelled noise

Three clear hotspots. The map looks convincing. A report could be written from this.

Step 3

Same points, one month at a time

Colours are still the 2D DBSCAN labels from Step 2. Press play and watch what each "hotspot" does over the year.

Use the slider or press play. Each frame shows only the incidents from that month.

What to watch for

  • Cluster 1 lights up in February, disappears, then comes back in October. Is it one hotspot or two events?
  • Cluster 2 is not a place at all. It moves north from June to August.
  • Cluster 3 is there every single month, at the same low rate.
  • In July, look at the south-west. A cloud of "noise" appears together and vanishes a week later.

The 2D map summed the whole year into one picture. Every one of these stories was flattened away.

Step 4

The space-time cube

Put time on the vertical axis. x and y are the map; height is the day of year. Drag to rotate. Now every pattern from the animation is visible at once.

Toggle between raw points and the 2D DBSCAN colours. Drag to rotate, scroll to zoom.

Reading the cube

  • A vertical column is a place that is busy all year (chronic).
  • Two separate blobs stacked on the same x, y are two events at one site.
  • A diagonal streak is a hotspot that moves.
  • A flat, wide disc is a short burst spread over a district.

2D DBSCAN sees the cube only from directly above: all of these project onto the map as "a dense area", or, for the flat disc, as nothing at all.

Step 5

Space-time clustering: ST-DBSCAN

Same idea as DBSCAN, but with two radii. A neighbour must be within εspace and within εtime. The neighbourhood is a cylinder in the cube, not a disc on the map.

ST-DBSCAN result. The buttons change εtime only; εspace and minPts stay fixed.

Parameters

DBSCAN: disc radius ε 2εtime ST-DBSCAN: cylinder radius εspace, height 2εtime

The time window is a dial

  • ±3 days: too narrow. The moving hotspot shatters into fragments.
  • ±7 days: the recurring site splits in two, the burst appears, the chronic site is gone.
  • ±21 days: the chronic site comes back as a cluster.
  • ±60 days: too wide. Background floods in and clusters merge.

Why is εspace larger here than in Step 2? Within a two-week window the background is thin, so the same radius holds far fewer background points. Parameters are always set relative to the density of the space you search in.

Step 6

Same data, two answers

Left: what the 2D analysis reported. Middle: what the space-time analysis reported. Right: how the data was actually generated.

2D DBSCAN (space only)
ST-DBSCAN (space + time, ± days)
Ground truth (how it was generated)