1

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?

Ethan
  • 1,625
  • 8
  • 23
  • 39

1 Answers1

3

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]),
                             constraint=unit_interval)
    p_wet = pyro.param("p_wet", torch.tensor([[0.0, 0.9], [0.8, 0.99]]),
                       constraint=unit_interval)

    rain = pyro.sample("rain", Bernoulli(p_rain))
    sprinkler = pyro.sample("sprinkler",
                            Bernoulli(p_sprinkler[rain.long()]))
    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.

fritzo
  • 236
  • 1
  • 3
  • 2
    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. – beldaz Mar 24 '19 at 23:55