Skip to content

Commit 4638959

Browse files
committed
dbscan(): test nclusters(res)
1 parent c8efc31 commit 4638959

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/dbscan.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ D = pairwise(Euclidean(), X, dims=2)
2626

2727
R = dbscan(D, 1.0, 10)
2828
@test isa(R, DbscanResult)
29-
k = length(R.seeds)
29+
k = nclusters(R)
3030
# println("k = $k")
3131
@test k == 3
32+
@test k == length(R.seeds)
3233
@test all(R.assignments .<= k)
3334
@test length(R.assignments) == n
3435
@test length(R.counts) == k
@@ -40,6 +41,7 @@ end
4041
@testset "Support for arrays other than Matrix{T}" begin
4142
@testset "$(typeof(M))" for M in equivalent_matrices(D)
4243
R2 = dbscan(M, 1.0, 10) # run on complete subarray
44+
@test nclusters(R2) == nclusters(R)
4345
@test R2.assignments == R.assignments
4446
end
4547
end

0 commit comments

Comments
 (0)