We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18d8ff3 commit 0f58523Copy full SHA for 0f58523
test/bijector.jl
@@ -0,0 +1,28 @@
1
+
2
+@testset "bijector.jl" begin
3
+ @testset "bijector" begin
4
+ @model function test()
5
+ m ~ Normal()
6
+ s ~ InverseGamma(3, 3)
7
+ return c ~ Dirichlet([1.0, 1.0])
8
+ end
9
10
+ m = test()
11
+ b = bijector(m)
12
13
+ # m ∈ ℝ, s ∈ ℝ+, c ∈ 2-simplex
14
+ # check dimensionalities and ranges
15
+ @test b.length_in == 4
16
+ @test b.length_out == 3
17
+ @test b.ranges_in == [1:1, 2:2, 3:4]
18
+ @test b.ranges_out == [1:1, 2:2, 3:3]
19
20
21
+ # check support of mapped variables
22
+ binv = inverse(b)
23
+ zs = mapslices(binv, randn(b.length_out, 10000); dims=1)
24
25
+ @test all(zs[2, :] .≥ 0)
26
+ @test all(sum(zs[3:4, :]; dims=1) .≈ 1.0)
27
28
+end
0 commit comments