Inference of collective Gaussian hidden Markov models