Download code/work/compare_plans.py from bryan7264/lorapop: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/datasets/bryan7264/lorapop/resolve/main/code/work/compare_plans.py
- Command line
-
hf download hf://datasets/bryan7264/lorapop/code/work/compare_plans.py
-
curl -L -o compare_plans.py https://huggingface.co/datasets/bryan7264/lorapop/resolve/main/code/work/compare_plans.py
1.3 kB
| # MIT License, Bryan Cheng, 2026. D-039: compare a plan built from the plan-5.3-threshold scan with the running plan. | |
| import json, sys | |
| A, B = json.load(open(sys.argv[1])), json.load(open(sys.argv[2])) | |
| ta = {d["id"]: d for d in A["directions"] if d["kind"] == "locus" and d.get("source")} | |
| tb = {d["id"]: d for d in B["directions"] if d["kind"] == "locus" and d.get("source")} | |
| print("tested:", len(ta), len(tb), "shared", len(set(ta) & set(tb))) | |
| print("only old:", sorted(set(ta) - set(tb))[:20]) | |
| print("only new:", sorted(set(tb) - set(ta))[:20]) | |
| print("backgrounds equal:", A["backgrounds"] == B["backgrounds"], "shared", len(set(A["backgrounds"]) & set(B["backgrounds"]))) | |
| print("first 8 equal:", A["backgrounds"][:8] == B["backgrounds"][:8]) | |
| ia, ib = {d["id"] for d in A["directions"]}, {d["id"] for d in B["directions"]} | |
| print("all directions:", len(ia), len(ib), "shared", len(ia & ib)) | |
| ko = sum(1 for k in set(ta) & set(tb) if ta[k].get("knockout_carriers") != tb[k].get("knockout_carriers")) | |
| print("shared tested with different knockouts:", ko) | |
| print("selection old:", {k: A["selection"][k] for k in ("fdr_per_estimator", "n_knockouts", "n_carriers", "n_directions")}) | |
| print("selection new:", {k: B["selection"][k] for k in ("fdr_per_estimator", "n_knockouts", "n_carriers", "n_directions")}) | |