JuliaGaussianProcesses / JuliaGaussianProcesses/KernelFunctions.jl

Independent mokernel failing numerical equality test randomly

Open
#494 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
275
Forks
41
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test/mokernels/independent.jl at line 17 and run the independent mokernel test repeatedly to reproduce the failure. Inspect the randomly generated x, y, and z inputs, then evaluate the proposed seeded randomness and numerical tolerance approaches. Done means the test is reproducible and no longer fails spuriously while still checking the intended equality.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.