|
34 | 34 | @test mean(mean, samples) ≈ μ atol = 0.05 |
35 | 35 | @test mean(var, samples) ≈ σ² atol = 0.05 |
36 | 36 | end |
| 37 | + |
| 38 | + # initial parameter |
| 39 | + init_x = randn() |
| 40 | + samples = sample(ESSModel(prior, ℓ), ESS(), 10; progress=false, init_params=init_x) |
| 41 | + @test first(samples) == init_x |
37 | 42 | end |
38 | 43 |
|
39 | 44 | @testset "Scalar model with nonzero mean" begin |
|
62 | 67 | @test mean(mean, samples) ≈ μ atol = 0.05 |
63 | 68 | @test mean(var, samples) ≈ σ² atol = 0.05 |
64 | 69 | end |
| 70 | + |
| 71 | + # initial parameter |
| 72 | + init_x = randn() |
| 73 | + samples = sample(ESSModel(prior, ℓ), ESS(), 10; progress=false, init_params=init_x) |
| 74 | + @test first(samples) == init_x |
65 | 75 | end |
66 | 76 |
|
67 | 77 | @testset "Scalar model (vectorized)" begin |
|
91 | 101 | @test mean(mean, samples) ≈ μ atol = 0.05 |
92 | 102 | @test mean(var, samples) ≈ σ² atol = 0.05 |
93 | 103 | end |
| 104 | + |
| 105 | + # initial parameter |
| 106 | + init_x = randn(1) |
| 107 | + samples = sample( |
| 108 | + ESSModel(prior, ℓvec), ESS(), 10; progress=false, init_params=init_x |
| 109 | + ) |
| 110 | + @test first(samples) == init_x |
94 | 111 | end |
95 | 112 |
|
96 | 113 | @testset "Scalar model with nonzero mean (vectorized)" begin |
|
120 | 137 | @test mean(mean, samples) ≈ μ atol = 0.05 |
121 | 138 | @test mean(var, samples) ≈ σ² atol = 0.05 |
122 | 139 | end |
| 140 | + |
| 141 | + # initial parameter |
| 142 | + init_x = randn(1) |
| 143 | + samples = sample( |
| 144 | + ESSModel(prior, ℓvec), ESS(), 10; progress=false, init_params=init_x |
| 145 | + ) |
| 146 | + @test first(samples) == init_x |
123 | 147 | end |
124 | 148 | end |
0 commit comments