first iteration of Baum-Welch