Module ctw

Module ctw 

Source
Expand description

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

This module implements both the standard CTW algorithm for binary sequence prediction and the FAC-CTW variant described in Veness et al. (2011) for agent-based prediction.

§Arena Allocator

For performance with deep trees (D > 64), nodes are stored in a flat arena using indices rather than Box pointers, eliminating pointer chasing and improving cache locality.

§Shared History Optimization (FAC-CTW)

FAC-CTW uses k trees that share the same base history. Rather than duplicating the history k times, a single shared history is maintained with per-tree length tracking.

Structs§

ContextTree
A Context Tree for binary sequence prediction using arena allocation.
CtArena
Arena allocator for context tree nodes.
CtNode
A node in the Context Tree, stored in an arena.
FacContextTree
Factorized Action-Conditional Context Tree Weighting.
NodeIndex
Index into the node arena. NONE indicates no child.