Spaces:
Sleeping
Sleeping
Download build/lib/src/evaluation.py from ServandoTorres/Relu: direct link, hf CLI and curl.
- Browser
- Download file 518 Bytes
-
https://huggingface.co/spaces/ServandoTorres/Relu/resolve/main/build/lib/src/evaluation.py
- Command line
-
hf download hf://spaces/ServandoTorres/Relu/build/lib/src/evaluation.py
-
curl -L -o evaluation.py https://huggingface.co/spaces/ServandoTorres/Relu/resolve/main/build/lib/src/evaluation.py
518 Bytes
| import numpy as np | |
| # Define the QueryRMSE metric | |
| def query_rmse(y_true, y_pred, groups): | |
| group_corrections = {} | |
| for group in np.unique(groups): | |
| idx = np.where(groups == group) | |
| y_true_group = y_true[idx] | |
| y_pred_group = y_pred[idx] | |
| correction = np.mean(y_true_group - y_pred_group) | |
| group_corrections[group] = correction | |
| corrected_preds = y_pred + np.array([group_corrections[group] for group in groups]) | |
| return np.sqrt(np.mean((y_true - corrected_preds)**2)) |