[Global-PGM S3] Summary layers: MAP, P(any violence), HDI90/95 upper + probability colour scale (#233) - #253
Merged
Merged
Conversation
…#233) Sample forecasts now collapse into FOUR map layers per PGM target, each an S==1 frame through the same ADR-020 seam: MAP (headline, hover heatmap at step +1), P(any violence) = share of draws > 0, and the upper 90%/95% HDI bounds. CM keeps MAP only (its line graph already carries HDI). New calculate_exceedance_frame in the statistics tower (NaN policy mirrors the MAP collapse; threshold parameterized, strict >). New colour-mode seam through plot_map → raster/PNG renderers: count layers keep the C-191 nonzero-anchored log scale; the probability layer gets a linear 0-1 scale with quarter ticks and a probability-labelled bar — validated at the plot_map boundary, and unit_interval on the choropleth path fails loud. Measured on the real rusty_bucket global ensemble: report = 45.8 MB, 201 s — 60 step PNGs (4 layers x 5 steps x 3 targets) + 3 hover heatmaps. The motivating number: at step +1, P(any) shows 1,399 at-risk cells where MAP shows 80 (163 cells at >=50%) — the layer surfaces the risk a zero-inflated posterior's mode structurally hides. 396 tests green (12 new: exceedance laws incl. the P(any)-superset-of-MAP coverage law, layer plumbing on a real sample frame, colour-mode dispatch on both renderers). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…f B) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #233. Part of epic #230 (tracker #237).
What
Sample forecasts now collapse into four map layers per PGM target — MAP (headline, hover heatmap at +1), P(any violence) (share of draws > 0), and the upper 90%/95% HDI bounds — each an S==1 frame through the same ADR-020 seam, each rendered at every horizon step. CM keeps MAP only (its line graph already carries HDI).
The motivating number (real rusty_bucket data, sb, step +1)
MAP shows 80 at-risk cells; P(any) shows 1,399 (163 at ≥50% probability). The probability layer surfaces the risk surface a zero-inflated posterior's mode structurally hides — this was the epic's founding question.
Colour correctness
New
color_modeseam throughplot_map→ raster/PNG renderers: count layers keep the C-191 nonzero-anchored log scale; the probability layer gets a linear 0–1 scale (quarter ticks, probability-labelled bar). Unknown modes and unit-interval-on-choropleth fail loud (ADR-008).Measured
Report = 45.8 MB, 201 s — 60 step PNGs (4 layers × 5 steps × 3 targets) + 3 hover heatmaps. Under the ~70 MB ceiling with room for S4's polish.
Changes
statistics/dataset_statistics.py:calculate_exceedance_frame(NaN policy mirrors the MAP collapse; strict >, threshold parameterized); exported.templates/reports/forecast.py: layer list construction + layers × steps render loop; heatmap only for the headline layer at +1.mapping/mapping.py:color_modeonplot_map/raster/PNG;_unit_interval_scale; probability colourbar titles; boundary validation.Ritual
review-diff: one docstring finding, fixed. ship-it: ruff clean, 396 passed (2 skipped, 1 xfailed).
🤖 Generated with Claude Code