Example #1
0
def coin_flip_pgm():
    G = PGM()
    G.add_node("alpha", content=r"$\alpha$", x=-1, y=1, scale=1.2, fixed=True)
    G.add_node("beta", content=r"$\beta$", x=1, y=1, scale=1.2, fixed=True)
    G.add_node("p", content="p", x=0, y=1, scale=1.2)
    G.add_node("result", content="result", x=0, y=0, scale=1.2, observed=True)
    G.add_edge("alpha", "p")
    G.add_edge("beta", "p")
    G.add_edge("p", "result")
    G.show()
def ice_cream_one_group_pgm():
    G = PGM()
    G.add_node("alpha", content=r"$\alpha$", x=-1, y=1, scale=1.2, fixed=True)
    G.add_node("beta", content=r"$\beta$", x=1, y=1, scale=1.2, fixed=True)

    G.add_node("p", content="p", x=0, y=1, scale=1.2)
    G.add_node("likes", content="l", x=0, y=0, scale=1.2, observed=True)
    G.add_edge("alpha", "p")
    G.add_edge("beta", "p")
    G.add_edge("p", "likes")
    G.show()
def ice_cream_n_group_pgm():
    G = PGM()
    G.add_node("alpha", content=r"$\alpha$", x=-1, y=1, scale=1.2, fixed=True)
    G.add_node("beta", content=r"$\beta$", x=1, y=1, scale=1.2, fixed=True)

    G.add_node("p", content=r"$p_{i}$", x=0, y=1, scale=1.2)
    G.add_node("likes", content=r"$l_{i}$", x=0, y=0, scale=1.2, observed=True)
    G.add_edge("alpha", "p")
    G.add_edge("beta", "p")
    G.add_edge("p", "likes")
    G.add_plate([-0.5, -0.8, 1, 2.3], label=r"shop $i$")
    G.show()
Example #4
0
def korea_pgm():
    G = PGM()
    G.add_node("s_mean", r"$\mu_{s}$", x=0, y=1)
    G.add_node("s_scale", r"$\sigma_{s}$", x=1, y=1)
    G.add_node("s_height", r"$h_s$", x=0.5, y=0)
    G.add_edge("s_mean", "s_height")
    G.add_edge("s_scale", "s_height")

    G.add_node("n_mean", r"$\mu_{n}$", x=2, y=1)
    G.add_node("n_scale", r"$\sigma_{n}$", x=3, y=1)
    G.add_node("n_height", r"$h_n$", x=2.5, y=0)
    G.add_edge("n_mean", "n_height")
    G.add_edge("n_scale", "n_height")

    G.show()
Example #5
0
def car_crash_pgm():
    G = PGM()
    G.add_node("crashes", content="crashes", x=0, y=0, scale=1.5)
    G.add_node("rate", content="rate", x=0, y=1, scale=1.5)
    G.add_edge("rate", "crashes")
    G.show()