HMM adapters as Spec.Modules #
The HMM spec model (NN/Spec/Models/Hmm.lean) uses discrete observations (Fin nObservations).
For composition and examples, it is sometimes convenient to accept a tensor of scores/probabilities
over the observation alphabet and decode each timestep via argmax. The wrappers in this file
provide that bridge and package the resulting behavior as Spec.Modules.
Decode a single observation vector into a discrete symbol by taking argmax.
Instances For
Convert a tensor of per-symbol scores/probabilities into a discrete observation sequence by
decoding each timestep with argmax.
Instances For
A one-step HMM module: map an observation distribution to a filtered state distribution.
Instances For
Forward messages α_t for each timestep (scaled).
Instances For
Sequence module: compute forward messages α_t for each timestep.
Instances For
Sequence module: compute prefix likelihoods p(o₀:t) for each timestep t.
Instances For
Sequence module: normalized state probabilities at each timestep.
Instances For
Apply hmm independently at each timestep, using the initial distribution for every row.
Each row is decoded with argmax, as in the one-step module. The output contains filtered state
probabilities, with the same totalization for impossible observations as hmm.