Skip to content

feat(training): trained-weights overview with per-fit reach#10

Merged
Flowm merged 3 commits into
mainfrom
claude/sharp-pare-fa727d
Jun 26, 2026
Merged

feat(training): trained-weights overview with per-fit reach#10
Flowm merged 3 commits into
mainfrom
claude/sharp-pare-fa727d

Conversation

@Flowm

@Flowm Flowm commented Jun 25, 2026

Copy link
Copy Markdown
Owner

What

Adds two things to the training page (/train), then refactors its layout to match the rest of the app.

1. Device-wide trained-weights overview

A new section at the bottom of the page lists every location with a stored fit on the device (scanning meteocompare:weights:*): name, trained date, out-of-sample improvement, count of models actually tuned, an inline reach selector, jump-to navigation, and Clear. Current location sorts first.

2. Per-fit "reach"

A stored fit can now declare a reach radius (This point only / 25 / 50 / 100 / 250 km) so its trained weights also apply to nearby locations that have no fit of their own.

Resolution lives entirely behind the existing loadWeights(lat, lon) chokepoint:

  • the exact grid cell still wins;
  • otherwise the nearest training location whose reach covers the point is used;
  • uniform within the radius, hard cutoff at the edge (no distance falloff).

Because it's behind loadWeights, the live forecast and the verification "Aggregate (tuned)" row inherit it for free.

3. Collapsible-heading refactor

/train now uses the same CollapsibleSection component as the forecast and verification pages. The page-level <h1>/<h2> give way to section titles; the location and the stored-fit count surface as header summaries while collapsed.

Why

Closes the gap where a fit trained at one location couldn't benefit nearby points, and gives users a single place to see/manage every fit. The refactor unifies heading/collapse behaviour across all three pages.

Notes for reviewers

  • Storage shape change: StoredWeights gains optional location: {name, detail?, latitude, longitude} + radiusKm. Pre-existing entries (no location/radius) fall back to their grid-cell center and this point only, so they keep working unchanged.
  • Verification behaviour: with reach set, the "Aggregate (tuned)" row will now appear at covered neighbours too (that row ignores the live toggle by design). Intentional, but worth a look if you'd prefer reach to affect only the live forecast.
  • Docs: added a Training glossary section to CONTEXT.md (Trained weights / Training location / Reach), deliberately avoiding coverage and region which are already taken. No ADR — treated as an extension of ADR 0007.
  • New src/domain/geo.ts haversineKm helper for the radius test.

Verification

  • npm run lint, npm run type-check, npm test all green (164 tests, incl. 8 new for reach/precedence/management + 4 for haversine).
  • Browser-verified: overview renders/sorts, reach select persists and re-resolves, jump-to navigates, sections collapse/expand with summary chips.

Assisted-by: ClaudeCode:claude-opus-4-8

Flowm added 2 commits June 25, 2026 21:29
The training page now lists every location with stored trained weights
on the device, and a fit can declare a reach radius so its weights apply
to nearby locations that have no fit of their own.

Reach resolution lives behind the existing loadWeights(lat, lon)
chokepoint: the exact grid cell still wins, otherwise the nearest
training location whose reach covers the point is used (uniform within
the radius, hard cutoff). The live forecast and the verification
"Aggregate (tuned)" row inherit this for free. StoredWeights gains an
optional location + radiusKm; pre-reach entries fall back to their grid
cell and "this point only".

Assisted-by: ClaudeCode:claude-opus-4-8
Wrap the training flow and the device-wide weights overview in the same
CollapsibleSection component the forecast and verification pages use, so
all three surfaces share one heading style and collapse behaviour. The
page-level <h1>/<h2> give way to the section titles; the location and the
stored-fit count surface as header summaries while collapsed.

Assisted-by: ClaudeCode:claude-opus-4-8
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

⛅ Preview deployment

This PR is live at https://preview-ee636ede-meteocompare.frcy.workers.dev

Commit ee636ede — reproduce locally with npm run deploy:preview.

Add title tooltips explaining the Train/val, Heuristic (val), Trained
(val) and Improvement fit stats, and show a pointer cursor on the
overview's jump-to-location button so it reads as clickable.

Assisted-by: ClaudeCode:claude-opus-4-8
@Flowm
Flowm merged commit 394cc95 into main Jun 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant