| |
| """Load the dataset, check it, and look at what the agents actually see.""" |
|
|
| from pathlib import Path |
|
|
| import numpy as np |
|
|
| from cryoem_au_data import ( |
| HOLE_FEATURE_NAMES, compute_utility, hole_features, load_index, session_of, validate, |
| ) |
|
|
| INDEX = Path("index/combined") |
|
|
| |
| validate(INDEX) |
|
|
| |
| t = load_index(INDEX) |
| targets, labels = t["target_locations"], t["labels_v4_outcomes"] |
| print(f"\n{len(targets):,} candidate holes, {len(labels):,} acquisitions") |
| print("sessions:", sorted({session_of(u) for u in targets.hole_uid})) |
|
|
| |
| feats = hole_features(targets, t["square_geometry"]) |
| print(f"\nfeatures for {len(feats):,} holes:") |
| print(feats[list(HOLE_FEATURE_NAMES)].describe().T[["mean", "std", "min", "max"]].round(3)) |
|
|
| |
| ok = labels[labels.status == "ok"] |
| print(f"\nutility over {len(ok):,} usable acquisitions: " |
| f"mean {ok.utility.mean():.1f}, sd {ok.utility.std():.1f}") |
| print("recompute matches shipped:", |
| np.allclose(compute_utility(labels), labels.utility.to_numpy(float))) |
|
|
| |
| |
| per_hole = ok.groupby("hole_uid").utility |
| between = per_hole.mean().std() |
| within = np.sqrt(per_hole.var().dropna().mean()) |
| print(f"\nbetween-hole sd {between:.1f} vs within-hole sd {within:.1f} " |
| f"(ratio {between/within:.2f}) — below ~1 means holes are barely " |
| "distinguishable from shot noise") |
|
|