When machines smooth out outliers

"It works on my machine." It has been a phrase that I've used throughout my time developing data products on the web. Differences in device, software available, location—they're all obstacles to something I've built and want to share. This was the problem I had with two data exploration pieces I had to undertake, both related to Camden.

The first was around two years worth of crime data around the period of the pandemic and was also linked to wards, both population and deprivation in Camden. The second was linked to a snapshot survey of the state of 25,000 trees inspected by the borough in 2024. I'd done the usual: load the data, clean the data, and treat it for inevitable errors and missing data.

This was done using Jupyter Notebook, but I was hoping that learning Svelte and Supabase would provide a simple place to dust off the data and give it a fresh airing. This is a cautionary note on how an LLM, although unaffected by exhaustion, can nonetheless take shortcuts which can quickly cause a project to go off the rails. It used my description to generate plausible but ultimately faked data. This project is about the subtle nuance required to stop the machine from smoothing away the forensic truth.

1. The Master Ward Table (The Anchor)

The Nuance Fix: Restore all 11 columns I originally identified: Carbon Storage, Pollution Removal, IMD Decile, and Median Price.

The Fix: The LLM's "machine" lazily trimmed this to 3 columns; you must restore the full 11-column grid and include the inline Sparkline Histograms to show the Highgate spread.

Ward-Level Metrics & Tree Output

Ward NameCavat HistIMD DecileCapital Asset Value per TreeMedian sale price (2024)Number Of TreesWorkPopTrees per WorkPopCrimes per 1,000 PeopleCarbon Storage per TreeGross Carbon Sequestration per TreePollution Removal per Tree
Belsize
7.510,370.92992,5007011,233.880.568375.3623148.6190.5
Bloomsbury
64,537.04505,0001,2711,346.380.9441,794.27159.255.8161.8
Camden Square
33,728.35690,0009941,261.50.788501.624181.456.6143.7
Camden Town
3.51,229.12657,5004981,221.50.4081,626.4145.653.344.4
Fortune Green
82,213.23700,0001,4791,328.251.113362.306152.75.988.5
Frognal
95,898.38947,5001,2101,118.751.082202.979200.36.7138.9
Gospel Oak
63,342.68695,0001,8271,192.251.532404.219187.56.8597.5
Hampstead Town
97,634.711,270,0009501,060.380.896364.019233.77.4121.3
Haverstock
45,328.34650,0001,6001,265.751.264391.352190.36.55146.6
Highgate
6.55,443.66813,0002,7011,033.132.614408.149174.156.4112.6
Holborn & Covent Garden
55,221.42915,0001,3291,452.380.9151,599.442047199.5
Kentish Town North
52,721.83696,2509311,193.880.78378.034120.15.163.85
Kentish Town South
42,454.88732,7501,2531,3000.964536.98577.84.152.5
Kilburn
43,621.19615,0001,7001,220.751.393494.255142.15.7122.4
King's Cross
35,394.03645,0001,0751,254.250.8571,064.12182.66.4163
Primrose Hill
75,854.141,190,0001,0881,1350.959349.211215.66.9147.5
Regent's Park
34,766.17614,0009851,192.130.826843.75298.78.1218.2
St Pancras & Somers Town
33,883.7500,0001,7381,196.751.452587.406215.67.2122.35
South Hampstead
54,314.96685,0006891,211.880.569299.185203.956.9139.4
West Hampstead
62,209.39650,0008801,3390.657443.0621054.871.7

2. Strategic Map & Site Density

The Nuance Fix: The LLM produced a high-chroma "vibrating" red/green map that obscured the data.

The Fix: Revert to the desaturated Yellow-Green-Blue palette. Use the site_name grain (Waterlow Park, etc.) to show density bubbles rather than plotting 25,000 points.

Camden Strategic Multi-Layer Map

Camden Site Density Map

Double-click empty space to zoom out.

3. Crime Time Series (Temporal Signal)

The Nuance Fix: The LLM instinctively "hallucinated" a curve through early 2021.

The Fix: You must render the explicitly broken line to tell the truth about the missing months. Use the Tableau20 palette with Focus & Dim hover logic.

4. The Correlation Matrix

The Nuance Fix: The LLM’s "machine" failed the layout, overlapping labels until they were unreadable.

