MCPcopy Create free account
hub / github.com/daft-dev/daft / test_classic

Function test_classic

test/test_examples.py:22–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21@image_comparison(baseline_images=["classic"], extensions=["png"])
22def test_classic():
23 pgm = daft.PGM()
24
25 # Hierarchical parameters.
26 pgm.add_node("alpha", r"$\alpha$", 0.5, 2, fixed=True)
27 pgm.add_node("beta", r"$\beta$", 1.5, 2)
28
29 # Latent variable.
30 pgm.add_node("w", r"$w_n$", 1, 1)
31
32 # Data.
33 pgm.add_node("x", r"$x_n$", 2, 1, observed=True)
34
35 # Add in the edges.
36 pgm.add_edge("alpha", "beta")
37 pgm.add_edge("beta", "w")
38 pgm.add_edge("w", "x")
39 pgm.add_edge("beta", "x")
40
41 # And a plate.
42 pgm.add_plate([0.5, 0.5, 2, 1], label=r"$n = 1, \cdots, N$", shift=-0.1)
43
44 pgm.render()
45
46
47@image_comparison(baseline_images=["deconvolution"], extensions=["png"])

Callers

nothing calls this directly

Calls 4

add_nodeMethod · 0.95
add_edgeMethod · 0.95
add_plateMethod · 0.95
renderMethod · 0.95

Tested by

no test coverage detected