Skip to content

Independent mokernel failing numerical equality test randomly #494

Open
@mjp98

Description

@mjp98

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions