Skip to content

Commit

Permalink
Add test for sDTW and PAM
Browse files Browse the repository at this point in the history
  • Loading branch information
asardaes committed Jul 14, 2024
1 parent ab08c69 commit 14fe855
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/testthat/test-04-system-06-partitional.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ test_that("Partitional clustering works as expected.", {
assign("pc_sdtw", pc_sdtw, persistent)
})

test_that("sDTW is handled correctly when PAM is used", {
ans <- tsclust(data_multivariate, type = "p", k = 4L,
distance = "sdtw", seed = 938)

expect_equal(class(ans@distmat), "dist")
expect_equal(attr(ans@distmat, "method"), "SDTW")

dm <- new("DistmatLowerTriangular", distmat = ans@distmat)
n <- attr(ans@distmat, "Size")
diagonal <- dm[cbind(1:n, 1:n)]
expect_false(any(diagonal == 0.0))
})

# ==================================================================================================
# TADPole
# ==================================================================================================
Expand Down

0 comments on commit 14fe855

Please sign in to comment.