Book Image

Mastering Probabilistic Graphical Models with Python

By : Ankur Ankan
Book Image

Mastering Probabilistic Graphical Models with Python

By: Ankur Ankan

Overview of this book

Table of Contents (14 chapters)
Mastering Probabilistic Graphical Models Using Python
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Conditional probability distribution


Until now, we have only discussed computing the marginal probability of the form P(Y= y) over variables, but in the real world, we are mostly working with conditional probability distributions rather than marginal distributions. Now, with sampling methods, we have multiple ways of approaching the problem of conditional distributions, but all of them turn out to be significantly harder than computing marginals.

Let's say we want to compute the probability of P(y|E = e). The first approach that we can think of is to generate particles normally from the distribution and then reject the samples that don't satisfy the condition E = e. This method is known as rejection sampling. However, with this method, we will be wasting a lot of particles and thus increasing the computational cost. The real problem arises when the probability values of these events are very low. So, let's say P(E = e) = 0.005 and we generate 10,000 samples. Then we will have only around...