What does Autonomic Balance, Six Stages and Multimodal Inversion conclude, in numbers, about “The Six Stages as a Hidden Markov State Space”?

Answer: Chapter 4 writes the six stages as a hidden Markov model: with the model exactly right, days are decoded correctly 0.830 of the time, taiyang and shaoyang and shaoyin and jueyin are hardest to separate, and modelling "combined disease" on its own needs 21 states.

Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.830

days decoded correctly: 0.830
taiyang0.916(11342 days)
yangming0.871(7267 days)
shaoyang0.727(6638 days)
taiyin0.812(5770 days)
shaoyin0.700(4695 days)
jueyin0.853(6288 days)
most common mix-up: shaoyin read as jueyin
Show the full program
# Chapter 4. p07: The six stages as a hidden Markov model. Hidden state:
# taiyang, yangming, shaoyang, taiyin, shaoyin, jueyin (illustrative
# order of ordinary progression). Daily transitions: stay 0.70, move to
# the next stage 0.20 ("sequential transmission"), skip one stage 0.05
# ("skipping"), any other stage 0.05 shared. Each day four measurements
# are seen, in standard units: temperature-rhythm amplitude, core-to-skin
# gradient, gut (vagal) motility rate, cortisol awakening response; each
# stage has its own mean (illustrative) and noise sd 0.8. Viterbi decoding
# with the true model, 3,000 courses of 14 days, seed 86.
import random
from math import log, pi

STAGES = ("taiyang", "yangming", "shaoyang", "taiyin", "shaoyin", "jueyin")
MEAN = ((1.0, 1.2, 0.0, 0.5), (1.5, -0.5, -0.8, 1.0),
        (0.5, 0.3, -0.3, 0.3), (-0.3, 0.0, 1.0, -0.3),
        (-1.0, 0.8, 0.3, -1.0), (-0.6, 1.2, -0.6, -0.7))
SD = 0.8

def trans():
    T = []
    for i in range(6):
        row = [0.05 / 3] * 6
        row[i] = 0.70
        if i + 1 < 6:
            row[i + 1] = 0.20
        if i + 2 < 6:
            row[i + 2] = 0.05
        z = sum(row)
        T.append([x / z for x in row])
    return T

T = trans()

def logpdf(x, m, sd=SD):
    return sum(-0.5 * ((a - b) / sd) ** 2 - log(sd) - 0.5 * log(2 * pi)
               for a, b in zip(x, m))

def course(rng, days=14):
    s, xs, ss = 0, [], []
    for _ in range(days):
        ss.append(s)
        xs.append([m + rng.gauss(0, SD) for m in MEAN[s]])
        u, acc = rng.random(), 0.0
        for j in range(6):
            acc += T[s][j]
            if u < acc:
                s = j
                break
    return ss, xs

def viterbi(xs, start=(1.0, 0, 0, 0, 0, 0)):
    lt = [[log(p) for p in row] for row in T]
    v = [(log(start[j]) if start[j] > 0 else -1e9) + logpdf(xs[0], MEAN[j])
         for j in range(6)]
    back = []
    for x in xs[1:]:
        nv, bk = [], []
        for j in range(6):
            i = max(range(6), key=lambda i: v[i] + lt[i][j])
            nv.append(v[i] + lt[i][j] + logpdf(x, MEAN[j]))
            bk.append(i)
        v, back = nv, back + [bk]
    s = max(range(6), key=lambda j: v[j])
    path = [s]
    for bk in reversed(back):
        s = bk[s]
        path.append(s)
    return path[::-1]

if __name__ == "__main__":
    rng = random.Random(86)
    hit = tot = 0
    by = [[0, 0] for _ in range(6)]
    conf = {}
    for _ in range(3000):
        ss, xs = course(rng)
        est = viterbi(xs)
        for a, b in zip(ss, est):
            hit += a == b
            tot += 1
            by[a][0] += a == b
            by[a][1] += 1
            if a != b:
                conf[(a, b)] = conf.get((a, b), 0) + 1
    print("   days decoded correctly: {:.3f}".format(hit / tot))
    for i, n in enumerate(STAGES):
        print("   {:<9} {:.3f}  ({} days)".format(n, by[i][0] / by[i][1],
                                                 by[i][1]))
    a, b = max(conf, key=conf.get)
    print("   most common mix-up: {} read as {}".format(STAGES[a],
                                                     STAGES[b]))

Single source and citation

Fan, Y. (2026). Autonomic Sympathovagal Balance, Six-Meridian State-Space Models and Multimodal Biomarker Inversion (Version 1.0.0), Chapter 4: The Six Stages as a Hidden Markov State Space. 5D Library. https://doi.org/10.5281/zenodo.24090227

DOI: 10.5281/zenodo.24090227 · Read the monograph · 5DL-B-086 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026086,
  author    = {Fan, Yafu},
  title     = {Autonomic Sympathovagal Balance, Six-Meridian State-Space Models and Multimodal Biomarker Inversion},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.24090227},
  url       = {https://doi.org/10.5281/zenodo.24090227}
}

Other chapter answers in this book