Download scripts/result.py from OneScience-Group/AI-GAMFS: direct link, hf CLI and curl.
- Browser
- Download file 728 Bytes
-
https://huggingface.co/OneScience-Group/AI-GAMFS/resolve/main/scripts/result.py
- Command line
-
hf download hf://OneScience-Group/AI-GAMFS/scripts/result.py
-
curl -L -o result.py https://huggingface.co/OneScience-Group/AI-GAMFS/resolve/main/scripts/result.py
728 Bytes
| from pathlib import Path | |
| import sys,numpy as np;import matplotlib;matplotlib.use('Agg');import matplotlib.pyplot as plt | |
| R=Path(__file__).resolve().parents[1];sys.path.insert(0,str(R));from model.ai_gamfs import cfg,write | |
| c=cfg(R);d=np.load(R/c['paths']['predictions']);p=d['prediction'];t=d['target'];rmse=np.sqrt(np.mean((p-t)**2,axis=(1,2,3)));corr=[float(np.corrcoef(p[i,0].ravel(),t[i,0].ravel())[0,1]) for i in range(40)];write(R/c['paths']['evaluation'],{'aod_rmse':rmse.tolist(),'aod_correlation':corr,'is_complete_global':False,'synthetic':True});plt.plot(d['lead_hours'],rmse);plt.xlabel('Lead (h)');plt.ylabel('RMSE');q=R/c['paths']['figure'];q.parent.mkdir(parents=True,exist_ok=True);plt.savefig(q,dpi=150);print(q) | |