关于「保证的价钱:区间宽度、得分形状与正态成立时多付的那一截」,《共形预测与订单区间》给出的定量结论是什么?
结论:对数正态零点五一行,神谕宽度是 2.289,正态区间的中位宽度是 2.367,共形区间是 2.960。对数正态一的一行,神谕 6.958,正态中位 7.008,共形中位 10.301。最后一行把帕累托 2.1 的中位宽度除以神谕:正态 0.99,共形 1.49。
数据口径:书中参数为示意;全部计算由书中程序生成;本书属于非个人化经营建议。 本书作蓝图修正:正态区间的缺口是本书程序的模拟结果,集中在右尾与单侧上界;东方原典句出自《元史·郭守敬传》。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.99, 1.49, 10.301, 2.1, 2.289, 2.367
| width in units of the shape's scale, n | 30 |
| shape a oracle normal mean/med conformal mean/med | |
| lognorm | 0.5 2.289 2.446 / 2.367 3.297 / 2.960 |
| lognorm | 1.0 6.958 7.999 / 7.008 12.979 / 10.301 |
| pareto | 3.0 2.411 2.935 / 2.433 4.873 / 3.602 |
| pareto | 2.1 4.781 6.623 / 4.737 11.452 / 7.138 |
| Pareto 2.1 median width over oracle: normal 0.99, conformal 1.49 |
查看完整验算程序
# Chapter 3. p31: what the guarantee costs in interval width.
# Model: n = 30 past values; normal-theory PI (t = 2.0452) versus
# split conformal (10 fit a median centre, 20 calibrate, k = 20).
# The yardstick is the oracle equal-tailed interval from the true
# quantiles at 0.025 and 0.975. Widths are averaged (mean and median)
# over 8,000 training sets. Shapes are illustrative.
import math
import random
import statistics
ND = statistics.NormalDist()
def make(kind, a):
if kind == "lognorm":
return (lambda r: math.exp(r.gauss(0.0, a)),
lambda p: math.exp(a * ND.inv_cdf(p)))
return (lambda r: (1.0 - r.random()) ** (-1.0 / a),
lambda p: (1.0 - p) ** (-1.0 / a))
def widths(kind, a, reps=8000):
rng = random.Random(20261113)
draw, q = make(kind, a)
wn, wc = [], []
for _ in range(reps):
xs = [draw(rng) for _ in range(30)]
f = statistics.stdev(xs) * math.sqrt(1.0 + 1.0 / 30)
wn.append(2 * 2.0452 * f)
c = statistics.median(xs[:10])
sc = sorted(abs(x - c) for x in xs[10:])
wc.append(2 * sc[19])
oracle = q(0.975) - q(0.025)
return oracle, wn, wc
if __name__ == "__main__":
print("width in units of the shape's scale, n = 30")
print("shape a oracle normal mean/med conformal mean/med")
for kind, a in (("lognorm", 0.5), ("lognorm", 1.0),
("pareto", 3.0), ("pareto", 2.1)):
o, wn, wc = widths(kind, a)
print("{:<8s} {:3.1f} {:6.3f} {:6.3f} / {:6.3f} "
"{:6.3f} / {:6.3f}"
.format(kind, a, o, statistics.fmean(wn),
statistics.median(wn), statistics.fmean(wc),
statistics.median(wc)))
o, wn, wc = widths("pareto", 2.1)
print("Pareto 2.1 median width over oracle: normal {:.2f}, "
"conformal {:.2f}".format(statistics.median(wn) / o,
statistics.median(wc) / o))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《共形预测与无分布区间、订单量与客单价有限样本覆盖保证母典》第 3 章「保证的价钱:区间宽度、得分形状与正态成立时多付的那一截」(版本 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}
}