HMM adapters as NNModuleSpecs #
The HMM spec model (NN/Spec/Models/Hmm.lean) uses discrete observations (Fin nObservations).
For composition and demos, 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 NNModuleSpecs.
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
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
Sequence module: apply the one-step update independently at each timestep.