关于「加权多数:对数几率权重与相关簇的重复计票」,《相关误差下的多模型投票》给出的定量结论是什么?
结论:独立时,按对数几率加权是最优规则;当某一票的权重超过其余所有票之和,它就应当一票定夺,这为第四章的验算拍板提供了理论依据。相关时,对数几率权重会把同一份证据算两遍,此时应先把同族的票合成一票再加权,合与不合的分界大致在族内相关 0.4 到 0.5 之间。下一章回到预算问题:在上限之下,要多少个模型才能达到目标准确率,又要多少道带标准答案的题,才能把准确率与相关系数量准。
数据口径:书中参数为示意;全部计算由书中程序生成;本书是非个人化的经营分析,不构成经营建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(19 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.4, 0.5
| family of 3 (p 0.75) + two outside models (p 0.70) | |||||
| rho_w | family-maj | simple | naive | cluster | w_family |
| 0.0 | 0.8438 | 0.8747 | 0.8747 | 0.8444 | 1.686 |
| 0.2 | 0.8000 | 0.8465 | 0.8465 | 0.8260 | 1.386 |
| 0.3 | 0.7853 | 0.8333 | 0.8333 | 0.8198 | 1.297 |
| 0.4 | 0.7741 | 0.8206 | 0.8206 | 0.8151 | 1.232 |
| 0.5 | 0.7656 | 0.8083 | 0.8083 | 0.8116 | 1.184 |
| 0.8 | 0.7521 | 0.7728 | 0.7728 | 0.8059 | 1.110 |
| naive weights: family 3 x 1.099 = 3.296, outside 2 x 0.847 |
查看完整验算程序
# Chapter 5. p52: log-odds weights over-count a correlated cluster.
# Model: three models of one family, each right with prob 0.75 and
# pairwise correlated (exchangeable Beta-binomial, rho_w), plus two
# outside models right with prob 0.70, independent of the family and
# of each other. Rules compared: simple majority of five; "naive"
# log-odds weights that treat all five as independent; and "cluster"
# weighting, which first takes the family's own majority, scores it
# with its exact accuracy A, and weights it ln(A / (1 - A)) next to
# the outside models. Exact enumeration, math.fsum. Illustrative.
import itertools
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 lo(p):
return math.log(p / (1 - p))
def rules(pf, rho, po):
fam = pmf(3, pf, rho)
ac = math.fsum(fam[2:])
out = {"simple": [], "naive": [], "cluster": []}
for k, wk in enumerate(fam):
for pat in itertools.product((1, 0), repeat=2):
pr = wk
for r in pat:
pr = pr * (po if r else 1 - po)
right = k + pat.count(1)
if right >= 3:
out["simple"].append(pr)
yes = k * lo(pf) + pat.count(1) * lo(po)
no = (3 - k) * lo(pf) + pat.count(0) * lo(po)
if yes > no:
out["naive"].append(pr)
cv = 1 if k >= 2 else 0
yes = cv * lo(ac) + pat.count(1) * lo(po)
no = (1 - cv) * lo(ac) + pat.count(0) * lo(po)
if abs(yes - no) < 1e-12:
out["cluster"].append(pr / 2)
elif yes > no:
out["cluster"].append(pr)
return ac, {k: math.fsum(v) for k, v in out.items()}
if __name__ == "__main__":
print("family of 3 (p 0.75) + two outside models (p 0.70)")
print(" rho_w family-maj simple naive cluster w_family")
for rho in (0.0, 0.2, 0.3, 0.4, 0.5, 0.8):
ac, r = rules(0.75, rho, 0.70)
print(" {:<5} {:10.4f} {:.4f} {:.4f} {:.4f} {:.3f}".format(
rho, ac, r["simple"], r["naive"], r["cluster"], lo(ac)))
print("naive weights: family 3 x {:.3f} = {:.3f}, outside 2 x {:.3f}"
.format(lo(0.75), 3 * lo(0.75), lo(0.7)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《孔多塞陪审团定理与相关误差、多模型投票何时越投越准何时同源共错母典》第 5 章「加权多数:对数几率权重与相关簇的重复计票」(版本 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}
}