Assignment

Given a sequence of emitted symbols x = x1 . . . xn in an alphabet A, generated by a k-state HMM with unknown transition and emission probabilities, initial Transition and Emission matrices and a number of iterations I.

Return a matrix of transition probabilities Transition and a matrix of emission probabilities Emission that maximizes Pr(x,π) over all possible transition and emission matrices and over all hidden paths π.

Example

>>> baum_welch_learning(150, 'yxz', 'xyz', 'AB', [[0.25781580389085273, 0.7421841961091472], [0.6220502902227053, 0.3779497097772947]], [[0.12871281587685687, 0.3979475788763271, 0.47333960524681606], [0.37116304784709164, 0.49694631193715255, 0.13189064021575572]])
([[0.0, 1.0], [1.0, 0.0]], [[0.0, 0.5, 0.5], [1.0, 0.0, 0.0]])

>>> baum_welch_learning(150, 'zxxxyy', 'xyz', 'AB', [[0.832339416656808, 0.16766058334319192], [0.6363288730737235, 0.3636711269262765]], [[0.1573954342971829, 0.5581038769618685, 0.28450068874094875], [0.42880981244058525, 0.31091309875194634, 0.2602770888074683]])
([[1.0, 0.0], [1.0, 0.0]], [[0.6000000000000001, 0.3999999999999999, 1.345379207068613e-102], [0.0, 0.0, 1.0]])