ctbn.plotFollowVar
- pyagrum.ctbn.plotFollowVar(v, trajectories, timeHorizon=None, N=None, plotname=None)
Plot the evolution (the proportions of the states the variable transition into) of a variable over time.
- Parameters:
v (
pyagrum.DiscreteVariable) – The variable to follow.trajectories (
dict[int,list[tuple[float,str,str]]]) – Contains trajectories. The result is a mean over all the trajectories.timeHorizon (
float) – Maximum time length to plot. If None, then the entire time length of the trajectories is used.N (
int) – Number of division of interval [0, timeHorizon].plotname (
str) – Name of the plot. If None, the picked name is “Proportions for each state of {v.name()}”.
Example
import pyagrum as gum
import pyagrum.ctbn as ct
data = {
0: [
(0.0, "A", "a0"),
(0.0, "B", "b0"),
(1.0, "A", "a0"),
(2.0, "B", "b0"),
(3.0, "A", "a1"),
(4.0, "A", "a0"),
(4.0, "B", "b1"),
]
}
ctbn = ct.CTBN()
ctbn.add(gum.LabelizedVariable("A", "A", ["a0", "a1"]))
ctbn.add(gum.LabelizedVariable("B", "B", ["b0", "b1"]))
ctbn.addArc("A", "B")
ct.plotFollowVar(ctbn.variable("A"), data, timeHorizon=4.0, N=8)