Skip to content

Commit fbfb436

Browse files
committed
Add regression tests for issue #60.
1 parent 63f8e70 commit fbfb436

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/interp.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,17 @@ k = kde(X)
99

1010
k = kde((X,Y))
1111
@test pdf(k, k.x, k.y) k.density
12+
13+
# Try to evaluate the KDE outside the interpolation domain
14+
# The KDE is allowed to be zero, but it should not be greater than the exact solution
15+
k = kde([0.0], bandwidth=1.0)
16+
@test pdf(k, k.x) k.density
17+
@test pdf(k, -10.0) pdf(Normal(), -10.0)
18+
@test pdf(k, +10.0) pdf(Normal(), +10.0)
19+
20+
k = kde(([0.0],[0.0]), bandwidth=(1.0, 1.0))
21+
@test pdf(k, k.x, k.y) k.density
22+
@test pdf(k, -10.0, 0.0) pdf(MvNormal(2, 1.0), [-10.0, 0.0])
23+
@test pdf(k, +10.0, 0.0) pdf(MvNormal(2, 1.0), [+10.0, 0.0])
24+
@test pdf(k, 0.0, -10.0) pdf(MvNormal(2, 1.0), [0.0, -10.0])
25+
@test pdf(k, 0.0, +10.0) pdf(MvNormal(2, 1.0), [0.0, +10.0])

0 commit comments

Comments
 (0)