| 20 | |
| 21 | @image_comparison(baseline_images=["classic"], extensions=["png"]) |
| 22 | def 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"]) |