关于「月度体检:掏空过程的条码时间序列与计算规模」,《社群拓扑体检》给出的定量结论是什么?

结论:第六章做十二个月的掏空序列,点赞维持在基线的 0.998 倍,同步报警与环的报警先后响起。

数据口径:书中所有社群与成员都是固定种子的合成数据,不使用任何真实社群或个人的数据;全部计算由书中程序生成,参数为示意;本书是非个人化经营建议,「水军识别」只产出供人工复核的嫌疑名单,不自动处罚任何成员。 第二章用并查集求零维条码、用模 2 列约化求一维条码,在两百个合成社群上,点赞总数的 AUC 只有 0.427,一维条码前三长之和 L3 为 0.975;补量社群的真实核心增至 30 人时降到 0.673,此时须靠零维短条。

English version

对照数据表

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

monthrealsockslikesL3belowshortalarm
13008800.1800no0.000-
23008640.2357no0.000-
33008500.2369no0.000-
43008560.3197no0.000-
53008830.2452no0.000-
63008720.1981no0.000-
baseline L3 mean 0.2359, sd 0.0483, floor 0.1393
72738590.2527no0.067-
82469120.1142yes0.167lockstep
92198670.1505yes0.267lockstep
1018128860.1389yes0.367ring+lockstep
1115158860.1026yes0.467ring+lockstep
1212188660.0413yes0.567ring+lockstep
likes, months 1-6 mean 867.5; month 12 / mean = 0.998
查看完整验算程序
# Chapter 6. p61: A twelve-month topological checkup with a hollowing.
# Months 1-6: 30 genuine members, each with a fixed interest arc; likes
# are redrawn every month. From month 7 three members leave and three
# lockstep accounts join each month, so head count and likes stay
# level. Ring alarm: L3 below the null line 0.1786 of p41 in this and
# the previous month, and below the months 1-6 mean minus 2 sd.
# Lockstep alarm: more than 0.10 short H0 bars per account (delta 0.2).
import math
import random
import statistics

T, P = 24, 5          # 24 topics on a ring, 5 posts each (illustrative)
N_POSTS = T * P


def member(rng, centre, width, q=0.8, stray=0.03):
    # a genuine member likes posts on an arc of topics around centre
    s = set()
    for t in range(T):
        dd = abs(t - centre) % T
        dd = min(dd, T - dd)
        hit = q if dd <= width / 2.0 else stray
        for k in range(P):
            if rng.random() < hit:
                s.add(t * P + k)
    return s


def sock(rng, target, q=0.95, stray=0.01):
    # a boosting account likes the operator's target posts in lockstep
    s = set()
    for p in range(N_POSTS):
        if rng.random() < (q if p in target else stray):
            s.add(p)
    return s


def community(rng, n_real, arc, n_sock):
    # n_real genuine members with interest centres on [0, arc) topics,
    # plus n_sock boosting accounts aimed at 30 target posts
    pts = []
    for _ in range(n_real):
        pts.append(member(rng, rng.uniform(0, arc), rng.randint(5, 8)))
    target = set(rng.sample(range(N_POSTS), 30))
    for _ in range(n_sock):
        pts.append(sock(rng, target))
    return pts


def jaccard(a, b):
    u = len(a | b)
    return 1.0 - len(a & b) / u if u else 0.0


def barcodes(pts, cap=1.0):
    return barcodes_d(len(pts), lambda i, j: jaccard(pts[i], pts[j]), cap)


def barcodes_d(n, dist, cap=1.0):
    # Vietoris-Rips filtration (up to triangles) of a distance dist(i, j).
    # H0 by union-find; H1 by mod-2 reduction of triangle columns,
    # each column stored as a Python integer used as a bitset of edges.
    edges = []
    for i in range(n):
        for j in range(i + 1, n):
            d = dist(i, j)
            if d <= cap:
                edges.append((d, i, j))
    edges.sort()
    eid = {(i, j): k for k, (d, i, j) in enumerate(edges)}
    par = list(range(n))

    def find(x):
        while par[x] != x:
            par[x] = par[par[x]]
            x = par[x]
        return x
    h0, neg = [], set()
    for k, (d, i, j) in enumerate(edges):
        a, b = find(i), find(j)
        if a != b:
            par[max(a, b)] = min(a, b)
            h0.append((d, i, j))
            neg.add(k)
    tris = []
    for (i, j), e in eid.items():
        for k in range(j + 1, n):
            f, g = eid.get((i, k)), eid.get((j, k))
            if f is not None and g is not None:
                tris.append(tuple(sorted((e, f, g), reverse=True)))
    tris.sort()
    piv, h1 = {}, []
    for t in tris:
        col = (1 << t[0]) | (1 << t[1]) | (1 << t[2])
        while col:
            low = col.bit_length() - 1
            if low not in piv:
                piv[low] = col
                break
            col ^= piv[low]
        if col and edges[t[0]][0] > edges[low][0]:
            h1.append((edges[low][0], edges[t[0]][0]))
    for k in range(len(edges)):
        if k not in neg and k not in piv:
            h1.append((edges[k][0], cap))     # still open at the cap
    return h0, h1


def lead3(h1):
    # length of the three longest one-dimensional bars, added exactly
    top = sorted((d - b for b, d in h1), reverse=True)[:3]
    return math.fsum(top)


def short_frac(h0, n, delta=0.2):
    # zero-dimensional bars dying below delta, per account
    return len([1 for d, i, j in h0 if d < delta]) / float(n)


rng = random.Random(20261113)
prof = [(rng.uniform(0, 24), rng.randint(5, 8)) for _ in range(30)]
target = set(rng.sample(range(N_POSTS), 30))
LINE, SHORT = 0.1786, 0.10
print("month  real  socks  likes   L3      below  short   alarm")
base, below_prev, floor = [], False, None
for month in range(1, 13):
    gone = max(0, 3 * (month - 6))
    pts = [member(rng, c, w) for c, w in prof[gone:]]
    pts += [sock(rng, target) for _ in range(gone)]
    h0, h1 = barcodes(pts)
    likes = int(math.fsum(len(p) for p in pts))
    l3, sf = lead3(h1), short_frac(h0, len(pts))
    below = l3 < LINE
    flag = []
    if month <= 6:
        base.append((likes, l3))
    else:
        if below and below_prev and l3 < floor:
            flag.append("ring")
    if sf > SHORT:
        flag.append("lockstep")
    print("%5d  %4d  %5d  %5d   %.4f  %-5s  %.3f   %s"
          % (month, 30 - gone, gone, likes, l3, "yes" if below else "no",
             sf, "+".join(flag) or "-"))
    below_prev = below
    if month == 6:
        b3 = [x[1] for x in base]
        floor = statistics.mean(b3) - 2 * statistics.stdev(b3)
        print("baseline L3 mean %.4f, sd %.4f, floor %.4f"
              % (statistics.mean(b3), statistics.stdev(b3), floor))
m = math.fsum(x[0] for x in base) / 6
print("likes, months 1-6 mean %.1f; month 12 / mean = %.3f"
      % (m, likes / m))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《持续同调拓扑贝蒂数、高净值私域社群结构空洞与虚假抱团水军识别母典》第 6 章「月度体检:掏空过程的条码时间序列与计算规模」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026236,
  author    = {Fan, Yafu},
  title     = {Persistent Homology and Betti Numbers: Structural Voids in High-Net-Worth Private Communities and the Review of Fake Cliques},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论