Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #215

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions test/mokernels/slfm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
x2 = MOInput([rand(rng, in_dim) for _ in 1:N], out_dim)

k = LatentFactorMOKernel(
[MaternKernel(), SqExponentialKernel(), FBMKernel()],
[Matern32Kernel(), SqExponentialKernel(), FBMKernel()],
IndependentMOKernel(GaussianKernel()),
rand(rng, out_dim, 3),
)
Expand All @@ -23,15 +23,15 @@
@test string(k) == "Semi-parametric Latent Factor Multi-Output Kernel"
@test repr("text/plain", k) == (
"Semi-parametric Latent Factor Multi-Output Kernel\n\tgᵢ: " *
"Matern Kernel (ν = 1.5)\n\t\tSquared Exponential Kernel\n" *
"Matern 3/2 Kernel\n\t\tSquared Exponential Kernel\n" *
"\t\tFractional Brownian Motion Kernel (h = 0.5)\n\teᵢ: " *
"Independent Multi-Output Kernel\n\tSquared Exponential Kernel"
)

# AD test
function test_slfm(A::AbstractMatrix, x1, x2)
k = LatentFactorMOKernel(
[MaternKernel(), SqExponentialKernel(), FBMKernel()],
[Matern32Kernel(), SqExponentialKernel(), FBMKernel()],
IndependentMOKernel(GaussianKernel()),
A,
)
Expand All @@ -40,8 +40,7 @@

a = rand()
@test all(
FiniteDifferences.j′vp(FDM, test_slfm, a, k.A, x1[1][1], x2[1][1]) .≈
FiniteDifferences.j′vp(FDM, test_slfm, a, k.A, x1[1][1], x2[1][1]) .≈
Zygote.pullback(test_slfm, k.A, x1[1][1], x2[1][1])[2](a)
)

)
end