Download scripts/make_salience_tables.py from EDAnonSubmission/benchmark2: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/datasets/EDAnonSubmission/benchmark2/resolve/main/scripts/make_salience_tables.py
- Command line
-
hf download hf://datasets/EDAnonSubmission/benchmark2/scripts/make_salience_tables.py
-
curl -L -o make_salience_tables.py https://huggingface.co/datasets/EDAnonSubmission/benchmark2/resolve/main/scripts/make_salience_tables.py
1.22 kB
| #!/usr/bin/env python | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| from benchpress_eval.data import load_dataset | |
| from benchpress_eval.io import read_table, write_csv | |
| from benchpress_eval.metrics import align_predictions | |
| from benchpress_eval.salience import compute_noedit_salience | |
| def main() -> None: | |
| parser = argparse.ArgumentParser( | |
| description="Compute no-edit AUROC stratified by ground-truth edit parameters." | |
| ) | |
| parser.add_argument("--dataset-root", required=True) | |
| parser.add_argument("--predictions", required=True) | |
| parser.add_argument("--out-dir", required=True) | |
| parser.add_argument("--score-col", default=None) | |
| parser.add_argument("--bins", type=int, default=5) | |
| args = parser.parse_args() | |
| out_dir = Path(args.out_dir) | |
| dataset = load_dataset(args.dataset_root) | |
| predictions = read_table(args.predictions) | |
| aligned = align_predictions(dataset, predictions, score_col=args.score_col) | |
| by_bin, summary = compute_noedit_salience(dataset, aligned, n_bins=args.bins) | |
| write_csv(by_bin, out_dir / "salience_by_parameter_bin.csv") | |
| write_csv(summary, out_dir / "salience_summary.csv") | |
| if __name__ == "__main__": | |
| main() | |