5D Library › 自主神经交感迷走平衡、六经辨证状态空间与多模态标志物反演 · English
第五章 三模态快速筛查作为贝叶斯反问题
三种模式与三种信号
设想一项三分钟的筛查:一份结构化问卷、一段以手机摄像头读取的脉搏(远程光电容积描记,rPPG (Verkruysse et al. 2008)),以及一段朗读录音的嗓音扰动指标。被筛查标记出来的人当中,假定有三种同样常见的模式:A「前额叶疲劳」、B「突显网络焦虑锁死」、C「关机样冻结」(多迷走神经理论所称的「背侧迷走冻结」,此一说法本身仍有争议 (Grossman 2023))。三个名称都是示意标签,不是诊断类别。
把它写成反问题:观测到三个分数,问最可能是哪一种模式。若三项分数在给定模式下彼此独立,后验概率就是三项似然的乘积。
推导
# Chapter 5. p09: A three-minute screen with three modalities. Among
# people the screen flags, three patterns are equally common (prior 1/3):
# A "prefrontal fatigue", B "salience-network anxiety lock", C "shutdown"
# (the polyvagal "dorsal freeze" label). Each modality gives one score in
# standard units with sd 1: a structured questionnaire Q, a camera pulse
# score P (from heart rate and RMSSD) and a voice perturbation score J.
# Illustrative class means below. If the three scores are independent
# given the class, the posterior is the product of the likelihoods
# (likelihood ratios multiply). Misclassification over 30,000 people,
# seed 86.
import random
from math import exp
MEANS = {"A": (0.0, 0.0, 0.5), "B": (1.0, 1.2, 1.0), "C": (0.6, -0.8, -0.5)}
def post(x, use):
w = {c: exp(-0.5 * sum((x[i] - m[i]) ** 2 for i in use))
for c, m in MEANS.items()}
z = sum(w.values())
return {c: v / z for c, v in w.items()}
def draw(rng, c, rho=0.0):
f = rng.gauss(0, 1)
return [m + rho ** 0.5 * f + (1 - rho) ** 0.5 * rng.gauss(0, 1)
for m in MEANS[c]]
if __name__ == "__main__":
rng = random.Random(86)
people = [(c, draw(rng, c)) for _ in range(10000) for c in "ABC"]
for use, label in (((0,), "questionnaire only"),
((0, 1), "+ camera pulse"),
((0, 1, 2), "+ voice")):
err = sum(1 for c, x in people
if max(post(x, use).items(), key=lambda kv: kv[1])[0] != c)
print(" {:<19} error {:.3f}".format(label, err / len(people)))
# questionnaire only error 0.532
# + camera pulse error 0.356
# + voice error 0.298只用问卷时误判率是 0.532,几乎和不看任何信号的三选一(约三分之二)差不多好不了多少;加上摄像头脉搏降到 0.356,再加嗓音降到 0.298。每一种模态都提供了一部分其他模态没有的信息。
模态共享原因时,朴素贝叶斯会过度自信
三项分数往往并不独立:睡眠不足、咖啡因、被测量本身的紧张,会把问卷、脉搏与嗓音同时推向同一方向。p10 让三项分数之间有共同相关系数 ,比较把似然直接相乘的朴素规则,与使用正确协方差的规则。
推导
# Chapter 5. p10: When the three modalities share a cause. General
# arousal (sleep, caffeine, the stress of being measured) moves all three
# scores of p09 together: each score = class mean + shared factor + own
# noise, with correlation rho between scores and sd still 1. Compared:
# the naive rule that multiplies likelihoods as if independent, and the
# correct rule using the equicorrelated covariance, whose inverse is
# (I - rho/(1 + 2 rho) J) / (1 - rho). Reported: error, and how sure the
# naive rule claims to be (mean top posterior) against how often it is
# right. 30,000 people per rho, seed 86.
import importlib.util
import random
from math import exp
def load(name):
spec = importlib.util.spec_from_file_location(name, name + ".py")
m = importlib.util.module_from_spec(spec)
spec.loader.exec_module(m)
return m
p09 = load("p09_three_modes")
def post_corr(x, rho):
a = rho / (1 + 2 * rho)
w = {}
for c, m in p09.MEANS.items():
d = [x[i] - m[i] for i in range(3)]
q = (sum(v * v for v in d) - a * sum(d) ** 2) / (1 - rho)
w[c] = exp(-0.5 * q)
z = sum(w.values())
return {c: v / z for c, v in w.items()}
if __name__ == "__main__":
rng = random.Random(86)
print(" rho naive error correct error naive claims naive right")
for rho in (0.0, 0.3, 0.6):
e1 = e2 = claim = 0.0
n = 0
for _ in range(10000):
for c in "ABC":
x = p09.draw(rng, c, rho)
pn = p09.post(x, (0, 1, 2))
pc = post_corr(x, rho)
top = max(pn, key=pn.get)
e1 += top != c
e2 += max(pc, key=pc.get) != c
claim += pn[top]
n += 1
print(" {:.1f} {:11.3f} {:13.3f} {:12.3f} {:11.3f}".format(
rho, e1 / n, e2 / n, claim / n, 1 - e1 / n))
# rho naive error correct error naive claims naive right
# 0.0 0.298 0.298 0.699 0.702
# 0.3 0.333 0.321 0.704 0.667
# 0.6 0.345 0.290 0.707 0.655= 0.6 时,朴素规则的误判率是 0.345,正确规则是 0.290。更要紧的是朴素规则对自己的判断有多肯定:它报出的最高后验平均是 0.707,实际说对的比例只有 0.655。相关越强,这个差距越大。一个对外报告「七成把握」的筛查工具,如果忽略模态之间的共同原因,就是在夸大自己。
假说 · 尚未验证
作者的诠释(尚未验证): 问卷、摄像头脉搏与嗓音三种模态合用,能比单用问卷更准确地区分疲劳型、焦虑锁死型与关机冻结型三种状态。什么会证明它错: 在以结构化临床访谈为参照的独立样本中,三模态组合的分类准确率与单用问卷相比没有统计上可靠的提升,或其报告的置信度系统性地高于实际准确率。
小结
把筛查写成贝叶斯反问题,可以清楚地算出每一种模态各贡献多少;但多模态的加法只在模态之间的共同原因被正确建模时才诚实。忽略相关会让误判率变高,更会让工具报出它并不具有的把握。
参考文献
Fan, Y. (2026). Autonomic Sympathovagal Balance, Six-Meridian State-Space Models and Multimodal Biomarker Inversion: Heart-Rate Variability Spectral Decomposition, Thermoregulatory Phase Drift and Bayesian Syndrome Classification [自主神经交感迷走平衡、六经辨证状态空间与多模态标志物反演] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090227 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).