Generative modeling of repositories of health records for predictive tasks