关于「实证闭环:入库体检、规则入库描述长度裁判与预注册的证伪方案」,《规则库的奥卡姆剃刀》给出的定量结论是什么?
结论:第八章给出入库体检流程、蒸馏小工具「规则入库描述长度裁判」与预注册证伪方案,检验门槛是否优于不设门槛,每组需 2,733 条留出记录。书中以标注框区分已发表的证据、可运行的 Python 计算(18 段程序)、原典与作者的假说。
数据口径:书中的决策记录全部合成、参数均为示意,全部计算由书中程序生成;本书是非个人化的经营分析,不构成经营建议。 第二章建立两部编码账本:一条准确率超过八成、却只净修正 7 条例外的窄规则挣不回自己的篇幅;在合成台账上,门槛从提议者的 12 条规则中只放进 3 条,第三条的余量仅 2.9 个比特。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 2733
| part 1: ledger records needed (d 16 bits, p 0.25, m 2) | |
| cell share c q | 0.60 q=0.70 q=0.85 |
| 0.02 | 4091 2043 1179 |
| 0.05 | 1651 826 443 |
| 0.10 | 826 388 208 |
| part 2: hold-out records per arm (alpha 0.05, power 0.80) | |
| MDL gate vs proposer end | 0.1916 vs 0.2223: 2733 |
| MDL gate vs oracle | 0.1916 vs 0.1872: 124485 |
查看完整验算程序
# Chapter 8. p82: sample sizes for the pre-registered test.
# Part 1: how many ledger records N before a rule of cell share c and
# act rate q (inside its cell) can clear the gate: SE margin > d with
# d = 16 bits, overall exception share p = 0.25, a two-condition rule
# (mean log2 V of p22), k = 3 rules already. Expected counts, exact
# code lengths (p21), smallest N found by doubling and bisection.
# Part 2: hold-out records per arm for a two-sided two-proportion test,
# alpha 0.05, power 0.80, normal approximation; error rates taken from
# p32 (MDL gate 0.1916, proposer end 0.2223, oracle 0.1872).
import math
from statistics import NormalDist
V = (4, 4, 3, 4, 3, 5)
A = len(V)
def gamma(n):
return 2 * (n.bit_length() - 1) + 1
def exc_bits(n, e):
return gamma(e + 1) + math.log2(math.comb(n, e))
def cost(m=2, k=3):
lv = math.fsum(math.log2(v) for v in V) / A
return math.fsum([float(gamma(m)), math.log2(math.comb(A, m)),
m * lv, float(gamma(k + 2) - gamma(k + 1))])
def margin(n, c, q, p=0.25):
e = round(p * n)
net = round(n * c * (2 * q - 1))
return exc_bits(n, e) - exc_bits(n, e - net) - cost()
def n_min(c, q, d=16.0):
hi = 50
while margin(hi, c, q) <= d:
hi *= 2
lo = hi // 2
while hi - lo > 1:
mid = (lo + hi) // 2
lo, hi = (lo, mid) if margin(mid, c, q) > d else (mid, hi)
return hi
def per_arm(p1, p2, alpha=0.05, power=0.80):
z = NormalDist()
za, zb = z.inv_cdf(1 - alpha / 2), z.inv_cdf(power)
pb = (p1 + p2) / 2
num = za * math.sqrt(2 * pb * (1 - pb)) + zb * math.sqrt(
p1 * (1 - p1) + p2 * (1 - p2))
return math.ceil(num * num / (p1 - p2) ** 2)
if __name__ == "__main__":
print("part 1: ledger records needed (d 16 bits, p 0.25, m 2)")
print(" cell share c q=0.60 q=0.70 q=0.85")
for c in (0.02, 0.05, 0.10):
print(" {:>12.2f} {:>8} {:>8} {:>8}".format(
c, *[n_min(c, q) for q in (0.60, 0.70, 0.85)]))
print("part 2: hold-out records per arm (alpha 0.05, power 0.80)")
for name, p1, p2 in (("MDL gate vs proposer end", 0.1916, 0.2223),
("MDL gate vs oracle", 0.1916, 0.1872)):
print(" {:<25} {:.4f} vs {:.4f}: {:>7}".format(
name, p1, p2, per_arm(p1, p2)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《最小描述长度原则与规则库奥卡姆剃刀、两部编码判定新规则值不值得入库母典》第 8 章「实证闭环:入库体检、规则入库描述长度裁判与预注册的证伪方案」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-311 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026311,
author = {Fan, Yafu},
title = {The Minimum Description Length Principle and Ockham's Razor for Rule Bases: Two-Part Codes that Decide Whether a New Rule Earns Its Place},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}