Visual analytics · explainable AI · City of St. Louis, Missouri

A model can tell you what matters. A map tells you where.

We trained a machine-learning model to predict where the 301,578 residents of St. Louis live, then asked it to explain itself. The explanation looked complete until we put it on a map. This page follows that analysis step by step, using the same 8,008 census blocks the whole way through.

8,008census blocks, 2020
61predictor variables
9.1×assessed-value gap across one street
0coordinates given to the model
01The data

What are these?

8,008 dots, all alike. Each one is a census block, the smallest area the 2020 Census counts people in. The median block in St. Louis covers 1.16 hectares, about one city block.

01The data

Each block has a population density

Sorted from empty to crowded. 1,801 blocks have no residents at all: rail yards, parks, industry, and land that has emptied out.

01The data

And each block has a place

Put every dot back where it belongs and the city appears. Density pools in the south side, around Shaw, Tower Grove East and Dutchtown, and thins out north of downtown.

02The model

A model learns the pattern

XGBoost predicts each block's density from 61 variables: building footprints and heights, parcel assessments, the city's land-use plan, Sentinel-2 greenness, VIIRS night-time light and points of interest.

SHAP then splits every prediction into contributions, one per variable. Averaged over all blocks they give the usual ranking. Building form carries 39% of the model, parcel records 31%.

Poisson objective with a log-area offset, so each SHAP value is a contribution to log persons per hectare. Held-out R² 0.62 for this split; 0.44 to 0.62 across random splits.

03The explanation

One variable, one curve

Take the median assessed value of a block's parcels. In this dependence plot each dot is still a block: left to right by value, up when the variable raises the predicted density, down when it lowers it.

This is where an XAI report usually stops. The reading is simple: cheaper blocks hold fewer people, and the effect levels off once values pass about $20,000.

Spearman ρ+0.37
04Into space

Send the dots home

Same dots, same colours, now at their blocks. The blue dots, where value lowers the prediction, are not spread across the city. They gather in the north: The Ville, Fairground, Hamilton Heights.

Moran's I0.55
04Into space

A line the model was never given

The boundary runs along Delmar Boulevard, known locally as the Delmar Divide. The model never saw a coordinate, a street or a neighbourhood name. It found the line from parcel values alone.

Naming it took someone who knows the city. That step is the reason to look.

04Into space

The curve was two cities

Colour each block by its side of Delmar and return to the plot. The single curve splits into two clouds that barely overlap.

North median$3,085South$27,950

The north's 75th percentile ($6,150) is still below the south's 25th ($19,774). North of the line, 30% of parcels are vacant lots, against 14% south of it. Vacancy was kept out of the model.

North of Delmar · 2,040 blocksSouth · 5,968 blocks
04Into space

A variable statistics would drop

Night-time light from the VIIRS satellite. Its contributions are small and show no trend with brightness at all.

Spearman ρ+0.03mean |SHAP|0.010
04Into space

On the map it is all structure

The same contributions form one of the most clustered surfaces in the model: raised around downtown, lowered along the northern riverfront. The effect is small. Its pattern is entirely spatial, and no ranking or correlation would have shown it.

Moran's I0.60
05Uncertainty

How sure is the model?

Geographically weighted conformal prediction gives every block its own 90% interval. On held-out blocks the intervals contain the true value 89.9% of the time.

As a distribution: median width 38 persons per hectare, with a long upper tail.

05Uncertainty

Trust is a question of where

Interval width hardly follows the prediction itself (Spearman +0.20). On the map it forms whole regions. The model is least sure around Downtown West, Carr Square and Columbus Square, and most sure on the riverfront.

Moran's I0.91
Why visual analytics

Summaries compress 8,008 places into one shape.

Feature rankings and dependence curves are honest about what the model learned. They are silent about where. Linking the statistical view to the map put that back, and three findings here appeared only in the second view.

1 curvedependence plot
2 citieson the map

Averages hide geography

Assessed value looked like one smooth effect. Mapped, its negative half sits north of Delmar, and the curve turns out to be two populations with a 9.1-fold value gap.

ρ 0.03statistics
I 0.60space

Weak in a table is not absent in space

Night-time light shows no trend in the plot but strong clustering on the map. A rule that drops variables by correlation would have discarded a real spatial signal.

ρ 0.20vs. prediction
I 0.91space

Uncertainty has an address

How far to trust the model depends little on how many people it predicts and a great deal on where the block is. A single error number cannot carry that.

Try it

Brush one view, read the other

Drag a rectangle on the plot or the map. The selected blocks light up in both, and the panel on the right summarises them. The example selection below takes the blocks where assessed value lowers the prediction most.

Dependence plot
Map
Blocks selected
–
Residents
–
Median density
–
North of Delmar
–
Vacant-lot share
–
Mean SHAP
–

Hover the map to name a block's neighbourhood.