关于「稀疏化与时间重标:模拟一条评论流,再审计它」,《评论裂变分支比》给出的定量结论是什么?

结论:第三章用尾形稀疏化模拟评论流,用时间重标审计拟合,发现间隔检验几乎看不见成团,计数离散度检验则拒绝平坦泊松模型 0.646 的次数。

数据口径:书中的帖子、账号、流量、成本与评论价值均为示意参数;全部计算由书中程序生成;本书是非个人化经营建议,只讨论真实用户的评论与平台官方工具买来的曝光,不涉及任何制造评论或虚构稀缺的手段。 第四章用小崎递推、补偿子恒等式与黄金分割求最大似然估计,示意帖的分支比 95 % 区间从 0.42 到 0.92,两小时估计的标准差约 0.186。

English version

对照数据表

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

post 1 (260 comments), Hawkes  KS 0.037  dispersion 19.23
post 1 (260 comments), Poisson KS 0.055  dispersion 48.95
500 posts, share rejected at 5%:
  Hawkes   KS 0.042   dispersion 0.066
  Poisson  KS 0.024   dispersion 0.646
gap-based KS barely sees two hours of clumping; counts per slice
do. Audit a fit with both, and never with KS alone.
查看完整验算程序
# Chapter 3. p32: Time rescaling: does a fitted model explain the clumps?
# If the intensity model is right, the compensator values
#   s_i = Lambda(t_i)  form a unit-rate Poisson process on [0, Lambda(T)]
# (Ogata 1988; Brown et al. 2002). Two checks on the rescaled points:
# (a) Kolmogorov-Smirnov distance of the gaps, 1 - exp(-gap) against
#     uniform, 5% critical value 1.36 / sqrt(N);
# (b) dispersion: counts in 12 equal slices of [0, Lambda(T)], chi-square
#     sum (c - m)^2 / m on 11 df, 5% critical value 19.675.
# Models on the same simulated posts: the true Hawkes model (mu 1.0,
# n 0.6, beta 0.1) and a flat Poisson rate N / T. Fixed seed.
import math
import random

MU, N, BETA, T, SLICES = 1.0, 0.6, 0.1, 120.0, 12


def simulate(mu, n, beta, horizon, rng):
    t, excess, times = 0.0, 0.0, []
    while True:
        bound = mu + excess
        w = rng.expovariate(bound)
        t += w
        if t > horizon:
            return times
        excess *= math.exp(-beta * w)
        if rng.random() * bound <= mu + excess:
            times.append(t)
            excess += n * beta


def rescale(times, mu, n, beta, horizon):
    inc, prev, excess = [], 0.0, 0.0
    for t in times + [horizon]:
        d = t - prev
        inc.append(mu * d + excess / beta * (1 - math.exp(-beta * d)))
        excess = excess * math.exp(-beta * d) + n * beta
        prev = t
    out = [math.fsum(inc[:k + 1]) for k in range(len(inc))]
    return out[:-1], out[-1]


def ks(s):
    gaps = [b - a for a, b in zip([0.0] + s[:-1], s)]
    u = sorted(1 - math.exp(-g) for g in gaps)
    m = len(u)
    return max(max((i + 1) / m - v, v - i / m) for i, v in enumerate(u))


def dispersion(s, total):
    c = [0] * SLICES
    for x in s:
        c[min(int(x / total * SLICES), SLICES - 1)] += 1
    m = len(s) / SLICES
    return math.fsum((k - m) ** 2 for k in c) / m


rng = random.Random(20261121)
rows = {"Hawkes": [0, 0], "Poisson": [0, 0]}
first = None
for rep in range(500):
    ts = simulate(MU, N, BETA, T, rng)
    crit = 1.36 / math.sqrt(len(ts))
    for name, mu, n in (("Hawkes", MU, N), ("Poisson", len(ts) / T, 0.0)):
        s, tot = rescale(ts, mu, n, BETA, T)
        k, d = ks(s), dispersion(s, tot)
        rows[name][0] += k > crit
        rows[name][1] += d > 19.675
        if rep == 0:
            print("post 1 (%d comments), %-7s KS %.3f  dispersion %.2f"
                  % (len(ts), name, k, d))
print("500 posts, share rejected at 5%:")
for name in ("Hawkes", "Poisson"):
    print("  %-7s  KS %.3f   dispersion %.3f"
          % (name, rows[name][0] / 500, rows[name][1] / 500))
print("gap-based KS barely sees two hours of clumping; counts per slice")
print("do. Audit a fit with both, and never with KS alone.")

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《霍克斯自激点过程、评论裂变分支比临界值与直播跟风抢购余震半衰期母典》第 3 章「稀疏化与时间重标:模拟一条评论流,再审计它」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026234,
  author    = {Fan, Yafu},
  title     = {Hawkes Self-Exciting Point Processes: Branching-Ratio Criticality in Comment Cascades and the Aftershock Half-Life of Livestream Herd Buying},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论