Spaces:
Sleeping
Sleeping
Download app/evaluation/explainability_eval.py from TheJackBright/polyguard-openenv: direct link, hf CLI and curl.
- Browser
- Download file 543 Bytes
-
https://huggingface.co/spaces/TheJackBright/polyguard-openenv/resolve/main/app/evaluation/explainability_eval.py
- Command line
-
hf download hf://spaces/TheJackBright/polyguard-openenv/app/evaluation/explainability_eval.py
-
curl -L -o explainability_eval.py https://huggingface.co/spaces/TheJackBright/polyguard-openenv/resolve/main/app/evaluation/explainability_eval.py
543 Bytes
| """Explanation grounding evaluation.""" | |
| from __future__ import annotations | |
| from app.evaluation.simulator_rollouts import run_rollouts | |
| def explainability_eval() -> dict[str, float]: | |
| rows = run_rollouts(episodes=8, difficulty="medium") | |
| if not rows: | |
| return {"grounding_rate": 0.0} | |
| grounding_scores = [ | |
| float((row.get("reward_breakdown", {}) or {}).get("explanation_grounding_score", 0.0)) | |
| for row in rows | |
| ] | |
| return {"grounding_rate": round(sum(grounding_scores) / max(1, len(grounding_scores)), 6)} | |