A structured variational learning approach for switching latent factor models