Module ctw

Module ctw 

Source
Expand description

Context Tree Weighting (CTW) and Factorized Action-Conditional CTW (FAC-CTW).

This implementation stores maximal non-root unary runs as chains while keeping the root and true branching points explicit. Updates and reverts rebuild only the touched context path from exact per-node state, which preserves predictive semantics while avoiding the O(depth) explicit-node blow-up for singleton paths.

Structsยง

ContextTree
A Context Tree for binary sequence prediction.
CtArena
Arena allocator and storage for CTW nodes/segments.
CtNode
Compact node payload used by CtArena.
FacContextTree
Factorized Action-Conditional Context Tree Weighting.
NodeIndex
Index into the explicit-node arena.