Efficient inference and sampling methods for probabilistic models