+++ /dev/null
-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)
-})