Download scripts/result.py from OneScience-Group/GRACE-SEDA: direct link, hf CLI and curl.
- Browser
- Download file 737 Bytes
-
https://huggingface.co/OneScience-Group/GRACE-SEDA/resolve/main/scripts/result.py
- Command line
-
hf download hf://OneScience-Group/GRACE-SEDA/scripts/result.py
-
curl -L -o result.py https://huggingface.co/OneScience-Group/GRACE-SEDA/resolve/main/scripts/result.py
737 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.grace_seda import cfg,write | |
| c=cfg(R);d=np.load(R/c['paths']['predictions']);p=d['mean'];g=d['grace'];w=d['wghm'];corr=float(np.corrcoef(p.ravel(),w.ravel())[0,1]);aggregate=float(abs(p.mean((1,2))-g.mean((1,2))).mean());unc=float(d['uncertainty'].mean());write(R/c['paths']['evaluation'],{'wghm_correlation':corr,'grace_aggregate_error':aggregate,'mean_uncertainty':unc,'synthetic':True});plt.imshow(p[0]-w[0],cmap='coolwarm');plt.colorbar();q=R/c['paths']['figure'];q.parent.mkdir(parents=True,exist_ok=True);plt.savefig(q,dpi=150);print(q) | |