Context Tree Switching implementation
Formal methods. — 2025-10-13. — 1 tracing.
An implementation of the Context Tree Switching algorithm, written from scratch in Python for sequential-prediction research.
Context Tree Switching (CTS; Veness et al., 2012) is an algorithm for sequential prediction, and this project is an implementation of it written from scratch in Python.
It was written for sequential-prediction research, as part of work on AIXI.
Built with: Python.
Code: github.com/Enhso/cts
Tracings
Drawn from this record.
- F101Ensemble AI forecasting botForecasting
Both combine many predictors instead of trusting one. CTS mixes context models as data arrives; the bot combines forecasts from different personas.
Traced from
Records that point here.
- N105Why I’m interested in AI safetyNotes
AIXI is a mathematical model of an ideal agent. Implementing one of its building blocks was my way into the theory behind the systems this essay worries about.