-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f74495
commit 9c4ff2e
Showing
1 changed file
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |