import sys, os, numpy as np, pandas as pd; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) sys.argv=[sys.argv[0], sys.argv[1]] import gip_q as g a=g.load(); P=g.PRIMARY def yoy(L,q="2026Q3"): pooled=L.mean(axis=1,skipna=True); i=list(L.index).index(q); w=pooled.iloc[i-3:i+1] return float(np.exp(w.sum())), int(L.notna().sum(axis=1).iloc[i-3:i+1].min()) allb=sorted(a.benchmark.unique()); extra=[b for b in allb if b not in P] L,C=g.run(a,allb) print("per-benchmark YoY to 2026Q3, matched levels each of last 4 quarters, models, top score:") for b in allb: s=L[b].iloc[-4:]; c=C[(C.bench==b)].tail(4) print(f"{b:26s} yoy={'x%.1f'%np.exp(s.sum()) if s.notna().all() else 'n/a (quarters qualifying: %d)'%s.notna().sum():>28s} matched={list(c.matched)} models={int(c.models.iloc[-1])} top={c.top.iloc[-1]:.2f} first_release={a[a.benchmark==b].rd.min().date()}") print("all 11:", yoy(L)) d8=P+["math_lvl5","simpleqa","swe_bench_verified"]; print("8 distinct (one FrontierMath):", yoy(g.run(a,d8)[0])) print("5 primary + swe:", yoy(g.run(a,P+["swe_bench_verified"])[0])) # partial-quarter sensitivity: truncate the final quarter at day 33 (like data ending Aug 2) vs full print("\npartial-quarter test: YoY ending q, final quarter cut at day 33 vs full") for q in ["2025Q3","2025Q4","2026Q1","2026Q2"]: per=pd.Period(q); cut=per.start_time+pd.Timedelta(days=32) full=a[a.rd<=per.end_time]; part=a[a.rd<=cut] Lf,_=g.run(full,P); Lp,_=g.run(part,P) yf=yoy(Lf,q)[0]; yp=yoy(Lp,q)[0] print(q, f"partial x{yp:.1f} full x{yf:.1f} ratio full/partial {yf/yp:.2f} new models after cut: {full[(full.rd>cut)].model.nunique()}") print("models released in 2026Q3 so far:", a[(a.rd>=pd.Timestamp('2026-07-01'))].model.nunique(), "| in 2026Q2 by day 33:", a[(a.rd>=pd.Timestamp('2026-04-01'))&(a.rd<=pd.Timestamp('2026-05-03'))].model.nunique(), "| full 2026Q2:", a[(a.rd>=pd.Timestamp('2026-04-01'))&(a.rd<=pd.Timestamp('2026-06-30'))].model.nunique())