1
- @testitem " mean(::ClosedWilliamsProduct, q::Exponential, p::typeof(identity) )" begin
1
+ @testitem " mean(::ClosedWilliamsProduct, p::log, q::Exponential )" begin
2
2
using Distributions
3
3
using ClosedFormExpectations
4
4
using StableRNGs
16
16
N = 10 ^ 6
17
17
samples = rand (rng, Exponential (λ), 10 ^ 6 )
18
18
williams_product = map (x -> score (Exponential (λ), x)* log (x), samples)
19
- expectation = mean (ClosedWilliamsProduct (), identity , Exponential (λ))
19
+ expectation = mean (ClosedWilliamsProduct (), log , Exponential (λ))
20
20
@test sigma_rule (expectation, mean (williams_product), std (williams_product), N)
21
21
end
22
22
end
23
23
24
- @testitem " mean(::ClosedWilliamsProduct, q::Exponential, p::ExpLogSquare )" begin
24
+ @testitem " mean(::ClosedWilliamsProduct, p::ExpLogSquare, q::Exponential )" begin
25
25
using Distributions
26
26
using ClosedFormExpectations
27
27
using StableRNGs
42
42
samples = rand (rng, Exponential (λ), 10 ^ 6 )
43
43
fn (x) = (log ∘ ExpLogSquare (μ, σ))(x)
44
44
williams_product = map (x -> score (Exponential (λ), x)* fn (x), samples)
45
- expectation = mean (ClosedWilliamsProduct (), ExpLogSquare (μ, σ), Exponential (λ))
45
+ expectation = mean (ClosedWilliamsProduct (), log ∘ ExpLogSquare (μ, σ), Exponential (λ))
46
46
@test sigma_rule (expectation, mean (williams_product), std (williams_product), N)
47
47
end
48
48
end
49
49
50
- @testitem " mean(::ClosedWilliamsProduct, q::Exponential, p::LogNormal )" begin
50
+ @testitem " mean(::ClosedWilliamsProduct, f::Logpdf{LogNormal}, q::Exponential )" begin
51
51
using Distributions
52
52
using ClosedFormExpectations
53
53
using StableRNGs
68
68
samples = rand (rng, Exponential (λ), 10 ^ 6 )
69
69
fn (x) = logpdf (LogNormal (μ, σ), x)
70
70
williams_product = map (x -> score (Exponential (λ), x)* fn (x), samples)
71
- expectation = mean (ClosedWilliamsProduct (), LogNormal (μ, σ), Exponential (λ))
71
+ expectation = mean (ClosedWilliamsProduct (), Logpdf ( LogNormal (μ, σ) ), Exponential (λ))
72
72
@test sigma_rule (expectation, mean (williams_product), std (williams_product), N)
73
73
end
74
74
end
90
90
samples = rand (rng, Exponential (λ1), N)
91
91
fn (x) = logpdf (Exponential (λ2), x)
92
92
williams_product = map (x -> score (Exponential (λ1), x)* fn (x), samples)
93
- @test sigma_rule (mean (ClosedWilliamsProduct (), Exponential (λ2), Exponential (λ1)), mean (williams_product), std (williams_product), N)
93
+ expectation = mean (ClosedWilliamsProduct (), Logpdf (Exponential (λ2)), Exponential (λ1))
94
+ @test sigma_rule (expectation, mean (williams_product), std (williams_product), N)
94
95
end
95
96
end
0 commit comments