Skip to content
Part IA Lent Term

Time-Aware HMMs with Compound States

Problem

Stationarity fails when transitions differ by season. In the 2024 Q8 weather HMM, P(NFF)P(\text{NF} \to F) is much higher in October (heading into winter) than in April (heading into summer). The standard model averages these together, giving a single number that is wrong in both seasons.

Solution: Compound States

Rather than abandoning the stationary HMM formalism, change the definition of the state space to encode time information. Create compound states that pair the original state with a temporal marker.

Original: S={Freezing(F), NotFreezing(NF)}S = \{\text{Freezing}(F),\ \text{NotFreezing}(NF)\}

Transition matrix AA is 2×22 \times 2. All months share the same transitions. Seasonality is averaged away.

New: S={FSummer, FWinter, NFSummer, NFWinter}S = \{F_{\text{Summer}},\ F_{\text{Winter}},\ NF_{\text{Summer}},\ NF_{\text{Winter}}\}

Transition matrix AA is 4×44 \times 4. Transitions are now season-specific. The stationary assumption still holds within each compound state, but the richer state space captures the seasonal differences.

Data Transformation

Label each month with its season. For UK weather: October–March is Winter, April–September is Summer. Relabel each state-timestep pair:

MonthOriginal StateSeasonCompound State
OctNFWinterNFW\text{NF}_W
NovNFWinterNFW\text{NF}_W
DecFWinterFWF_W
JanFWinterFWF_W
FebFWinterFWF_W
MarNFWinterNFW\text{NF}_W
AprFSummerFSF_S
MayNFSummerNFS\text{NF}_S
JunNFSummerNFS\text{NF}_S

(For illustration; the 2024 solution uses three seasons: Autumn, Winter, Spring, Summer.)

Re-Estimate Parameters

Count transitions and emissions from the relabelled data as usual. The critical outcome:

P(NFSummerFSummer)P(NFWinterFWinter)P(\text{NF}_{\text{Summer}} \to F_{\text{Summer}}) \ll P(\text{NF}_{\text{Winter}} \to F_{\text{Winter}})

During Summer, transitioning from NotFreezing to Freezing is extremely unlikely (perhaps even zero). During Winter, it is substantially more likely. The compound-state model captures this because aNFW,FWa_{\text{NF}_W, F_W} and aNFS,FSa_{\text{NF}_S, F_S} are estimated from different subsets of the training data — the winter months and the summer months, respectively.

2024 Q8 Solution Matrices

The official solution uses five compound states: NFA\text{NF}_A (Autumn), FWF_W, NFSp\text{NF}_{\text{Sp}}, FSpF_{\text{Sp}}, NFSu\text{NF}_{\text{Su}}. Transition matrix:

From / ToNFA\text{NF}_AFWF_WNFSp\text{NF}_{\text{Sp}}FSpF_{\text{Sp}}NFSu\text{NF}_{\text{Su}}
NFA\text{NF}_A1/21/2000
FWF_W02/31/300
NFSp\text{NF}_{\text{Sp}}0001/21/2
FSpF_{\text{Sp}}00100
NFSu\text{NF}_{\text{Su}}00000

The emission matrix BB is similarly re-estimated per compound state. The model now predicts: July with NFSu\text{NF}_{\text{Su}} is always Dry; snow is only possible from FWF_W; transitions follow the seasonal calendar.

Choosing the Right Granularity

Adding individual months (12 compound states) creates too much sparsity: “February is freezing” appears exactly once, so P(FebruaryMarch)P(\text{February} \to \text{March}) is unreliable. Grouping into 2–4 seasons is the sweet spot — enough data per state for reliable estimates while still capturing seasonal variation.

Trade-offs

AspectOriginal HMMCompound-State HMM
States{F,NF}\{F, NF\}{FW,NFW,FS,NFS}\{F_W, NF_W, F_S, NF_S\}
AA size2×22 \times 24×44 \times 4 (or larger)
Data per stateAll months pooledOnly months in that season
SeasonalityAveraged away, wrong everywhereCaptured explicitly
Sparsity riskLowHigher (fewer data per state)
Predictive accuracyPoor in transitional seasonsBetter across all seasons

General Principle

Compound states are the standard exam technique for injecting time-awareness into a stationary HMM. The trick is not to modify the HMM mathematics (the model remains a standard stationary HMM) but rather to redefine the state space so that the stationary assumption plausibly holds within each new state. The richer state space encodes the temporal information that the original model averaged away.

Summary

AspectKey Point
ProblemStationarity fails — different transitions per season
SolutionCompound states = original state ×\times season
TransformationRelabel each (t,state)(t, \text{state}) pair with its season
Key resultP(NFSFS)P(NFWFW)P(\text{NF}_S \to F_S) \ll P(\text{NF}_W \to F_W)
GranularitySeasons (2–4 groups), not individual months (too sparse)

Past paper questions: y2024p3q8