Skip to main content

Module cssr

Module cssr 

Source
Expand description

Pillar: III. PACR field: Γ.

Causal State Splitting Reconstruction (CSSR) algorithm.

Ref: Shalizi & Crutchfield (2001), “Computational Mechanics: Pattern and Prediction, Structure and Simplicity”, J. Stat. Phys. 104(3-4):817-879.

§Algorithm outline

  1. Build suffix statistics: for every observed history h of length 1..=max_depth, count how often each symbol follows h.
  2. Process histories depth-first (L=1 first). For each history h of length L: a. Find parent history h[1..] and its assigned causal state S. b. KS-test: is h’s conditional distribution homogeneous with S? • Yes → assign h to S (add h’s counts to S’s pool). • No → search other states for a homogeneous match; else new state.
  3. Merge pass: collapse pairs of states that are now indistinguishable.
  4. Compact (remove empty states, re-index).

Structs§

CausalState
A causal state: an equivalence class of histories sharing the same conditional future distribution.
CssrResult
Output of a single CSSR run.

Functions§

build_suffix_stats
Build per-suffix next-symbol count vectors for all depths 1..=max_depth.
ks_reject_homogeneity
Two-sample KS test for discrete distributions.
run_cssr
Run CSSR on a discrete symbol sequence.