protostar-climate / code /README.md
AlecAlameddine's picture
Upload 105 files
d79a78d verified
|
Raw History Blame Contribute Delete
2.93 kB

Code

Everything that produces submission.csv, as plain scripts (no notebook, no agent needed). From the repository root: make all, or step by step with PYTHONPATH=code:

Step Command Writes
verify / fetch pinned data python code/fetch_data.py data/raw/ (sha256-checked)
data audit python -m protostar.audit reports/audit/
backtests + model selection python -m protostar.backtest reports/backtest/ (incl. selected.json)
tried and not shipped python -m protostar.experiments reports/experiments/
refit ≤ 2018 + forecast python -m protostar.forecast submission.csv, reports/forecast/
file check (template) python code/check_submission.py —
tests python -m protostar.tests —
README tables python -m protostar.docs number tables in README.md
NOAA cross-check python -m protostar.ghcnd --offline reports/ghcnd/ (from data/external/ghcnd/; without --offline missing stations are downloaded, capped at 2018-12-31)

Modules in protostar/:

  • common.py: constants: pinned dataset revision and sha256, metric definitions, the organizers' rules (10 missing days, 10 valid years, 30-year window), the backtest folds, the seed.
  • data.py: loaders with the leak guard (assert_no_leak: nothing dated after 2018), the valid-year rule (long_table), city × year panels.
  • scoring.py: the challenge's Score, as in the Space's scoring.py.
  • models.py: the baselines and the candidate models, each a pure function of training panels that end at the origin; a model is a small dict, so backtest and final refit run the same code.
  • backtest.py: folds, bootstrap, the selection ladder and its acceptance rule, report tables.
  • forecast.py: refit on ≤ 2018, submission.csv, the Space's file checks, plausibility flags.
  • audit.py: coverage, units, outliers, recomputation from daily data, station changes.
  • experiments.py: headroom estimate, station-shift correction, coefficient shrinkage: what was tried and not shipped, judged by the backtest's rule.
  • ghcnd.py: cross-check and gap-fill experiment against NOAA GHCN-Daily (downloads capped at 2018-12-31), and a check of the fallback for city–metrics without a baseline.
  • docs.py: regenerates the number tables in the README from reports/.
  • tests.py: leak guard, no peeking (raw data after each origin corrupted), neighbors from coordinates only, the selection reproduces, scoring equals the Space's, published practice-run numbers reproduced, model invariants, submission.csv equals the code's output, the fallback serves unscored rows only, the NOAA extract respects the date cap.

Other files: requirements.txt (exact versions), check_submission.py (from the template; reads the pinned local city list first), AGENTS.md (instructions for AI agents, including the data rule), LICENSE (MIT).