Skip to content

Commit

Permalink
also on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixBenning committed May 17, 2023
1 parent 8f74495 commit 9c4ff2e
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/diffKernel.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
@testset "diffKernel" begin
@testset "smoke test" begin
k = MaternKernel()
k(1,1)
k(1, DiffPt(1, partial=(1,1))) # Cov(Z(x), ∂₁∂₁Z(y)) where x=1, y=1
k(DiffPt([1], partial=1), [2]) # Cov(∂₁Z(x), Z(y)) where x=[1], y=[2]
k(DiffPt([1,2], partial=(1)), DiffPt([1,2], partial=2))# Cov(∂₁Z(x), ∂₂Z(y)) where x=[1,2], y=[1,2]
end
@testset "smoke test" begin
k = MaternKernel()
k(1, 1)
k(1, DiffPt(1; partial=(1, 1))) # Cov(Z(x), ∂₁∂₁Z(y)) where x=1, y=1
k(DiffPt([1]; partial=1), [2]) # Cov(∂₁Z(x), Z(y)) where x=[1], y=[2]
k(DiffPt([1, 2]; partial=(1)), DiffPt([1, 2]; partial=2))# Cov(∂₁Z(x), ∂₂Z(y)) where x=[1,2], y=[1,2]
end

@testset "Sanity Checks with $k" for k in [SEKernel()]
for x in [0, 1, -1, 42]
# for stationary kernels Cov(∂Z(x) , Z(x)) = 0
@test k(DiffPt(x, partial=1), x) 0
@testset "Sanity Checks with $k" for k in [SEKernel()]
for x in [0, 1, -1, 42]
# for stationary kernels Cov(∂Z(x) , Z(x)) = 0
@test k(DiffPt(x; partial=1), x) 0

# the slope should be positively correlated with a point further down
@test k(
DiffPt(x, partial=1), # slope
x + 1e-1 # point further down
) > 0
# the slope should be positively correlated with a point further down
@test k(
DiffPt(x; partial=1), # slope
x + 1e-1, # point further down
) > 0

# correlation with self should be positive
@test k(DiffPt(x, partial=1), DiffPt(x, partial=1)) > 0
end
end
# correlation with self should be positive
@test k(DiffPt(x; partial=1), DiffPt(x; partial=1)) > 0
end
end
end

0 comments on commit 9c4ff2e

Please sign in to comment.