This code is a simple implementation of an HMM including Baum-Welche Training, Forward-Backward Algorithm, and Viterbi decoding for short and discrete obervation sequences.
The example implemented here is for a robot to localise when in a lift, stoppping at three floors STATES=['F1, 'F2', 'F3']
and observing a light on each floor OBS = ['L1', 'L2', 'L3']
, but that observation is being noisy, i.e. the robot might see the wrong light.
An example pre-defined HMM looks like this:
def example_hmm():
hmm = {