MAD (discharge) ranges for BT, GR, KO and RB in default_tuned, scored on held-out groups (#302) - #303
Merged
NewGraphEnvironment merged 11 commits intoOct 2, 2026
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
data-raw/query_habitat_thresholds_mad.R measures mean annual discharge at fish observation locations for BT, GR, KO and RB, using lnk_habitat_validate() on every discharge-covered fresh_default WSG put on the mad model. The tested segment set per stage is fresh's own compiled waterbody SQL; it was checked against fresh's mad predicates over every fresh_default segment. PWF: plan review, three code-check rounds, literature review, operator decisions (thin-spawn fallback, expected-count floor, underpowered walk). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Full run of query_habitat_thresholds_mad.R over the 46 discharge-covered fresh_default WSGs (link a7f919e, clean). Candidates (P05, floored to 2 s.f., max open): BT spawn and rear 0.027, GR 0.095 and 0.095, KO spawn 0.57, RB spawn 0.011 and rear 0.0094 m3/s; BT and GR spawning take the operator's any-stage fallback (17 and 7 spawn-staged locations). width_mad_equivalent.txt: the BC-native discharge at the current width minima (1.5 m ~ 0.021, 2 m ~ 0.041, 4 m ~ 0.20 m3/s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
habitat_variants_build.R / habitat_variants_score.R: - optional variants.csv columns: model (cw|mad; a mad variant's bundle carries a method table putting its role WSGs on mad) and set (fixed *_mad_* cells, e.g. the other stage's range a clustered rearing ladder needs) - an anchor rung (cw base to the first mad rung) is taken by construction and reported both ways; lowering a _min adds habitat - a MAD ladder's core is its mad rungs (the cw base would cut it on width) - --floor=found|expected names the n-floor of record; an underpowered first step past an anchor lands its value unscored - built.csv records the method sha; the score checks every set cell, each bundle's model and ladder consistency - --working-prefix derived from --prefix; a non-#284 variants file needs an explicit --prefix and --out query_habitat_thresholds_fiss.R: --species, --out, snapped segment mad_m3s; defaults reproduce #284. Three code-check rounds, the last an enumeration of 83 derivation sites; re-scoring #284's build reproduces all ten committed outputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
… FISS research/habitat_thresholds.md gains a MAD section written before any build: the Phase 1 candidates, method and the operator's thin-spawn fallback, literature, FISS (no separation at the candidates), and the scoring design (anchor P10 -> P05 -> P02 per species x stage, core = the mad rungs, expected-count floor of record, an underpowered first step lands P05 unscored, KO unscorable). variants_302.csv / wsg_roles_302.csv: six ladders; held-out BT 7, GR 3, RB 6 WSGs, PARS/KOTL in-sample (20-WSG closure). power_windows.*: counts per window before the build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Build: link c2fed37 clean, 20-WSG closure (LHAF pre-flighted), 18 mad variants on one shared segmentation, every invariant asserted, 145 min. Score: --floor=expected (pre-registered). Every P10 -> P05 loosening is refused on the held-out WSGs (density 0.12-0.46 of the core rate) except RB spawning (0.80, taken; P05 -> P02 underpowered). Walked values: BT 0.078, GR 0.97 rear / 0.96 spawn, RB 0.019 rear / 0.011 spawn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
default_tuned/parameters_habitat_thresholds.csv: the walked values of record from the pre-registered scoring (BT 0.078 spawn and rear, GR 0.96 spawn / 0.97 rear, RB 0.011 spawn / 0.019 rear; KO 0.57, the unscored candidate), every maximum open. Inert while every group is on cw. research/habitat_thresholds.md: verdict and results, including what the landed values cost against cw (at least -33 % BT and -82 % GR stream rearing on the held-out WSGs) and that stream size and sampling effort are not separated. RUNBOOK 7: lake/wetland bucket columns are gated by a rear range; default_tuned carries MAD ranges. config.yaml checksum and provenance, README and the default_tuned test updated. Lint-only edits to the Phase 1 driver (outputs byte-identical). Three code-check rounds, the last an enumeration of 58 claims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
NewGraphEnvironment
deleted the
302-tune-mad-discharge-thresholds-for-bt-gr-
branch
October 2, 2026 20:50
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.
Summary
default_tunedgains mean-annual-discharge ranges for BT, GR, KO and RB, the speciesdefaultleaves without one. Any group moved tomadused to lose all of their stream habitat. The values (m³/s, every maximum open) are BT 0.078 spawn and rear, GR 0.96 spawn and 0.97 rear, RB 0.011 spawn and 0.019 rear, and KO 0.57 spawn, unscored. They change no output while every group is oncw.Each value was calibrated on fish observations at the 46
fresh_defaultgroups that have discharge, using the newdata-raw/query_habitat_thresholds_mad.Rwithlnk_habitat_validate()as the instrument. Each was then scored on held-out groups by a rule fixed before any build. Every P10 → P05 loosening was refused except RB spawning, so the walked values land.Cost before moving any group to
mad: on the held-out groups, BT keeps at least 33 % less stream rearing than undercw, GR at least 82 % less, and RB 4 % less. Stream size and sampling effort are not yet separated, so a size-stratified core is the next tuning. Details:research/habitat_thresholds.md, "MAD (discharge) ranges for BT, GR, KO and RB (Tune MAD (discharge) thresholds for BT, GR, KO and RB rather than leave them missing #302)".The Research: calibrate CH and BT gradient and channel-width thresholds from observations #284 variants harness now scores MAD ladders.
modelandsetcolumns.madrung._mincolumns loosen downward.--floor=found|expectedand--working-prefix.Re-scoring Research: calibrate CH and BT gradient and channel-width thresholds from observations #284's build reproduces all ten committed outputs.
Related Issues
Test plan
devtools::test(): 2,378 pass, 0 fail, 16 warnings, the same as the existing baseline.test-lnk_config.Rpins the newdefault_tunedcells.lnk_config_verify(lnk_config("default_tuned")): no drift.devtools::check(): 0 errors. The 3 warnings and 2 notes are all inR/andman/files this branch does not touch./code-checkwith three rounds each on the driver, the harness and the landing, plus a plan review. The harness and landing rounds ended by enumeration, of 83 derivation sites and 58 prose claims.Notes
wetland_ha_min. The draft is in the session for your review./gh-pr-merge).score302_*/working_score302_*in local docker fwapg.🤖 Generated with Claude Code
https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx