关于「月度重算闭环、蒸馏小工具与证伪方案」,《三级灯号切分点》给出的定量结论是什么?

结论:第八章给出月度重算流程与换版本当周立即重算的事件规则、蒸馏小工具「三级灯号切分点计算器」、每组需 1177 段对话的预先登记检验,以及推翻本书三根支柱的条件。书中以标注框区分已发表的证据、可运行的 Python 计算(18 段程序)、原典与作者的假说。

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

English version

对照数据表

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

arm X: mean 2.391 yuan per chat, sd 8.148
arm Y: mean 3.451 yuan per chat, sd 10.107
effectdelta/chatn per arm
1.001.0601,177
0.500.5304,707
0.250.26518,826
check at n = 1,177 per arm: simulated power 0.795
查看完整验算程序
# Chapter 8. p82: how many chats a pre-registered A/B needs.
# Model (illustrative): arm X uses the three-light cuts of p21 (green
# from 0.95, red below 0.40); arm Y the accuracy-tuned single cut of
# p11 (answer when p >= 0.817, else a human). Per-chat cost is random:
# green costs 50 if wrong; amber costs 2, plus 50 if wrong and the
# reviewer misses it (rate 0.2); red costs 8. Means and variances are
# exact on the p11 bot. n per arm = 2 (z_a + z_b)^2 var / delta^2 with
# the pooled variance, two-sided alpha 0.05, power 0.8. A check runs
# 400 simulated trials (seed 20261113) of a two-sample z test.
import bisect
import math
import random
from statistics import NormalDist

LW, CA, M, CR, A2 = 50.0, 2.0, 0.8, 8.0, 0.817
ZA, ZB = NormalDist().inv_cdf(0.975), NormalDist().inv_cdf(0.8)


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


def outcomes(arm, p):
    # list of (cost, probability) for one chat with P(right) = p
    if arm == "X":
        if p >= 0.95:
            return [(LW, 1 - p), (0.0, p)]
        if p >= 0.40:
            miss = (1 - p) * (1 - M)
            return [(CA + LW, miss), (CA, 1 - miss)]
        return [(CR, 1.0)]
    return [(LW, 1 - p), (0.0, p)] if p >= A2 else [(CR, 1.0)]


PW = nodes()
stats = {}
for arm in ("X", "Y"):
    m1 = math.fsum(w * q * c for p, w in PW for c, q in outcomes(arm, p))
    m2 = math.fsum(w * q * c * c for p, w in PW
                   for c, q in outcomes(arm, p))
    stats[arm] = (m1, m2 - m1 * m1)
    print("arm %s: mean %.3f yuan per chat, sd %.3f"
          % (arm, m1, math.sqrt(m2 - m1 * m1)))
var = (stats["X"][1] + stats["Y"][1]) / 2
full = stats["Y"][0] - stats["X"][0]
print(" effect  delta/chat  n per arm")
for frac in (1.0, 0.5, 0.25):
    d = full * frac
    n = math.ceil(2 * (ZA + ZB) ** 2 * var / (d * d))
    print("%6.2f  %10.3f  %9s" % (frac, d, format(n, ",")))
n = math.ceil(2 * (ZA + ZB) ** 2 * var / (full * full))
rng, rej = random.Random(20261113), 0
ws = [w for _, w in PW]
cdf = [math.fsum(ws[:k + 1]) for k in range(len(ws))]


def one_chat(arm):
    p = PW[min(len(PW) - 1, bisect.bisect_left(cdf, rng.random()))][0]
    out = outcomes(arm, p)
    return out[0][0] if rng.random() < out[0][1] else out[-1][0]


for _ in range(400):
    xs = [one_chat("X") for _ in range(n)]
    ys = [one_chat("Y") for _ in range(n)]
    mx, my = math.fsum(xs) / n, math.fsum(ys) / n
    vx = math.fsum((x - mx) ** 2 for x in xs) / (n - 1)
    vy = math.fsum((y - my) ** 2 for y in ys) / (n - 1)
    rej += abs(my - mx) / math.sqrt((vx + vy) / n) > ZA
print("check at n = %s per arm: simulated power %.3f"
      % (format(n, ","), rej / 400))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《私域客服人机交接三级灯号精算、误判损失矩阵与最优置信度切分点母典》第 8 章「月度重算闭环、蒸馏小工具与证伪方案」(版本 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}
}

本书其他章节结论