sleonca's picture
Upload folder using huggingface_hub
b47743b verified
|
Raw History Blame Contribute Delete
4.59 kB

Code

Run everything from the repository root with bash code/run_all.sh (after pip install -r code/requirements.txt).

File Role
00_download.py Downloads the four challenge subsets to data/raw/
01_cdd_shift_table.py Builds data/processed/shift_table.parquet (CDD under daily temperature shifts)
02_backtest.py Rolling-origin backtest on pre-2019 data of our model and the three reference baselines → results/backtest.csv
03_forecast.py Base model alone, fitted on data ≤ 2018 → results/submission_current_model.csv (was submission.csv until 2026-11-08)
04_forecast_submission.py Writes submission.csv: ARIMA ensemble B (0.75 × base + 0.25 × pooled-trend ARIMA for temperature; base model for the rest); checks the SHA-256 against results/forecasts_frozen/MANIFEST.csv
common.py Loading, the 10-day validity rule, the 30-year baseline, the challenge score, and the post-2018 data guard
models.py Forecasters: level_trend, regional_anom, cdd_shift
final_model.py The base model (one configuration per metric), used by the submission
backtest.py Backtest harness (run)
experiments/ Parameter searches used to choose final_model.py (pre-2019 folds only; run with python code/experiments/search1.py)
check_submission.py Template checker: the same checks the Space runs
AGENTS.md Instructions file the AI agent followed (data rule)

ARIMA experiments (optional; not used for submission.csv)

Run all of them with bash code/run_arima.sh (about 10 minutes on a 10-core laptop; needs statsmodels and pmdarima from requirements.txt). Report: results/arima_report.md. All of them read only data/raw/ (≤ 2018).

File Role
arima_prep.py Regular annual series for ARIMA: training window, linear interpolation of interior gaps, "weak" flag (> 20 % imputed) → results/arima_imputation.csv
arima_eda.py EDA of 6 cities × 4 metrics (lines, decade box plots, ACF, trend/residual) → results/arima_eda/
arima_stationarity.py ADF / KPSS (c and ct) on all 840 series, first difference, ndiffs → results/arima_stationarity*.csv
arima_identify.py ACF/PACF of detrended and differenced series, suggested (p, q) → results/arima_acf_pacf.csv, results/arima_eda/acf_pacf_*.png
models_arima.py ARIMA forecasters with the repository signature: fixed orders, auto-ARIMA, d=0 + trend, pooled-trend ARIMA, ARIMA → CDD hybrid
arima_diagnostics.py Ljung-Box and AICc of every candidate on 1969–2018 → results/arima_diagnostics*
arima_backtest.py Backtest of 22 ARIMA variants + 4 reference models through backtest.run() → results/arima_backtest/, results/arima_orders.csv
arima_sarima_monthly.py Optional monthly SARIMA (m = 12) on 20 cities → results/arima_sarima/
arima_select.py Pre-set selection rule: best ARIMA per metric and ARIMA + current-model ensembles → results/arima_select/
arima_forecast.py Origin-2018 forecast of the chosen configuration → results/submission_arima.csv (never writes submission.csv)
run_arima.sh Runs the steps above in order
arima_freeze.py Freezes 15 candidate forecasts (origin 2018) with SHA-256 → results/forecasts_frozen/ (for the post-hoc comparison in analysis_posthoc/, which no file in code/ reads)

New candidates and per-metric selection (PROMPT_SIGUIENTE; not used for submission.csv until the team applies it)

File Role
models_extra.py ETS (Holt, damped, SES + pooled trend), hierarchical MixedLM (city slopes shrunk to 9 k-means regions; CDD via the shrunk temperature slope and shifted daily weather), Tmax/Tmin forecast separately
extra_backtest.py Backtest of the new models through backtest.run(), per-metric weighted ensemble (0.1 grid) and the 1990–2006 → 2011 check → results/extra_backtest/
candidates_2018.py Origin-2018 forecast of any candidate (shared by the two scripts below)
extra_freeze.py Freezes the new candidates in results/forecasts_frozen/ and appends their SHA-256 to MANIFEST.csv
03b_forecast_per_metric.py Reproduces the per-metric proposal from scratch → results/submission_per_metric.csv (--check: identical to results/forecasts_frozen/per_metric.csv). Never writes submission.csv

The selection itself (which reads the 2019–2021 scores) lives in analysis_posthoc/, because no file in code/ reads that folder.