关于「校准集要多大:给定校准集时覆盖率服从贝塔分布」,《共形预测与订单区间》给出的定量结论是什么?
结论:第四章说明给定校准集时覆盖率服从贝塔分布,二十个校准值时真实覆盖率低于 0.90 的概率为 0.1216。
数据口径:书中参数为示意;全部计算由书中程序生成;本书属于非个人化经营建议。 本书作蓝图修正:正态区间的缺口是本书程序的模拟结果,集中在右尾与单侧上界;东方原典句出自《元史·郭守敬传》。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.1216, 0.90
| alpha = 0.05; coverage | calibration ~ Beta(k, m + 1 - k) | ||||||
| m | k | mean | 5% pt | 95% pt | P(<0.90) | P(<0.93) |
| 19 | 19 | 0.9500 | 0.8541 | 0.9973 | 0.1351 | 0.2519 |
| 20 | 20 | 0.9524 | 0.8609 | 0.9974 | 0.1216 | 0.2342 |
| 50 | 49 | 0.9608 | 0.9086 | 0.9928 | 0.0338 | 0.1265 |
| 100 | 96 | 0.9505 | 0.9108 | 0.9801 | 0.0237 | 0.1632 |
| 200 | 191 | 0.9502 | 0.9228 | 0.9726 | 0.0035 | 0.1010 |
| 500 | 476 | 0.9501 | 0.9332 | 0.9650 | 0.0000 | 0.0280 |
| 1000 | 951 | 0.9500 | 0.9382 | 0.9608 | 0.0000 | 0.0040 |
| 2000 | 1901 | 0.9500 | 0.9418 | 0.9578 | 0.0000 | 0.0001 |
查看完整验算程序
# Chapter 4. p41: coverage given one calibration set is a Beta draw.
# Model: with m continuous exchangeable scores and rank
# k = ceil((m + 1)(1 - alpha)), the coverage conditional on the
# calibration set follows Beta(k, m + 1 - k). Its CDF at x equals
# P(Binomial(m, x) >= k), summed exactly with math.fsum; quantiles
# come from bisection. Nothing here is simulated.
import math
def beta_cdf(x, k, m):
if x <= 0.0:
return 0.0
if x >= 1.0:
return 1.0
lx, l1 = math.log(x), math.log1p(-x)
terms = [math.exp(math.lgamma(m + 1) - math.lgamma(j + 1)
- math.lgamma(m - j + 1) + j * lx + (m - j) * l1)
for j in range(k, m + 1)]
return math.fsum(terms)
def beta_q(p, k, m):
lo, hi = 0.0, 1.0
for _ in range(60):
mid = (lo + hi) / 2
if beta_cdf(mid, k, m) < p:
lo = mid
else:
hi = mid
return (lo + hi) / 2
if __name__ == "__main__":
a = 0.05
print("alpha = 0.05; coverage | calibration ~ Beta(k, m + 1 - k)")
print(" m k mean 5% pt 95% pt P(<0.90) P(<0.93)")
for m in (19, 20, 50, 100, 200, 500, 1000, 2000):
k = math.ceil((m + 1) * (1 - a))
print("{:5d} {:5d} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f}"
.format(m, k, k / (m + 1), beta_q(0.05, k, m),
beta_q(0.95, k, m), beta_cdf(0.90, k, m),
beta_cdf(0.93, k, m)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《共形预测与无分布区间、订单量与客单价有限样本覆盖保证母典》第 4 章「校准集要多大:给定校准集时覆盖率服从贝塔分布」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-306 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026306,
author = {Fan, Yafu},
title = {Conformal Prediction and Distribution-Free Intervals: Finite-Sample Coverage Guarantees for Order Counts and Order Values},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}