Unsupervised learning with contrastive latent variable models