Unsupervised learning and variational inference