implemented baum-welch