|
1 | 1 | @testset "GaussianLikelihood" begin
|
2 |
| - rng = MersenneTwister(123) |
3 |
| - gp = GP(SqExponentialKernel()) |
4 |
| - x = rand(rng, 10) |
5 |
| - y = rand(rng, 10) |
6 | 2 | lik = GaussianLikelihood(1e-5)
|
7 |
| - lgp = LatentGP(gp, lik, 1e-5) |
8 |
| - lfgp = lgp(x) |
9 |
| - |
10 |
| - @test lik(rand(rng, lfgp.fx)) isa Distribution |
11 |
| - @test length(rand(rng, lik(rand(rng, lfgp.fx)))) == 10 |
12 |
| - @test keys(Functors.functor(lik)[1]) == (:σ²,) |
| 3 | + test_interface(lik, SqExponentialKernel(), rand(10); functor_args=(:σ²,)) |
13 | 4 | end
|
14 | 5 |
|
15 | 6 | @testset "HeteroscedasticGaussianLikelihood" begin
|
16 |
| - rng = MersenneTwister(123) |
17 |
| - gp = GP(IndependentMOKernel(SqExponentialKernel())) |
| 7 | + lik = HeteroscedasticGaussianLikelihood() |
18 | 8 | IN_DIM = 3
|
19 | 9 | OUT_DIM = 2 # one for the mean the other for the log-standard deviation
|
20 | 10 | N = 10
|
21 |
| - x = [rand(rng, IN_DIM) for _ in 1:N] |
22 |
| - X = MOInput(x, OUT_DIM) |
23 |
| - lik = HeteroscedasticGaussianLikelihood() |
24 |
| - lgp = LatentGP(gp, lik, 1e-5) |
25 |
| - lfgp = lgp(X) |
26 |
| - |
27 |
| - Y = rand(rng, lfgp.fx) |
28 |
| - |
29 |
| - y = [Y[[i + j*N for j in 0:(OUT_DIM - 1)]] for i in 1:N] |
30 |
| - # Replace with mo_inverse_transform once it is merged |
31 |
| - |
32 |
| - @test lik(y) isa Distribution |
33 |
| - @test length(rand(rng, lik(y))) == 10 |
34 |
| - @test Functors.functor(lik)[1] == () |
| 11 | + X = MOInput([rand(IN_DIM) for _ in 1:N], OUT_DIM) |
| 12 | + test_interface(lik, IndependentMOKernel(SqExponentialKernel()), X) |
35 | 13 | end
|
0 commit comments