reasoning under uncertainty import random from probstochsim import sample_onesample_multiple class hmm(object)def __init__(selfstatesobsvarspobstransindist)""" hidden markov model states set of states obsvars set of observation variables pobs probability of observationspobs[ ][sis (obs_i=true state=strans transition probability trans[ ][jgives (state= state=iindist initial distribution indist[sis (state_ ""self states states self obsvars obsvars self pobs pobs self trans trans self indist indist consider the following example suppose you want to unobtrusively keep track of an animal in triangular enclosure using sound suppose you have microphones that provide unreliable (noisybinary information at each time step the animal is either close to one of the points of the triangle or in the middle of the triangle probhmm py -(continued state =middle , , are corners states {'middle'' '' '' 'states obs {' ',' ',' 'microphones the observation model is as follows if the animal is in cornerit will be detected by the microphone at that corner with probability and will be independently detected by each of the other microphones with probability of if the animal is in the middleit will be detected by each microphone with probability of probhmm py -(continued pobs gives the observation model#pobs[mi][stateis (mi=on stateclosemic= farmic= midmic= pobs {' ':{'middle':midmic' ':closemic' ':farmic' ':farmic}mic ' ':{'middle':midmic' ':farmic' ':closemic' ':farmic}mic ' ':{'middle':midmic' ':farmic' ':farmic' ':closemic}mic the transition model is as followsif the animal is in corner it stays in the same corner with probability goes to the middle with probability version june