Assignment

Given a string x, followed by the alphabet Σ from which x was constructed, followed by the states States, transition matrix Transition, and emission matrix Emission of an HMM (Σ, States, Transition, Emission).

Return the probability Pr(πi = k|x) that the HMM was in state k at step i (for each state k and each step i).

Example

>>> soft_decoding('yxz', 'xyz', 'AB', [[0.25781580389085273, 0.7421841961091472], [0.6220502902227053, 0.3779497097772947]], [[0.12871281587685687, 0.3979475788763271, 0.47333960524681606], [0.37116304784709164, 0.49694631193715255, 0.13189064021575572]])
[(0.5537809387128126, 0.44621906128718736), (0.15878596252444513, 0.8412140374755549), (0.807528821430867, 0.19247117856913287)]

>>> soft_decoding('zxxxyy', 'xyz', 'AB', [[0.832339416656808, 0.16766058334319192], [0.6363288730737235, 0.3636711269262765]], [[0.1573954342971829, 0.5581038769618685, 0.28450068874094875], [0.42880981244058525, 0.31091309875194634, 0.2602770888074683]])
[(0.4461279807148309, 0.5538720192851692), (0.4383147643241475, 0.5616852356758526), (0.4549498568357685, 0.5450501431642315), (0.5330328437390314, 0.46696715626096863), (0.8462350254593409, 0.15376497454065907), (0.8774863867912865, 0.12251361320871351)]