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

Independent mokernel failing numerical equality test randomly #494

Open
mjp98 opened this issue Feb 27, 2023 · 2 comments · May be fixed by #495
Open

Independent mokernel failing numerical equality test randomly #494

mjp98 opened this issue Feb 27, 2023 · 2 comments · May be fixed by #495

Comments

@mjp98
Copy link

mjp98 commented Feb 27, 2023

Testing locally on 1.8.5, I find that https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/blob/master/test/mokernels/independent.jl#L17 occasionally fails,

independent: Test Failed at .../KernelFunctions.jl/test/mokernels/independent.jl:17
  Expression: kernelmatrix(k, x, y) == kernelmatrix(k, collect(x), collect(y))
      Evaluated: [0.6308251776147069 0.7710805544766418  0.0 0.0; 0.7662058489033383 0.6549773138194038  0.0 0.0;  ; 0.0 0.0  0.5723057547891549 0.4955933062398087; 0.0 0.0  0.7238376039335678 0.45712391842322964] == [0.6308251776147069 0.7710805544766418  0.0 0.0; 0.7662058489033383 0.6549773138194038  0.0 0.0;  ; 0.0 0.0  0.5723057547891549 0.4955933062398087; 0.0 0.0  0.7238376039335678 0.45712391842322964]

presumably due to some floating point error. The input matrices are set randomly:

    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)

It may be worth adding a seed (maybe with StableRNGs.jl?) so this is consistent across runs, and only testing equality up to a sensible numerical tolerance

@willtebbutt
Copy link
Member

Definitely. This looks like a test we shouldn't have written. I'll make a PR with the changes now.

@willtebbutt willtebbutt linked a pull request Feb 27, 2023 that will close this issue
@willtebbutt
Copy link
Member

#495 should resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants