Training for HMM part3.