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 Name | Cavat Hist | IMD Decile | Capital Asset Value per Tree | Median sale price (2024) | Number Of Trees | WorkPop | Trees per WorkPop | Crimes per 1,000 People | Carbon Storage per Tree | Gross Carbon Sequestration per Tree | Pollution Removal per Tree |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Belsize | 7.5 | 10,370.92 | 992,500 | 701 | 1,233.88 | 0.568 | 375.362 | 314 | 8.6 | 190.5 | |
| Bloomsbury | 6 | 4,537.04 | 505,000 | 1,271 | 1,346.38 | 0.944 | 1,794.27 | 159.25 | 5.8 | 161.8 | |
| Camden Square | 3 | 3,728.35 | 690,000 | 994 | 1,261.5 | 0.788 | 501.624 | 181.45 | 6.6 | 143.7 | |
| Camden Town | 3.5 | 1,229.12 | 657,500 | 498 | 1,221.5 | 0.408 | 1,626.41 | 45.65 | 3.3 | 44.4 | |
| Fortune Green | 8 | 2,213.23 | 700,000 | 1,479 | 1,328.25 | 1.113 | 362.306 | 152.7 | 5.9 | 88.5 | |
| Frognal | 9 | 5,898.38 | 947,500 | 1,210 | 1,118.75 | 1.082 | 202.979 | 200.3 | 6.7 | 138.9 | |
| Gospel Oak | 6 | 3,342.68 | 695,000 | 1,827 | 1,192.25 | 1.532 | 404.219 | 187.5 | 6.85 | 97.5 | |
| Hampstead Town | 9 | 7,634.71 | 1,270,000 | 950 | 1,060.38 | 0.896 | 364.019 | 233.7 | 7.4 | 121.3 | |
| Haverstock | 4 | 5,328.34 | 650,000 | 1,600 | 1,265.75 | 1.264 | 391.352 | 190.3 | 6.55 | 146.6 | |
| Highgate | 6.5 | 5,443.66 | 813,000 | 2,701 | 1,033.13 | 2.614 | 408.149 | 174.15 | 6.4 | 112.6 | |
| Holborn & Covent Garden | 5 | 5,221.42 | 915,000 | 1,329 | 1,452.38 | 0.915 | 1,599.44 | 204 | 7 | 199.5 | |
| Kentish Town North | 5 | 2,721.83 | 696,250 | 931 | 1,193.88 | 0.78 | 378.034 | 120.1 | 5.1 | 63.85 | |
| Kentish Town South | 4 | 2,454.88 | 732,750 | 1,253 | 1,300 | 0.964 | 536.985 | 77.8 | 4.1 | 52.5 | |
| Kilburn | 4 | 3,621.19 | 615,000 | 1,700 | 1,220.75 | 1.393 | 494.255 | 142.1 | 5.7 | 122.4 | |
| King's Cross | 3 | 5,394.03 | 645,000 | 1,075 | 1,254.25 | 0.857 | 1,064.12 | 182.6 | 6.4 | 163 | |
| Primrose Hill | 7 | 5,854.14 | 1,190,000 | 1,088 | 1,135 | 0.959 | 349.211 | 215.6 | 6.9 | 147.5 | |
| Regent's Park | 3 | 4,766.17 | 614,000 | 985 | 1,192.13 | 0.826 | 843.75 | 298.7 | 8.1 | 218.2 | |
| St Pancras & Somers Town | 3 | 3,883.7 | 500,000 | 1,738 | 1,196.75 | 1.452 | 587.406 | 215.6 | 7.2 | 122.35 | |
| South Hampstead | 5 | 4,314.96 | 685,000 | 689 | 1,211.88 | 0.569 | 299.185 | 203.95 | 6.9 | 139.4 | |
| West Hampstead | 6 | 2,209.39 | 650,000 | 880 | 1,339 | 0.657 | 443.062 | 105 | 4.8 | 71.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
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: