Representation learning on sequential data with latent priors