added learning and marginals