|
86 | 86 | # @test rand(κ(1.1)) == 1.1
|
87 | 87 | # end
|
88 | 88 |
|
89 |
| -# @testset "SpikeMixture" begin |
90 |
| -# @test rand(SpikeMixture(Dirac(0), 0.5)) == 0 |
91 |
| -# @test rand(SpikeMixture(Dirac(1), 1.0)) == 1 |
92 |
| -# w = 1/3 |
93 |
| -# m = SpikeMixture(Normal(), w) |
94 |
| -# bm = basemeasure(m) |
95 |
| -# @test (bm.s*bm.w)*bm.m == 1.0*basemeasure(Normal()) |
96 |
| -# @test density(m, 1.0)*(bm.s*bm.w) == w*density(Normal(),1.0) |
97 |
| -# @test density(m, 0)*(bm.s*(1-bm.w)) ≈ (1-w) |
98 |
| -# end |
| 89 | +@testset "SpikeMixture" begin |
| 90 | + @test rand(SpikeMixture(Dirac(0), 0.5)) == 0 |
| 91 | + @test rand(SpikeMixture(Dirac(1), 1.0)) == 1 |
| 92 | + w = 1/3 |
| 93 | + m = SpikeMixture(d, w) |
| 94 | + bm = basemeasure(m) |
| 95 | + @test (bm.s*bm.w)*bm.m == 1.0*basemeasure(d) |
| 96 | + @test density(m, 1.0)*(bm.s*bm.w) ≈ w*density(d,1.0) |
| 97 | + @test density(m, 0)*(bm.s*(1-bm.w)) ≈ (1-w) |
| 98 | +end |
99 | 99 |
|
100 |
| -# @testset "Dirac" begin |
101 |
| -# @test rand(Dirac(0.2)) == 0.2 |
102 |
| -# @test logdensity(Dirac(0.3), 0.3) == 0.0 |
103 |
| -# @test logdensity(Dirac(0.3), 0.4) == -Inf |
104 |
| -# end |
| 100 | +@testset "Dirac" begin |
| 101 | + @test rand(Dirac(0.2)) == 0.2 |
| 102 | + @test logdensity(Dirac(0.3), 0.3) == 0.0 |
| 103 | + @test logdensity(Dirac(0.3), 0.4) == -Inf |
| 104 | +end |
105 | 105 |
|
106 | 106 | # @testset "For" begin
|
107 | 107 | # FORDISTS = [
|
|
0 commit comments