关于「半衰期与余震总量:预报一条帖子的尾巴」,《评论裂变分支比》给出的定量结论是什么?

结论:第五章计算外部给量停止后的余震存量与半衰期,回测中向账号均值收缩把预报误差中位数从 0.589 降到 0.418,并说明凸性使期望乘数被抬高到 3.40。

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

English version

对照数据表

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

shrink weight w = 0.394
comments after minute 120: median 39, p10 9, p90 159
forecastmedian abs errorshare within 30%
truth0.2700.550
fitted0.5890.260
shrunk0.4180.363
account0.5260.300
zero1.0000.000
flat39.0900.000
查看完整验算程序
# Chapter 5. p52: Forecasting the tail of a post from its first two hours.
# Simulated posts: outside traffic mu = 1.0 per minute for 120 minutes,
# then none; each post has its own true n ~ Normal(0.6, 0.15) clipped
# to [0.2, 0.9] (between-post spread tau = 0.15, illustrative); beta =
# 0.1. Target: comments after minute 120 (to minute 720). Forecasts:
#   truth    E / (beta (1 - n)) with the post's own true n
#   fitted   the same with n fitted on minutes 0-120 (p42, beta fixed)
#   shrunk   n = 0.6 + w (fitted - 0.6), w = tau^2 / (tau^2 + s^2),
#            s = 0.186 the two-hour sampling sd from p43
#   account  n = 0.6 for every post
#   zero     "the push stopped, so the post is over"
#   flat     "the heat goes on": last 20 minutes' rate for 600 minutes
# Score: median |forecast / actual - 1| over 300 posts. Fixed seed.
import math
import random

MU, BETA, T, END, TAU, S = 1.0, 0.1, 120.0, 720.0, 0.15, 0.186
G = (math.sqrt(5) - 1) / 2


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


def stats(times, beta, horizon):
    a, prev, out = 0.0, None, []
    for t in times:
        if prev is not None:
            a = math.exp(-beta * (t - prev)) * (1 + a)
        out.append(a)
        prev = t
    s = math.fsum(1 - math.exp(-beta * (horizon - t)) for t in times)
    return out, s


def loglik(mu, n, beta, a_list, s, horizon):
    terms = [math.log(mu + n * beta * a) for a in a_list]
    return math.fsum(terms) - mu * horizon - n * s


def golden_max(f, lo, hi, iters=40):
    x1, x2 = hi - G * (hi - lo), lo + G * (hi - lo)
    f1, f2 = f(x1), f(x2)
    for _ in range(iters):
        if f1 < f2:
            lo, x1, f1 = x1, x2, f2
            x2 = lo + G * (hi - lo)
            f2 = f(x2)
        else:
            hi, x2, f2 = x2, x1, f1
            x1 = hi - G * (hi - lo)
            f1 = f(x1)
    x = (lo + hi) / 2
    return x, f(x)


def fit_n(times, beta, horizon):
    a_list, s = stats(times, beta, horizon)
    cnt = len(times)
    hi = min(0.999, cnt / s - 1e-9)
    n, ll = golden_max(lambda v: loglik((cnt - v * s) / horizon, v, beta,
                                        a_list, s, horizon), 0.0, hi)
    return n, (cnt - n * s) / horizon, ll



def to_come(times, n, beta, horizon):
    e = math.fsum(n * beta * math.exp(-beta * (horizon - t)) for t in times)
    return e / (beta * (1 - n))


rng = random.Random(20261113)
W = TAU ** 2 / (TAU ** 2 + S ** 2)
names = ("truth", "fitted", "shrunk", "account", "zero", "flat")
err = {k: [] for k in names}
actual_all = []
for _ in range(300):
    n_true = min(0.9, max(0.2, rng.gauss(0.6, TAU)))
    ts = simulate_off(MU, n_true, BETA, T, END, rng)
    early = [t for t in ts if t <= T]
    actual = max(len(ts) - len(early), 1)
    actual_all.append(actual)
    n_hat = fit_n(early, BETA, T)[0]
    last = len([t for t in early if t > T - 20])
    fc = (to_come(early, n_true, BETA, T), to_come(early, n_hat, BETA, T),
          to_come(early, 0.6 + W * (n_hat - 0.6), BETA, T),
          to_come(early, 0.6, BETA, T), 0.0, last / 20.0 * 600.0)
    for k, f in zip(names, fc):
        err[k].append(abs(f / actual - 1))
actual_all.sort()
print("shrink weight w = %.3f" % W)
print("comments after minute 120: median %d, p10 %d, p90 %d"
      % (actual_all[150], actual_all[30], actual_all[270]))
print("forecast  median abs error  share within 30%")
for k in names:
    e = sorted(err[k])
    good = len([x for x in e if x <= 0.3]) / len(e)
    print("%-8s  %.3f             %.3f" % (k, (e[149] + e[150]) / 2, good))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《霍克斯自激点过程、评论裂变分支比临界值与直播跟风抢购余震半衰期母典》第 5 章「半衰期与余震总量:预报一条帖子的尾巴」(版本 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}
}

本书其他章节结论