X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=epclust%2Ftests%2Ftestthat%2Ftest.computeMedoidsIndices.R;fp=epclust%2Ftests%2Ftestthat%2Ftest.computeMedoidsIndices.R;h=0000000000000000000000000000000000000000;hb=40f12a2f66d06fd77183ea02b996f5c66f90761c;hp=8347fb6fbf501a01d4e631fdc58f62bbec195658;hpb=a52836b23adb4bfa6722642ec6426fb7b5f39650;p=epclust.git diff --git a/epclust/tests/testthat/test.computeMedoidsIndices.R b/epclust/tests/testthat/test.computeMedoidsIndices.R deleted file mode 100644 index 8347fb6..0000000 --- a/epclust/tests/testthat/test.computeMedoidsIndices.R +++ /dev/null @@ -1,25 +0,0 @@ -context("computeMedoidsIndices") - -test_that("computeMedoidsIndices behave as expected", -{ - # Generate a gaussian mixture - n = 999 - L = 7 - medoids = cbind( rep(0,L), rep(-5,L), rep(5,L) ) - # short series... - series = t( rbind( MASS::mvrnorm(n/3, medoids[,1], diag(L)), - MASS::mvrnorm(n/3, medoids[,2], diag(L)), - MASS::mvrnorm(n/3, medoids[,3], diag(L)) ) ) - - # With high probability, medoids indices should resemble 1,1,1,...,2,2,2,...,3,3,3,... - require("bigmemory", quietly=TRUE) - mi = epclust:::computeMedoidsIndices(bigmemory::as.big.matrix(medoids)@address, series) - mi_ref = rep(1:3, each=n/3) - expect_lt( mean(mi != mi_ref), 0.01 ) - - # Now with a random matrix, compare with (trusted) R version - series = matrix(runif(n*L, min=-7, max=7), nrow=L) - mi = epclust:::computeMedoidsIndices(bigmemory::as.big.matrix(medoids)@address, series) - mi_ref = R_computeMedoidsIndices(medoids, series) - expect_equal(mi, mi_ref) -})