Skip to content

fix: seed regional decoder observation nodes with encoder features - #239

Merged
jacobbieker merged 1 commit into
openclimatefix:mainfrom
AswaniSahoo:fix/regional-decoder-obs-skip
Jul 27, 2026
Merged

jacobbieker merged 1 commit into
openclimatefix:mainfrom
AswaniSahoo:fix/regional-decoder-obs-skip

Conversation

@AswaniSahoo

Copy link
Copy Markdown
Contributor

Pull Request

Description

RegionalForecaster seeds its decoder observation nodes with torch.zeros, discarding the per-observation features the encoder just computed - the same bug that #237 fixed in StretchedForecaster. Each observation's predicted change can only be read back from its assigned cell's pooled, message-passed feature, so the observation's own values reach the output only through the fixed residual. In #237 this collapsed the stretched model to the persistence baseline on a 2-sample overfit (floor 0.173 = persistence, dropping to 0.136 once fixed).

This applies the identical fix here: seed the decoder's observation nodes with the encoder's per-observation features (nodes[:num_obs]) instead of zeros, so the learnable delta can specialise per observation. No new parameters.

Follow-up to #237, which flagged this pattern in RegionalForecaster. Related to #3

How Has This Been Tested?

Added test_decoder_seeded_with_encoder_obs_features to tests/test_regional_forecast.py - a plain pytest that hooks the decoder GNN, runs a forward pass, and asserts the observation nodes it receives are non-zero (they carry the encoder output rather than the old zeros seed). It fails on the previous code.

Commands:

  • pytest tests/test_regional_forecast.py -q -> 14 passed
  • ruff check graph_weather/models/regional_forecast.py tests/test_regional_forecast.py -> clean

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@jacobbieker
jacobbieker merged commit a23d8c5 into openclimatefix:main Jul 27, 2026
0 of 3 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.

2 participants