if vals:
sv = sorted(vals)
print(f" {name:22s} n={len(sv):3d} median {sv[len(sv) // 2]:+7.2f} "
f"min {sv[0]:+7.2f} max {sv[-1]:+7.2f} violated {sum(1 for x in sv if x <= 0)}")
# A run of consecutive near-ties is a different finding from scattered ones: isolated lows are a
# hard tail, a contiguous block is a family of pairs the objective is not separating.
for epoch in sorted(per):
wins = sorted(w for w, v in by.items() if epoch in v)
best = run = 0
best_at = run_at = None
for w in wins:
if by[w][epoch] < 5.0:
if run == 0:
run_at = w
run += 1
if run > best:
best, best_at = run, run_at
else:
run = 0
if best >= 3:
print(f" longest run of margin<5: {best} consecutive "
f"(w{best_at}-w{best_at + best - 1})")
both = [(w, v[1], v[2]) for w, v in sorted(by.items()) if 1 in v and 2 in v]
if not both:
print(" no window seen in both epochs yet")
return