Skip to content

Commit 4a3680a

Browse files
committed
add bivariate tests
1 parent 346874f commit 4a3680a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

test/bivariate.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,11 @@ for X in ([0.0], [0.0,0.0], [0.0,0.5], [-0.5:0.1:0.5;])
5656
@test all(k5.density .>= 0.0)
5757
@test sum(k5.density)*step(k5.x)*step(k5.y) 1.0
5858

59+
k6 = kde([X X],(r,r);kernel=D, weights=ones(X)/length(X))
60+
@test k4.density k6.density
5961
end
6062
end
63+
64+
k1 = kde([0.0 0.0; 1.0 1.0], (r,r), bandwidth=(1,1), weights=[0,1])
65+
k2 = kde([1.0 1.0], (r,r), bandwidth=(1,1))
66+
@test k1.density k2.density

test/univariate.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Base.Test
22
using Distributions
33
using KernelDensity
44

5-
import KernelDensity: kernel_dist, default_bandwidth, kde_boundary, kde_range, tabulate, UniformWeights
5+
import KernelDensity: kernel_dist, default_bandwidth, kde_boundary, kde_range, tabulate
66

77
for D in [Normal,Uniform,Logistic]
88
d = kernel_dist(D,0.5)
@@ -54,10 +54,10 @@ for X in ([0.0], [0.0,0.0], [0.0,0.5], [-0.5:0.1:0.5;])
5454
@test sum(k5.density)*step(k5.x) 1.0
5555

5656
k6 = kde(X,r;kernel=D, weights=ones(X)/length(X))
57-
@test_approx_eq k4.density k6.density
57+
@test k4.density k6.density
5858
end
5959
end
6060

6161
k1 = kde([0.0, 1.], r, bandwidth=1, weights=[0,1])
6262
k2 = kde([1.], r, bandwidth=1)
63-
@test k1.density == k2.density
63+
@test k1.density k2.density

0 commit comments

Comments
 (0)