The Fix: Constrain the layout to a professional grid where labels do not collide. Recreate the 16x16 tree matrix specifically to point to further investigative steps.

Correlation Matrix

Capital Asset Value ...
Carbon Storage per T...
Gross Carbon Sequest...
Pollution Removal pe...
Height In Metres
Spread In Metres
Diameter At Breast H...
Longitude
Latitude
Median Price
WorkPop
IMDScore
IMD_Decile
Number Of Trees
Capital Asset Value per Tree
1.00
Correlation: 1.000
0.89
Correlation: 0.886
0.70
Correlation: 0.701
0.77
Correlation: 0.769
0.66
Correlation: 0.660
0.71
Correlation: 0.708
0.85
Correlation: 0.852
0.08
Correlation: 0.077
-0.07
Correlation: -0.071
0.04
Correlation: 0.042
0.02
Correlation: 0.018
-0.07
Correlation: -0.067
0.07
Correlation: 0.066
-0.04
Correlation: -0.039
Carbon Storage per Tree
0.89
Correlation: 0.886
1.00
Correlation: 1.000
0.84
Correlation: 0.836
0.80
Correlation: 0.801
0.66
Correlation: 0.664
0.74
Correlation: 0.739
0.87
Correlation: 0.868
0.08
Correlation: 0.079
-0.10
Correlation: -0.101
0.03
Correlation: 0.029
0.03
Correlation: 0.033
-0.06
Correlation: -0.063
0.06
Correlation: 0.059
-0.04
Correlation: -0.038
Gross Carbon Sequestration per Tree
0.70
Correlation: 0.701
0.84
Correlation: 0.836
1.00
Correlation: 1.000
0.73
Correlation: 0.731
0.74
Correlation: 0.744
0.79
Correlation: 0.786
0.87
Correlation: 0.872
0.06
Correlation: 0.058
-0.07
Correlation: -0.072
0.04
Correlation: 0.036
0.02
Correlation: 0.020
-0.03
Correlation: -0.025
0.03
Correlation: 0.026
-0.06
Correlation: -0.065
Pollution Removal per Tree
0.77
Correlation: 0.769
0.80
Correlation: 0.801
0.73
Correlation: 0.731
1.00
Correlation: 1.000
0.75
Correlation: 0.751
0.87
Correlation: 0.870
0.78
Correlation: 0.782
0.13
Correlation: 0.133
-0.16
Correlation: -0.164
-0.01
Correlation: -0.013
0.05
Correlation: 0.051
-0.01
Correlation: -0.011
0.00
Correlation: 0.004
-0.05
Correlation: -0.046
Height In Metres
0.66
Correlation: 0.660
0.66
Correlation: 0.664
0.74
Correlation: 0.744
0.75
Correlation: 0.751
1.00
Correlation: 1.000
0.85
Correlation: 0.849
0.84
Correlation: 0.839
0.11
Correlation: 0.110
-0.09
Correlation: -0.092
0.02
Correlation: 0.017
0.02
Correlation: 0.018
-0.01
Correlation: -0.007
0.01
Correlation: 0.006
-0.03
Correlation: -0.032
Spread In Metres
0.71
Correlation: 0.708
0.74
Correlation: 0.739
0.79
Correlation: 0.786
0.87
Correlation: 0.870
0.85
Correlation: 0.849
1.00
Correlation: 1.000
0.85
Correlation: 0.852
0.09
Correlation: 0.091
-0.08
Correlation: -0.079
0.03
Correlation: 0.032
-0.00
Correlation: -0.003
-0.03
Correlation: -0.025
0.02
Correlation: 0.024
-0.02
Correlation: -0.021
Diameter At Breast Height
0.85
Correlation: 0.852
0.87
Correlation: 0.868
0.87
Correlation: 0.872
0.78
Correlation: 0.782
0.84
Correlation: 0.839
0.85
Correlation: 0.852
1.00
Correlation: 1.000
0.04
Correlation: 0.042
-0.03
Correlation: -0.028
0.08
Correlation: 0.076
-0.01
Correlation: -0.010
-0.07
Correlation: -0.066
0.07
Correlation: 0.069
-0.04
Correlation: -0.040
Longitude
0.08
Correlation: 0.077
0.08
Correlation: 0.079
0.06
Correlation: 0.058
0.13
Correlation: 0.133
0.11
Correlation: 0.110
0.09
Correlation: 0.091
0.04
Correlation: 0.042
1.00
Correlation: 1.000
-0.46
Correlation: -0.462
-0.19
Correlation: -0.195
0.15
Correlation: 0.148
0.24
Correlation: 0.243
-0.29
Correlation: -0.291
-0.02
Correlation: -0.017
Latitude
-0.07
Correlation: -0.071
-0.10
Correlation: -0.101
-0.07
Correlation: -0.072
-0.16
Correlation: -0.164
-0.09
Correlation: -0.092
-0.08
Correlation: -0.079
-0.03
Correlation: -0.028
-0.46
Correlation: -0.462
1.00
Correlation: 1.000
0.33
Correlation: 0.329
-0.43
Correlation: -0.429
-0.31
Correlation: -0.313
0.35
Correlation: 0.350
0.03
Correlation: 0.025
Median Price
0.04
Correlation: 0.042
0.03
Correlation: 0.029
0.04
Correlation: 0.036
-0.01
Correlation: -0.013
0.02
Correlation: 0.017
0.03
Correlation: 0.032
0.08
Correlation: 0.076
-0.19
Correlation: -0.195
0.33
Correlation: 0.329
1.00
Correlation: 1.000
-0.35
Correlation: -0.347
-0.55
Correlation: -0.552
0.58
Correlation: 0.582
0.00
Correlation: 0.005
WorkPop
0.02
Correlation: 0.018
0.03
Correlation: 0.033
0.02
Correlation: 0.020
0.05
Correlation: 0.051
0.02
Correlation: 0.018
-0.00
Correlation: -0.003
-0.01
Correlation: -0.010
0.15
Correlation: 0.148
-0.43
Correlation: -0.429
-0.35
Correlation: -0.347
1.00
Correlation: 1.000
0.13
Correlation: 0.133
-0.20
Correlation: -0.204
-0.03
Correlation: -0.031
IMDScore
-0.07
Correlation: -0.067
-0.06
Correlation: -0.063
-0.03
Correlation: -0.025
-0.01
Correlation: -0.011
-0.01
Correlation: -0.007
-0.03
Correlation: -0.025
-0.07
Correlation: -0.066
0.24
Correlation: 0.243
-0.31
Correlation: -0.313
-0.55
Correlation: -0.552
0.13
Correlation: 0.133
1.00
Correlation: 1.000
-0.97
Correlation: -0.971
-0.01
Correlation: -0.006
IMD_Decile
0.07
Correlation: 0.066
0.06
Correlation: 0.059
0.03
Correlation: 0.026
0.00
Correlation: 0.004
0.01
Correlation: 0.006
0.02
Correlation: 0.024
0.07
Correlation: 0.069
-0.29
Correlation: -0.291
0.35
Correlation: 0.350
0.58
Correlation: 0.582
-0.20
Correlation: -0.204
-0.97
Correlation: -0.971
1.00
Correlation: 1.000
0.01
Correlation: 0.007
Number Of Trees
-0.04
Correlation: -0.039
-0.04
Correlation: -0.038
-0.06
Correlation: -0.065
-0.05
Correlation: -0.046
-0.03
Correlation: -0.032
-0.02
Correlation: -0.021
-0.04
Correlation: -0.040
-0.02
Correlation: -0.017
0.03
Correlation: 0.025
0.00
Correlation: 0.005
-0.03
Correlation: -0.031
-0.01
Correlation: -0.006
0.01
Correlation: 0.007
1.00
Correlation: 1.000

5. The £974k Tree (Outlier Integrity)

The Nuance Fix: The LLM initially used .median() aggregation, which literally deleted the £974,234.37 London Plane from the story.

The Fix: Force a Logarithmic X-axis to ensure this forensic outlier is never "squashed" or "smudged".

* Points outside the whiskers are outliers. Logarithmic scale used due to extreme variance.

6. The Pairplot Matrix

The Nuance Fix: The machine wanted to use hexbin aggregation for "web performance".

The Fix: You must plot raw nodes so the distortion caused by the Highgate outliers is a visible, discrete part of the narrative.

Featured Projects

Here are some other projects I've rebuilt in Svelte and Python: