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

Loosen tolerance on test #495

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
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
14 changes: 9 additions & 5 deletions test/mokernels/independent.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@testset "independent" begin
outdim = 3
x = KernelFunctions.MOInputIsotopicByOutputs([rand(5) for _ in 1:4], outdim)
y = KernelFunctions.MOInputIsotopicByOutputs([rand(5) for _ in 1:4], outdim)
z = KernelFunctions.MOInputIsotopicByOutputs([rand(5) for _ in 1:2], outdim)
rng = StableRNG(123456)
x = KernelFunctions.MOInputIsotopicByOutputs([rand(rng, 5) for _ in 1:4], outdim)
y = KernelFunctions.MOInputIsotopicByOutputs([rand(rng, 5) for _ in 1:4], outdim)
z = KernelFunctions.MOInputIsotopicByOutputs([rand(rng, 5) for _ in 1:2], outdim)

xIF = KernelFunctions.MOInputIsotopicByFeatures(x.x, outdim)
yIF = KernelFunctions.MOInputIsotopicByFeatures(y.x, outdim)
Expand All @@ -14,14 +15,17 @@
@test k isa Kernel
@test k.kernel isa Kernel

@test kernelmatrix(k, x, y) == kernelmatrix(k, collect(x), collect(y))
@test isapprox(
kernelmatrix(k, x, y), kernelmatrix(k, collect(x), collect(y));
rtol=1e-6,
willtebbutt marked this conversation as resolved.
Show resolved Hide resolved
)

## accuracy
KernelFunctions.TestUtils.test_interface(k, x, y, z)
KernelFunctions.TestUtils.test_interface(k, xIF, yIF, zIF)

# type stability (maybe move to test_interface?)
x2 = MOInput(rand(Float32, 4), 2)
x2 = MOInput(rand(rng, Float32, 4), 2)
@test k(x2[1], x2[2]) isa Float32
@test k(x2[1], x2[1]) isa Float32
@test eltype(typeof(kernelmatrix(k, x2))) <: Float32
Expand Down