-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdollar_table.py
More file actions
75 lines (69 loc) · 2.94 KB
/
Copy pathdollar_table.py
File metadata and controls
75 lines (69 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""Audit fix #9: the fused operating-point dollar table (the money number) + the
honest triage value, and a Malinois-baseline availability check."""
import os, glob
from pathlib import Path
import numpy as np, pandas as pd
HERE = Path(__file__).resolve().parent
df = pd.read_csv(HERE / "data" / "gosai_designed" / "designed_scored.csv")
score = -df["pred_gap"].values
fail = df["measured_fail"].values.astype(int)
n = len(df)
base = fail.mean()
LO, HI = (
250,
1000,
) # $ per design, DIRECT synthesis + individual validation only. This is a NARROWER basis than the
# full-committed-spend model in docs/cisfalcon_triage_economics.csv ($950-$3,500 per pursued design,
# which adds downstream follow-up); both are reported with their basis stated. This script uses the
# direct-cost basis; the shipped economics figure uses the full-committed-spend basis.
print(
f"n={n} base fail={base:.4f} (~{base * 100:.1f} wasted syntheses per 100 designs if uncaught)"
)
print(
"\nTRIAGE dollar table, POOLED basis (scrutinize/redesign the flagged riskiest BEFORE synthesis):"
)
print(
" Every figure below is POOLED across a mixed batch. The project disowns the pooled basis\n"
" as evidence of per-design signal: a sequence-free stratum-prior rule beats it. The\n"
" conditioned money numbers (2.59x macro enrichment, $458-$1,796 net) are in\n"
" economics_table.py, and that conditioned column is the one to quote."
)
order = np.argsort(-score)
ys = fail[order]
tp = np.cumsum(ys)
fp = np.cumsum(1 - ys)
recall = tp / fail.sum()
ppv = tp / (tp + fp)
for topk in [0.02, 0.05, 0.10, 0.20]:
i = int(topk * n) - 1
fails_caught = recall[i] * base * 100
print(
f" flag riskiest {topk * 100:4.0f}% -> PPV {ppv[i]:.2f}, catches {recall[i] * 100:4.1f}% of failures "
f"({fails_caught:.1f}/100); redesign-first avoids ${recall[i] * base * 100 * LO:.0f}-{recall[i] * base * 100 * HI:.0f} per 100 designs"
)
print(
"\nSAFEST-FIRST framing, POOLED basis (limited synthesis budget -> make lowest-risk first):"
)
safe = np.argsort(score)
for frac in [0.5, 0.7, 0.9]:
m = int(frac * n)
fr = fail[safe[:m]].mean()
print(
f" synthesize safest {frac * 100:.0f}%: failure rate {fr * 100:.2f}% (vs {base * 100:.2f}% random) "
f"= {(1 - fr / base) * 100:.0f}% fewer failures in what you make"
)
print(
" Conditioned within (cell x generator), the safest-half reduction is 41% macro, not 70%\n"
" (triage_conditioning_check.py). A sequence-free stratum-prior rule reaches about 90% pooled."
)
print("\n=== Malinois self-prediction availability (killer comparator) ===")
files = [
os.path.basename(c)
for c in glob.glob(
str(HERE / "data" / "gosai_designed" / "**" / "*"), recursive=True
)
if os.path.isfile(c)
]
print("gosai_designed files:", files)
b = pd.read_csv(HERE / "data" / "gosai_designed" / "designed_benchmark.csv", nrows=2)
print("benchmark cols (any Malinois pred?):", list(b.columns))