New Techniques for Learning and Inference in Bayesian Models