|
10 | 10 |
|
11 | 11 | @testset "Variational Message Passing: (q_out::Categorical)" begin |
12 | 12 | @test_rules [check_type_promotion = false] Categorical(:p, Marginalisation) [(input = (q_out = Categorical([0.0, 1.0]),), output = Dirichlet([1.0, 2.0]))] |
| 13 | + @test_rules [check_type_promotion = false] Categorical(:p, Marginalisation) [(input = (q_out = Categorical([0.5, 0.5]),), output = Dirichlet([1.5, 1.5]))] |
13 | 14 | end |
14 | 15 |
|
15 | 16 | # Test if the input q_out for the outgoing message towards p edge is not a scalar |
|
20 | 21 | end |
21 | 22 |
|
22 | 23 | # Test if the input q_out for the outgoing message towards p edge is a one-hot encoded vector |
23 | | - @testset "q_out =?= one-hot encoded vector" begin |
| 24 | + @testset "q_out = PointMass one-hot encoded vector" begin |
24 | 25 | # PointMass over a non-one-hot vector |
25 | | - @test_throws ArgumentError @call_rule Categorical(:p, Marginalisation) (q_out = PointMass([0.5, 0.5]),) |
26 | | - @test_throws ArgumentError @call_rule Categorical(:p, Marginalisation) (q_out = PointMass([1.0, 1.0]),) |
27 | | - # Categorical with non-one-hot probability vector |
28 | | - @test_throws ArgumentError @call_rule Categorical(:p, Marginalisation) (q_out = Categorical([0.3, 0.7]),) |
| 26 | + @test_throws "q_out must be one-hot encoded" @call_rule Categorical(:p, Marginalisation) (q_out = PointMass([0.5, 0.5]),) |
| 27 | + @test_throws "q_out must be one-hot encoded" @call_rule Categorical(:p, Marginalisation) (q_out = PointMass([1.0, 1.0]),) |
29 | 28 | # Arbitrary non-distribution |
30 | | - @test_throws ArgumentError @call_rule Categorical(:p, Marginalisation) (q_out = Dirichlet([1.0, 2.0]),) |
| 29 | + @test_throws "This rule is only defined for PointMass over a one-hot vector" @call_rule Categorical(:p, Marginalisation) (q_out = "Hello?",) |
31 | 30 | end |
32 | 31 | end |
0 commit comments