lib.notebook.getPosterior

pyagrum.lib.notebook.getPosterior(bn, evs, target)

shortcut for getProba(pyagrum.getPosterior(bn,evs,target))

Parameters:
  • bn (pyagrum.BayesNet) – the BayesNet

  • evs (dict[int | str, int | str | list[float]]) – map of evidence

  • target (int | str) – name of target variable

Return type:

str

Returns:

the HTML representation of the posterior

Example

import pyagrum as gum
import pyagrum.lib.notebook as gnb

bn = gum.fastBN("A->B->C")
html = gnb.getPosterior(bn, evs={"A": 1}, target="C")  # the histogram as an HTML image
html.startswith("<img")
# True