评测:人工金标扩到 330 道(16 张卷),打印 Wilson 置信区间

- gold.json 从 4 张卷/83 道扩到 16 张卷/330 道(一年级 9、二年级 4、三年级 2、五年级 1)
- gold_expr.py 增加 _wilson(),输出误判率与认对率的 95% 区间
- 结果:认对 306/330(92.7%),算错 0(95% CI 0-1.24%),漏检 24(竖式区块与极短算式)
- report.py 修正口算卡口径(已能逐道自算)与金标结论
- 报告与 README 同步更新
This commit is contained in:
2026-11-19 21:13:53 +08:00
parent df196fd8d9
commit 3387ee73bc
24 changed files with 1524 additions and 163 deletions
+46 -8
View File
@@ -77,6 +77,21 @@ def _answers(blocks: list[dict]) -> list[tuple[str, str]]:
return pairs
def _wilson(k: int, n: int, z: float = 1.96) -> tuple[float, float]:
"""比例的 Wilson 95% 置信区间(小样本比正态近似靠谱,0 也能量)。
金标只有几百道时,直接说「误判率 0%」会被问「你凭什么」;
给出区间,读的人才知道这批数据能把真值压到多窄。
"""
if n <= 0:
return (0.0, 1.0)
p = k / n
denom = 1 + z * z / n
centre = (p + z * z / (2 * n)) / denom
half = z * ((p * (1 - p) / n + z * z / (4 * n * n)) ** 0.5) / denom
return (max(0.0, centre - half), min(1.0, centre + half))
def main() -> int:
ap = argparse.ArgumentParser()
ap.add_argument("--gold", default=str(GOLD))
@@ -136,13 +151,19 @@ def main() -> int:
miss_list.append((iid, e["t"]))
judged = hit + wrong
print(f"金标算式:{total} 道,覆盖 {len(gold)} 张图")
n_img = sum(1 for k in gold if not k.startswith("_"))
print(f"金标算式:{total} 道,覆盖 {n_img} 张图")
print(f" 认出来并算对:{hit}({hit / total * 100:.1f}%)" if total else " 无")
print(f" 认出来但算错:{wrong}({wrong / total * 100:.1f}%) ← 这就是「误判」")
print(f" 没认出来 / 没算:{miss}({miss / total * 100:.1f}%)")
if judged:
lo, hi = _wilson(wrong, judged)
print(f" 在认出来的里面,算对的比例:{hit / judged * 100:.1f}%")
print(f" 误判率(认出来但算错 / 认出来):{wrong / judged * 100:.2f}%")
print(f" 误判率(认出来但算错 / 认出来):{wrong / judged * 100:.2f}%"
f" (95% CI {lo * 100:.2f}%–{hi * 100:.2f}%)")
if total:
lo2, hi2 = _wilson(hit, total)
print(f" 认对率 95% CI:{lo2 * 100:.1f}%–{hi2 * 100:.1f}%(n={total})")
if wrong_list:
print("\n算错的(逐条看):")
for iid, t, d in wrong_list[:20]:
@@ -153,17 +174,34 @@ def main() -> int:
print(f" - {iid} {t}")
if args.append:
judged = hit + wrong
n_img = sum(1 for k in gold if not k.startswith("_"))
by_grade: dict[str, int] = {}
for k, v in gold.items():
if k.startswith("_") or not isinstance(v, dict):
continue
by_grade[v.get("grade") or "?"] = by_grade.get(v.get("grade") or "?", 0) + 1
cover = "、".join(f"{g} {c} 张" for g, c in sorted(by_grade.items()))
wlo, whi = _wilson(wrong, judged)
hlo, hhi = _wilson(hit, total)
lines = [
"",
"## 五、人工金标(算式级)",
"",
f"- 人工逐题标注 **{len(gold) - sum(1 for k in gold if k.startswith('_'))} 张卷、{total} 道算式**"
"(`bench/gold.json`,答案由人算,不看机器输出)",
f"- 认出来并算对:**{hit}/{total}({hit / total * 100:.1f}%)**",
f"- 人工逐题标注 **{n_img} 张卷、{total} 道算式**"
"(`bench/gold.json`,答案由人算、不看机器输出;算式级对照,不依赖块序号)",
f"- 认出来并算对:**{hit}/{total}({hit / total * 100:.1f}%)**,"
f"95% CI {hlo * 100:.1f}%–{hhi * 100:.1f}%",
f"- 认出来但算错:**{wrong}/{total}({wrong / total * 100:.1f}%)**"
+ (f",在认出来的里面是 {wrong / judged * 100:.2f}%" if judged else ""),
f"- 没认出来:{miss}/{total}({miss / total * 100:.1f}%)"
"——主要是 0+0 这种极短算式被 OCR 读错(读成 6+0)",
f" —— 误判率 95% CI **{wlo * 100:.2f}%–{whi * 100:.2f}%**(Wilson)",
f"- 没认出来:{miss}/{total}({miss / total * 100:.1f}%),"
"集中在两类:① 极短算式被 OCR 读错或整块被吞(`0+0`、`2+4`、`5×2`);"
"② 竖式/脱式区块(题干带「用竖式计算」这类指令文字,或整块没被切成 calc)",
f"- 覆盖:{cover}(年级越高的卷子口算题越少,四、六年级这批样本里几乎没有,未覆盖)",
"",
f"**为什么 {total} 道够**:误判率点估计 {wrong / judged * 100 if judged else 0:.2f}%,"
f"n={judged} 时 Wilson 95% 上界 {whi * 100:.2f}%。"
"要压到 1% 以内约需 400 道,0.5% 以内约需 800 道。"
"注意这些算式来自少数几张卷,同卷内的题不独立(难度相近),真实区间比 Wilson 略宽。",
"",
"注:这里的「算错」指答案数值不对(0.6 与 3/5 视为相同),不含题干描述差异。",
"",