Skip to content

Commit 67e8602

Browse files
committed
Separate parameter tests
1 parent e2b3535 commit 67e8602

16 files changed

+41
-73
lines changed

test/basekernels/constant.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
@test metric(ConstantKernel()) == KernelFunctions.Delta()
2727
@test metric(ConstantKernel(c=2.0)) == KernelFunctions.Delta()
2828
@test repr(k) == "Constant Kernel (c = $(c))"
29+
test_params(kc, ([c],))
2930
test_ADs(c->ConstantKernel(c=first(c)), [c])
3031
end
3132
end

test/basekernels/exponential.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
@test KernelFunctions.iskroncompatible(k) == true
4141
test_ADs-> GammaExponentialKernel(gamma=first(γ)), [γ], ADs = [:ForwardDiff, :ReverseDiff])
4242
@test_broken "Zygote gradient given γ"
43+
test_params(k, ([γ],))
4344
#Coherence :
4445
@test GammaExponentialKernel=1.0)(v1,v2) SqExponentialKernel()(v1,v2)
4546
@test GammaExponentialKernel=0.5)(v1,v2) ExponentialKernel()(v1,v2)

test/basekernels/fbm.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@
2424
@test repr(k) == "Fractional Brownian Motion Kernel (h = $(h))"
2525
test_ADs(FBMKernel, ADs = [:ReverseDiff])
2626
@test_broken "Tests failing for kernelmatrix(k, x) for ForwardDiff and Zygote"
27+
28+
test_params(k, ([h],))
2729
end

test/basekernels/maha.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
@test repr(k) == "Mahalanobis Kernel (size(P) = $(size(P)))"
1414
# test_ADs(P -> MahalanobisKernel(P), P)
1515
@test_broken "Nothing passes (problem with Mahalanobis distance in Distances)"
16+
17+
test_params(k, (P,))
1618
end

test/basekernels/matern.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@test repr(k) == "Matern Kernel (ν = $(ν))"
1717
# test_ADs(x->MaternKernel(nu=first(x)),[ν])
1818
@test_broken "All fails (because of logabsgamma for ForwardDiff and ReverseDiff and because of nu for Zygote)"
19+
test_params(k, ([ν],))
1920
end
2021
@testset "Matern32Kernel" begin
2122
k = Matern32Kernel()

test/basekernels/periodic.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
@test repr(k) == "Periodic Kernel, length(r) = $(length(r)))"
1010
# test_ADs(r->PeriodicKernel(r =exp.(r)), log.(r), ADs = [:ForwardDiff, :ReverseDiff])
1111
@test_broken "Undefined adjoint for Sinus metric, and failing randomly for ForwardDiff and ReverseDiff"
12+
test_params(k, (r,))
1213
end

test/basekernels/piecewisepolynomial.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@
3434
@test repr(k) == "Piecewise Polynomial Kernel (v = $(v), size(maha) = $(size(maha)))"
3535
# test_ADs(maha-> PiecewisePolynomialKernel(v=2, maha = maha), maha)
3636
@test_broken "Nothing passes (problem with Mahalanobis distance in Distances)"
37+
38+
test_params(k, (maha,))
3739
end

test/basekernels/polynomial.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
@test metric(LinearKernel(c=2.0)) == KernelFunctions.DotProduct()
1414
@test repr(k) == "Linear Kernel (c = 0.0)"
1515
test_ADs(x->LinearKernel(c=x[1]), [c])
16+
test_params(LinearKernel(; c=c), ([c],))
1617
end
1718
@testset "PolynomialKernel" begin
1819
k = PolynomialKernel()
@@ -27,5 +28,6 @@
2728
@test metric(PolynomialKernel(d=3.0,c=2.0)) == KernelFunctions.DotProduct()
2829
# test_ADs(x->PolynomialKernel(d=x[1], c=x[2]),[2.0, c])
2930
@test_broken "All, because of the power"
31+
test_params(PolynomialKernel(; d=x[1], c=x[2]), ([x[1]], [x[2]]))
3032
end
3133
end

test/basekernels/rationalquad.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
@test metric(RationalQuadraticKernel=2.0)) == SqEuclidean()
1515
@test repr(k) == "Rational Quadratic Kernel (α = $(α))"
1616
test_ADs(x->RationalQuadraticKernel(alpha=x[1]),[α])
17+
test_params(k, ([α],))
1718
end
1819
@testset "GammaRationalQuadraticKernel" begin
1920
k = GammaRationalQuadraticKernel()
@@ -30,5 +31,6 @@
3031
@test metric(GammaRationalQuadraticKernel=2.0, α=3.0)) == SqEuclidean()
3132
# test_ADs(x->GammaRationalQuadraticKernel(α=x[1], γ=x[2]), [a, 2.0])
3233
@test_broken "All (problem with power operation)"
34+
test_params(GammaRationalQuadraticKernel(; α=x[1], γ=x[2]), ([x[1]], [x[2]]))
3335
end
3436
end

test/kernels/kernelproduct.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,6 @@
6767
end
6868
end
6969
test_ADs(x->SqExponentialKernel() * LinearKernel(c= x[1]), rand(1), ADs = [:ForwardDiff, :ReverseDiff, :Zygote])
70+
71+
test_params(k1 * k2, (k1, k2))
7072
end

0 commit comments

Comments
 (0)