@@ -26,40 +26,29 @@ function Bijectors.bijector(model::NormalLogNormal)
26
26
[1 : 1 , 2 : 1 + length (μ_y)])
27
27
end
28
28
29
- function normallognormal_fullrank (rng:: Random.AbstractRNG , realtype:: Type )
30
- n_dims = 5
31
-
32
- μ_x = randn (rng, realtype)
33
- σ_x = ℯ
34
- μ_y = randn (rng, realtype, n_dims)
35
- L_y = tril (I + ones (realtype, n_dims, n_dims))/ 2
36
- Σ_y = L_y* L_y' |> Hermitian
37
-
38
- model = NormalLogNormal (μ_x, σ_x, μ_y, PDMat (Σ_y, Cholesky (L_y, ' L' , 0 )))
39
-
40
- Σ = Matrix {realtype} (undef, n_dims+ 1 , n_dims+ 1 )
41
- Σ[1 ,1 ] = σ_x^ 2
42
- Σ[2 : end ,2 : end ] = Σ_y
43
- Σ = Σ |> Hermitian
44
-
45
- μ = vcat (μ_x, μ_y)
46
- L = cholesky (Σ). L
47
-
48
- TestModel (model, μ, L, n_dims+ 1 , false )
29
+ function normallognormal_fullrank (:: Random.AbstractRNG , realtype:: Type )
30
+ n_y_dims = 5
31
+
32
+ σ0 = realtype (0.3 )
33
+ μ = Fill (realtype (5.0 ), n_y_dims+ 1 )
34
+ L = Matrix (σ0* I, n_y_dims+ 1 , n_y_dims+ 1 )
35
+ Σ = L* L' |> Hermitian
36
+
37
+ model = NormalLogNormal (
38
+ μ[1 ], L[1 ,1 ], μ[2 : end ], PDMat (Σ[2 : end ,2 : end ], Cholesky (L[2 : end ,2 : end ], ' L' , 0 ))
39
+ )
40
+ TestModel (model, μ, LowerTriangular (L), n_y_dims+ 1 , 1 / σ0^ 2 , false )
49
41
end
50
42
51
- function normallognormal_meanfield (rng:: Random.AbstractRNG , realtype:: Type )
52
- n_dims = 5
53
-
54
- μ_x = randn (rng, realtype)
55
- σ_x = ℯ
56
- μ_y = randn (rng, realtype, n_dims)
57
- σ_y = log .(exp .(randn (rng, realtype, n_dims)) .+ 1 )
43
+ function normallognormal_meanfield (:: Random.AbstractRNG , realtype:: Type )
44
+ n_y_dims = 5
58
45
59
- model = NormalLogNormal (μ_x, σ_x, μ_y, Diagonal (σ_y.^ 2 ))
46
+ σ0 = realtype (0.3 )
47
+ μ = Fill (realtype (5 ), n_y_dims + 1 )
48
+ σ = Fill (σ0, n_y_dims + 1 )
49
+ L = Diagonal (σ)
60
50
61
- μ = vcat (μ_x, μ_y)
62
- L = vcat (σ_x, σ_y) |> Diagonal
51
+ model = NormalLogNormal (μ[1 ], σ[1 ], μ[2 : end ], Diagonal (σ[2 : end ]. ^ 2 ))
63
52
64
- TestModel (model, μ, L, n_dims + 1 , true )
53
+ TestModel (model, μ, L, n_y_dims + 1 , 1 / σ0 ^ 2 , true )
65
54
end
0 commit comments