Initial state recognition in HMM
The Baum-Welch algorithm uses the EM (Expectation Maximization) algorithm to estimate the model parameters $(T, E, \pi)$, where:

$T$: the transition probabilities 
$E$: the emition probabilities 
$\pi$: probability distribution on the states 

Some years ago, I made the following quick-and-dirty implementation (may be fairly broken now), for the discrete case. 
Hope this helps.