I heard about ubers pyro and stumbled upon this Wikipedia article.

As I understand, a bayesian network is the same as a belief network according to this post.

Does someone know how these are related?


1 Answer 1


A probabilistic program and a Bayesian Network are both ways of specifying probabilistic models. Any model that can be specified as a Bayesian Network can also be specified by a probabilistic program, in fact by a probabilistic program that has no control flow. Roughly

Bayes Nets == Straight line Probabilistic Programs

For example consider the Bayes Netenter image description here

This Bayes Net is equivalent to the probabilistic program (in Pyro)

def model():
    p_rain = pyro.param("p_rain", torch.tensor(0.2), constraint=unit_interval)
    p_sprinkler = pyro.param("p_sprinkler", torch.tensor([0.4, 0.01]),
    p_wet = pyro.param("p_wet", torch.tensor([[0.0, 0.9], [0.8, 0.99]]),

    rain = pyro.sample("rain", Bernoulli(p_rain))
    sprinkler = pyro.sample("sprinkler",
    wet = pyro.sample("wet", Bernoulli(p_wet[rain.long(), sprinkler.long()]))

More generally, probabilistic programs can contain control flow (if, for, while) and recursion. Some of these extra features are expressed in extensions to Bayes nets, e.g. some for loops can be expressed as plates in Bayes Nets.

  • 2
    $\begingroup$ What's the point of p_rain? It's never used. Should it be removed, since rain defined further down seems to be the important version. $\endgroup$
    – beldaz
    Commented Mar 24, 2019 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.