Skip to content

Revamp Section 6 presence-background evaluation - #10

Draft
mrecos wants to merge 2 commits into
codex/representation-extensionsfrom
codex/section6-evaluation-revamp
Draft

Revamp Section 6 presence-background evaluation#10
mrecos wants to merge 2 commits into
codex/representation-extensionsfrom
codex/section6-evaluation-revamp

Conversation

@mrecos

@mrecos mrecos commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • make common 7 × 7 focal support the primary Section 6 design for sites, training backgrounds, and mapped availability
  • score one fixed uniform sample of valid raster anchors in every spatially grouped fold
  • transform held-out predictions to fold-specific availability percentiles and pool every bag exactly once per repeat
  • lead with mapped-area capture, lift, gain, Continuous Boyce, and held-out site ranks; retain ROC AUC and PR AUC as secondary diagnostics
  • rebuild notebook 05 as a streamlined report driven by one tracked runner/config/result contract
  • add fold-safe availability maps, geometry-only controls, M0–M3 and LR/RF comparisons, compute diagnostics, and optional 9 × 9, 11 × 11, and original-irregular support sensitivities
  • speed nested focal extraction by reading the largest support once and reuse raster handles for batched availability windows

Scientific rationale

Section 6 is presence–background, not presence–confirmed-absence. The constructed background prevalence and a binary threshold are therefore not the main prospection questions. This revision evaluates how efficiently a fixed mapped-area budget captures held-out sites and whether sites concentrate toward higher mapped suitability.

Each fold gets the same availability anchors. Scores from independently fitted folds are placed on a common availability-rank scale before pooling. Tied thresholds explicitly record the achieved mapped fraction and use that achieved fraction—rather than the nominal budget—as the denominator for lift and gain, which avoids favoring discrete models such as random forests.

The geometry-only negative control remains visible. Strong geometry performance under common focal support is treated as a design warning. No method is promoted or removed from this single physio-shed.

Notebook workflow

notebooks/05_section6_model_validation.ipynb now follows one reading order:

  1. configuration and reproducibility contract
  2. data/support audit and leakage checks
  3. geometry gate
  4. mapped-area capture/lift/gain
  5. Boyce and held-out site ranks
  6. secondary ROC AUC/PR AUC
  7. fold-safe maps with training and held-out sites
  8. compute diagnostics
  9. optional support sensitivity
  10. structured, non-promotional interpretation

The notebook runs the primary evaluation automatically when no result exists and loads cached ignored output on later runs. benchmarks/build_section6_evaluation_notebook.py regenerates it.

Validation

  • 148 pytest tests passed
  • Black passed on all CI-tracked Python paths
  • Ruff passed
  • Mypy passed
  • pyproject.toml parsed successfully
  • real riverine preparation passed: 142 focal sites, 142 matched focal backgrounds, 1 explicit site exclusion, and 1,000 availability anchors
  • bounded real-data riverine LR evaluation passed for 10 folds / 2 pooled repeats
  • result schema validation passed
  • all 25 notebook cells parsed and the full notebook report executed successfully against the bounded real-data result

Dependency

This is a stacked draft PR targeting codex/representation-extensions because PR #9 has passed CI but still awaits explicit merge approval. After #9 is merged, retarget this PR to main; its diff will then contain only the evaluation revamp.

Untracked * 2.* sync-copy artifacts were deliberately excluded.

mrecos added 2 commits July 16, 2026 18:25
Make common 7x7 focal support the primary Section 6 design and score one fixed, uniform raster-availability sample in every spatially grouped fold. Convert held-out predictions to fold-specific availability ranks, pool every bag once per repeat, and lead with mapped-area capture, tie-aware lift/gain, Continuous Boyce, and site percentile distributions.

Add the deterministic runner, configuration, result schema, fingerprints, fold-safe availability maps, geometry control, M0-M3 and LR/RF comparisons, support sensitivity modes, progress reporting, and reusable notebook builder. Streamline notebook 05 into one coherent report while retaining ROC AUC and PR AUC as secondary diagnostics.

Reuse raster handles for batched windows and derive nested focal supports from the largest read to reduce preparation time. Add notebook dependencies, CI formatting/lint coverage, methodological documentation, and tests for availability metrics, tied thresholds, window batching, fold coverage, schemas, and runner behavior.

Validation: 148 pytest tests passed; Black, Ruff, Mypy, pyproject parsing, real riverine preparation, a bounded real-data LR fold run, schema validation, and an executed notebook smoke test passed.
Reframe presence-background evaluation around mapped-area capture, lift, and capture surplus while retaining Kvamme Gain and classification metrics as secondary evidence.

Add full-window and exact valid-cell-count controls, raster-mask boundary diagnostics, and exploratory Moran/LISA analysis of held-out site shortfall and model disagreement. Regenerate the reporting notebook, update the result contract and documentation, and add deterministic tests for the new metrics and controls.

Record the completed Section 6 findings, unresolved upland boundary question, output-scaling concern, and restart priorities in a dated branch handoff.
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