Datasets:
Download code/practice_run.py from tchaudha/heat-seekers-protostar: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/datasets/tchaudha/heat-seekers-protostar/resolve/main/code/practice_run.py
- Command line
-
hf download hf://datasets/tchaudha/heat-seekers-protostar/code/practice_run.py
-
curl -L -o practice_run.py https://huggingface.co/datasets/tchaudha/heat-seekers-protostar/resolve/main/code/practice_run.py
1.29 kB
| """Organizers' practice run (train to 2010, predict 2011-2018, all 8 years) for reference models.""" | |
| import sys, json | |
| import pandas as pd | |
| sys.path.insert(0, str(__import__('pathlib').Path(__file__).resolve().parent)) | |
| from v2lib import * | |
| P = Panel(); f = forecast_block(P, 2010, configs=[(15, 0.0, 'national')], H=8) | |
| r = score_origin(P, f, 2010, H=8) | |
| mae = r.groupby(['method', 'metric']).error.mean().unstack() | |
| models = {'clim30': dict.fromkeys(METRICS, 'clim30'), 'lin30': dict.fromkeys(METRICS, 'lin30'), | |
| 'v1': {'annual_avg_temp': 'exp10', 'cdd': 'exp10', 'hottest_day_temp': 'clim30', 'total_precip_in': 'clim30'}, | |
| 'v2_strict': {'annual_avg_temp': 'LT_L15_a0_national', 'cdd': 'exp10', 'hottest_day_temp': 'clim30', 'total_precip_in': 'clim30'}, | |
| 'v2b': {'annual_avg_temp': 'LT_L15_a0_national', 'cdd': 'SHmean_L15_a0_national', 'hottest_day_temp': 'clim30', 'total_precip_in': 'clim30'}} | |
| rows = [] | |
| for k, ch in models.items(): | |
| d = {m: mae.loc[ch[m], m] for m in METRICS} | |
| sk = [1 - d[m] / mae.loc['clim30', m] for m in METRICS] | |
| rows.append(dict(model=k, **{f'mae_{m}': d[m] for m in METRICS}, score=100 * max(0, sum(sk) / 4))) | |
| t = pd.DataFrame(rows); t.to_csv(ROOT / 'results/v2_practice_run_2010.csv', index=False); print(t.round(3).to_string()) | |