关于「大促与漂移:先验迁移的贝叶斯修正与切分点的抽样误差」,《三级灯号切分点》给出的定量结论是什么?

结论:第五章讨论大促带来的先验迁移:真实答对比例降到 0.600 时,机器人自报的平均答对概率仍有 0.843。

数据口径:本书用纯标准库程序把命题写成可计算的模型,并修正蓝图三处:带拒识通道的最优识别早见于 Chow 1957 年的论文,1970 年的论文给出误差与拒判的一般关系;规则只对校准过的概率成立,把成本比算出的切分点直接套在过度自信机器人的自报分数上,每百段对话损失 265.4 元,等渗回归校准后 239.8 元;私域客服有「机器人起草、真人过目」的第三种动作,需要六格损失矩阵与两条切分点,示意参数下答对概率低于 0.4000 亮红灯、不低于 0.9500 亮绿灯。 书中参数为示意,对话全部虚构;全部计算由书中程序生成;程序不读写任何文件,不连接任何客服系统;本书是非个人化经营建议,任何线上灯号的改动须由主事者人工复核放行。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.600, 0.843

calibration-month base rate pi = 0.897
pi_newEM estmean stale pstaleadjustedoraclegreen
0.8970.9050.899238.3238.6238.30.537
0.8500.8430.886308.6303.2303.20.362
0.8000.8150.879372.8352.0351.80.328
0.7000.6920.854525.2459.2459.20.166
0.6000.6320.843663.0533.6533.00.122
查看完整验算程序
# Chapter 5. p51: a promotion changes the base rate, not the scores.
# Model (illustrative): in the calibration month the bot is right with
# p = 1 / (1 + e^-z), z ~ N(3.0, 1.6), base rate pi = 0.897. In a new
# month the share of chats it can handle drops to pi_new while the
# score distribution within "right" and within "wrong" chats stays the
# same (label shift). The posterior then moves by Bayes' rule:
#   p' = r p / (r p + s (1 - p)), r = pi_new / pi, s = (1 - pi_new) /
# (1 - pi). Saerens et al. (2002) estimate pi_new by EM from unlabelled
# scores alone. 3000 unlabelled chats per month (seed 20261113); loss
# matrix of p21; yuan per 100 chats under the true new posterior.
import math
import random

rng = random.Random(20261113)
LW, CA, M, CR = 50.0, 2.0, 0.8, 8.0
P_HI = 1 - CA / (M * LW)
P_LO = 1 - (CR - CA) / ((1 - M) * LW)


def sig(z):
    return 1 / (1 + math.exp(-z))


def base_rate(n=4001):
    zs = [3.0 + 1.6 * (-8.0 + 16.0 * i / (n - 1)) for i in range(n)]
    ws = [math.exp(-0.5 * ((z - 3.0) / 1.6) ** 2) for z in zs]
    return math.fsum(w * sig(z) for z, w in zip(zs, ws)) / math.fsum(ws)


PI = base_rate()


def draw_class(y):
    while True:
        z = rng.gauss(3.0, 1.6)
        q = sig(z)
        if rng.random() < (q if y == 1 else 1 - q):
            return q


def shift(p, pi_new):
    r, s = pi_new / PI, (1 - pi_new) / (1 - PI)
    return r * p / (r * p + s * (1 - p))


def em(ps):
    est = PI
    for _ in range(200):
        est = math.fsum(shift(p, est) for p in ps) / len(ps)
    return est


def risk(q, p):
    if q >= P_HI:
        return (1 - p) * LW
    if q >= P_LO:
        return CA + (1 - p) * (1 - M) * LW
    return CR


print("calibration-month base rate pi = %.3f" % PI)
print("pi_new  EM est  mean stale p  stale  adjusted  oracle  green")
for pi_new in (0.897, 0.85, 0.8, 0.7, 0.6):
    ps = [draw_class(1 if rng.random() < pi_new else 0)
          for _ in range(3000)]
    est = em(ps)
    true_post = [shift(p, pi_new) for p in ps]
    cost = []
    for f in (lambda p: p, lambda p: shift(p, est),
              lambda p: shift(p, pi_new)):
        cost.append(100 * math.fsum(risk(f(p), t)
                                    for p, t in zip(ps, true_post))
                    / len(ps))
    green = len([1 for p in ps if shift(p, est) >= P_HI]) / len(ps)
    print("%6.3f  %6.3f  %12.3f  %5.1f  %8.1f  %6.1f  %5.3f"
          % (pi_new, est, math.fsum(ps) / len(ps), cost[0], cost[1],
             cost[2], green))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《私域客服人机交接三级灯号精算、误判损失矩阵与最优置信度切分点母典》第 5 章「大促与漂移:先验迁移的贝叶斯修正与切分点的抽样误差」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-266 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026266,
  author    = {Fan, Yafu},
  title     = {Three Lights for Handing Over between Bot and Human in Private Customer Service: Misclassification Loss Matrices, Chow's Reject Rule and Optimal Cut Points on Calibrated Confidence},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论