关于「去相关策略比较:重采样、异提示、异模型与标准库验算」,《相关误差下的多模型投票》给出的定量结论是什么?

结论:第四章比较去相关策略:同一模型重采样的上限只有 0.7366,五家不同模型的上限是 0.8257,让标准库验算在能覆盖的题上直接拍板,四个模型加验算可达 0.8887。

数据口径:书中参数为示意;全部计算由书中程序生成;本书是非个人化的经营分析,不构成经营建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(19 段程序)、原典与作者的假说。

English version

对照数据表

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

A. majority accuracy by pool and number of votes
pool p rho n1 n=3 n=5 n=9 ceiling
resample0.72 0.60 0.7200 0.7289 0.7316 0.7337 0.7366
prompts0.70 0.35 0.7000 0.7263 0.7362 0.7446 0.7578
models0.68 0.15 0.6800 0.7292 0.7533 0.7773 0.8257
B. four different models plus a standard-library check
four models alone, coin on 2-20.7292
check as one ordinary fifth vote0.7969
check decides where it applies0.8887
C. decider design by check coverage
coverage 0.20.7824
coverage 0.40.8355
coverage 0.60.8887
coverage 0.80.9418
查看完整验算程序
# Chapter 4. p42: comparing ways to decorrelate a multi-model verdict.
# Model: each pool is exchangeable Beta-binomial (p21) with its own
# mean accuracy p and correlation rho. Illustrative pools:
#   resample  one model, one prompt, sampled again   p 0.72 rho 0.60
#   prompts   one model, different prompts           p 0.70 rho 0.35
#   models    different models from other makers     p 0.68 rho 0.15
# A standard-library check (a deterministic recomputation) applies to
# a share cov = 0.60 of questions, is right with prob 0.995 there and
# is independent of the models. Used as one ordinary vote it joins
# four models; used as a decider it settles the questions it covers.
# Even splits are broken by a coin. Exact sums with math.fsum.
import math



def lbeta(a, b):
    return math.lgamma(a) + math.lgamma(b) - math.lgamma(a + b)


def ab(p, rho):
    s = 1 / rho - 1
    return p * s, (1 - p) * s


def bb_major(n, p, rho):
    if rho == 0:
        lp, lq = math.log(p), math.log(1 - p)
        terms = [math.exp(math.lgamma(n + 1) - math.lgamma(k + 1)
                          - math.lgamma(n - k + 1) + k * lp
                          + (n - k) * lq)
                 for k in range(n // 2 + 1, n + 1)]
        return math.fsum(terms)
    a, b = ab(p, rho)
    terms = [math.exp(math.lgamma(n + 1) - math.lgamma(k + 1)
                      - math.lgamma(n - k + 1) + lbeta(k + a, n - k + b)
                      - lbeta(a, b))
             for k in range(n // 2 + 1, n + 1)]
    return math.fsum(terms)


def betacf(a, b, x):
    tiny = 1e-300
    c, d = 1.0, 1.0 - (a + b) * x / (a + 1)
    d = 1.0 / (d if abs(d) > tiny else tiny)
    h = d
    for m in range(1, 400):
        m2 = 2 * m
        for num in (m * (b - m) * x / ((a + m2 - 1) * (a + m2)),
                    -(a + m) * (a + b + m) * x / ((a + m2) * (a + m2 + 1))):
            d = 1.0 + num * d
            d = 1.0 / (d if abs(d) > tiny else tiny)
            c = 1.0 + num / c
            c = c if abs(c) > tiny else tiny
            h *= d * c
        if abs(d * c - 1.0) < 1e-15:
            break
    return h


def betai(a, b, x):
    if x <= 0:
        return 0.0
    if x >= 1:
        return 1.0
    lead = math.exp(a * math.log(x) + b * math.log(1 - x) - lbeta(a, b))
    if x < (a + 1) / (a + b + 2):
        return lead * betacf(a, b, x) / a
    return 1.0 - lead * betacf(b, a, 1 - x) / b


def limit(p, rho):
    if rho == 0:
        return 1.0 if p > 0.5 else 0.0
    a, b = ab(p, rho)
    return 1.0 - betai(a, b, 0.5)


def pmf(n, p, rho):
    if rho == 0:
        return [math.comb(n, k) * p ** k * (1 - p) ** (n - k)
                for k in range(n + 1)]
    a, b = ab(p, rho)
    return [math.exp(math.lgamma(n + 1) - math.lgamma(k + 1)
                     - math.lgamma(n - k + 1) + lbeta(k + a, n - k + b)
                     - lbeta(a, b)) for k in range(n + 1)]


def maj(dist, extra=None):
    # extra: None = no extra voter; 1 / 0 = one more voter, right / wrong
    n = len(dist) - 1
    tot = n if extra is None else n + 1
    terms = []
    for k, w in enumerate(dist):
        right = k if extra is None else k + extra
        if 2 * right > tot:
            terms.append(w)
        elif 2 * right == tot:
            terms.append(w / 2)
    return math.fsum(terms)


def plain(n, p, rho):
    return maj(pmf(n, p, rho), None)


def with_check(p, rho, cov, pc, decider):
    d4 = pmf(4, p, rho)
    alone = maj(d4, None)
    if decider:
        return cov * pc + (1 - cov) * alone
    joined = pc * maj(d4, 1) + (1 - pc) * maj(d4, 0)
    return cov * joined + (1 - cov) * alone


if __name__ == "__main__":
    pools = (("resample", 0.72, 0.6), ("prompts", 0.70, 0.35),
             ("models", 0.68, 0.15))
    print("A. majority accuracy by pool and number of votes")
    print("  pool        p     rho     n=1    n=3    n=5    n=9  ceiling")
    for name, p, rho in pools:
        cells = "  ".join("{:.4f}".format(plain(n, p, rho))
                          for n in (1, 3, 5, 9))
        print("  {:<9} {:.2f}  {:.2f}  {}  {:.4f}".format(
            name, p, rho, cells, limit(p, rho)))
    print("B. four different models plus a standard-library check")
    p, rho = 0.68, 0.15
    print("  four models alone, coin on 2-2      {:.4f}".format(
        plain(4, p, rho)))
    print("  check as one ordinary fifth vote    {:.4f}".format(
        with_check(p, rho, 0.6, 0.995, False)))
    print("  check decides where it applies      {:.4f}".format(
        with_check(p, rho, 0.6, 0.995, True)))
    print("C. decider design by check coverage")
    for cov in (0.2, 0.4, 0.6, 0.8):
        print("  coverage {:.1f}: {:.4f}".format(
            cov, with_check(p, rho, cov, 0.995, True)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《孔多塞陪审团定理与相关误差、多模型投票何时越投越准何时同源共错母典》第 4 章「去相关策略比较:重采样、异提示、异模型与标准库验算」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026309,
  author    = {Fan, Yafu},
  title     = {Condorcet's Jury Theorem with Correlated Errors: When Multi-Model Voting Gets More Accurate and When Shared Origins Make Everyone Wrong Together},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论