关于「标注预算、停止规则与审计样本量」,《主动学习与客服意图标注》给出的定量结论是什么?
结论:如果目的是证明「准确率不低于 0.850」,而真实值是 0.880,单侧检验在显著性 0.05、功效 0.80 下需要 824 条。如果用 Wilson 下界的写法:观测到 0.880 时,下界不低于 0.850 需要 550 条,不低于 0.860 需要 1,160 条,不低于 0.870 需要 4,350 条。程序最后一行对应上一节的 S2:400 条审计在观测到 0.880 时下界只有 0.844,低于 0.850,所以规则不触发。
数据口径:书中意图先验、词概率与成本均为示意参数;全部计算由书中程序生成;本书属于非个人化经营建议。 第一章在合成的四意图客服数据上重算:达到目标准确率,随机抽样的中位数是 1,600 条,最小间隔采样是 640 条,后者只用前者的 0.400;全部标注训练的模型准确率为 0.893,这一倍数随目标逼近天花板而变化。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.05, 0.844, 0.850, 0.860, 0.870, 0.880
| half-width h audit n (p | 0.880, 95 %) |
| 0.05 | 163 |
| 0.03 | 451 |
| 0.02 | 1015 |
| 0.01 | 4057 |
| one-sided test of 0.850 vs true 0.880: n | 824 |
| Wilson low bound > | 0.850 at observed 0.880: n = 550 |
| Wilson low bound > | 0.860 at observed 0.880: n = 1,160 |
| Wilson low bound > | 0.870 at observed 0.880: n = 4,350 |
| audit of 400 at observed 0.880: low bound 0.844 |
查看完整验算程序
# Chapter 6. p63: how many random audit labels a claim of accuracy needs.
# 一:估计准确率 p 的 95 % 区间半宽 h:n = z^2 p (1 - p) / h^2。
# 二:单侧检验「准确率不低于 0.850」,真值 0.880,alpha 0.05、功效 0.80。
# 三:Wilson 下界不低于 0.850 所需 n(点估计恰为 0.880 时),逐个搜索。
# 审计样本必须从客流中随机抽取,不能取主动学习挑出的消息。
import math
from statistics import NormalDist
Z = NormalDist()
z975, z95, z80 = Z.inv_cdf(0.975), Z.inv_cdf(0.95), Z.inv_cdf(0.80)
p = 0.880
print("half-width h audit n (p = 0.880, 95 %)")
for h in (0.05, 0.03, 0.02, 0.01):
print(" {:.2f} {:5d}".format(
h, math.ceil(z975 ** 2 * p * (1 - p) / h ** 2)))
p0, p1 = 0.850, 0.880
n = ((z95 * math.sqrt(p0 * (1 - p0)) + z80 * math.sqrt(p1 * (1 - p1)))
/ (p1 - p0)) ** 2
print("one-sided test of 0.850 vs true 0.880: n = {}".format(math.ceil(n)))
def wilson_low(ph, n, z=z975):
c = ph + z * z / (2 * n)
r = z * math.sqrt(ph * (1 - ph) / n + z * z / (4 * n * n))
return (c - r) / (1 + z * z / n)
for floor in (0.850, 0.860, 0.870):
m = 10
while wilson_low(p, m) < floor:
m += 10
print("Wilson low bound >= {:.3f} at observed 0.880: n = {:,}".format(
floor, m))
print("audit of 400 at observed 0.880: low bound {:.3f}".format(
wilson_low(p, 400)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《主动学习与不确定性采样、最少人工标注让客服意图分类器达标母典》第 6 章「标注预算、停止规则与审计样本量」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-312 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026312,
author = {Fan, Yafu},
title = {Active Learning and Uncertainty Sampling: the Fewest Human Labels a Customer-Intent Classifier Needs to Reach Its Target},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}