lib.notebook.showInference
- pyagrum.lib.notebook.showInference(model, **kwargs)
show pydot graph for an inference in a notebook
- Parameters:
model (
pyagrum.GraphicalModel) – the model in which to infer (pyagrum.BayesNet,pyagrum.MarkovRandomFieldorpyagrum.InfluenceDiagram)engine (
pyagrum.BNInference | pyagrum.MRFInference | pyagrum.CNInference | pyagrum.IDInference) – inference algorithm used. If None,pyagrum.LazyPropagationwill be used for BayesNet,pyagrum.ShaferShenoyMRFInferenceforpyagrum.MarkovRandomFieldandpyagrum.ShaferShenoyLIMIDInferenceforpyagrum.InfluenceDiagram.evs (
dict[int | str,int | str | list[float]]) – map of evidencetargets (
Set[str]) – set of targetssize (
string) – size (for graphviz) of the rendered graphnodeColor (
dict[str,float]) – a nodeMap of values (between 0 and 1) to be shown as color of nodes (with special colors for 0 and 1)factorColor (
dict[int,float]) – a nodeMap of values (between 0 and 1) to be shown as color of factors (in MarkovRandomField representation)arcWidth (:
dict[(str,str),float]) – an arcMap of values to be shown as width of arcsarcColor (:
dict[(str,str),float]) – a arcMap of values (between 0 and 1) to be shown as color of arcscmapNode (
matplotlib.ColorMap) – map to show the color of nodes and arcscmapArc (
matplotlib.ColorMap) – color map to show the vals of Arcs.graph (
pyagrum.Graph) – only shows nodes that have their id in the graph (and not in the whole BN)view (
str) – graph | factorgraph | None (default) for Markov random field
- Return type:
None- Returns:
the desired representation of the inference
Example
import pyagrum as gum
import pyagrum.lib.notebook as gnb
bn = gum.fastBN("A->B->C")
gnb.showInference(bn, evs={"A": 1}, targets={"C"})