Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/yang/blob/main/scripts/search_open_collars.py # yang This project has not described itself yet. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `yang / scripts / search_open_collars.py` 29 lines ยท 1167 bytes Raw Blame History 1 """Finite search over backgrounds for the influence of one boundary link.""" 2 from concurrent.futures import ProcessPoolExecutor 3 from statistics import fmean 4 import argparse 5 from probe_open_collar import Box 6 7 8 def run(job): 9 collar, seed = job 10 return collar, seed, Box(4).pair(2.3, seed, 64, 128, False, collar) 11 12 13 def main(): 14 p = argparse.ArgumentParser(description=__doc__) 15 p.add_argument("--workers", type=int, default=1) 16 args = p.parse_args() 17 candidates = ("identity", "sheet", "rough") 18 with ProcessPoolExecutor(max_workers=args.workers) as pool: 19 train = list(pool.map(run, ((c, s) for c in candidates for s in range(70, 74)))) 20 winner = max(candidates, key=lambda c: abs(fmean(v[2] for name, _, v in train if name == c))) 21 hold = list(pool.map(run, ((winner, s) for s in range(80, 88)))) 22 print("stage", "collar", "seed", "P_base", "P_changed", "signed_change", "absolute_change", sep="\t") 23 for phase, rows in (("train", train), ("heldout", hold)): 24 for name, seed, values in rows: 25 print(phase, name, seed, *(f"{x:.12g}" for x in values), sep="\t") 26 27 28 if __name__ == "__main__": 29 main()