projects
/
epclust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
save state; test clustering not OK, all others OK
[epclust.git]
/
epclust
/
tests
/
testthat
/
test.computeMedoidsIndices.R
diff --git
a/epclust/tests/testthat/test.computeMedoidsIndices.R
b/epclust/tests/testthat/test.computeMedoidsIndices.R
index
efd6af9
..
8347fb6
100644
(file)
--- a/
epclust/tests/testthat/test.computeMedoidsIndices.R
+++ b/
epclust/tests/testthat/test.computeMedoidsIndices.R
@@
-8,17
+8,18
@@
test_that("computeMedoidsIndices behave as expected",
medoids = cbind( rep(0,L), rep(-5,L), rep(5,L) )
# short series...
series = t( rbind( MASS::mvrnorm(n/3, medoids[,1], diag(L)),
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))
)
) )
+ 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,...
# With high probability, medoids indices should resemble 1,1,1,...,2,2,2,...,3,3,3,...
- mi = epclust:::.computeMedoidsIndices(medoids, series)
+ require("bigmemory", quietly=TRUE)
+ mi = epclust:::computeMedoidsIndices(bigmemory::as.big.matrix(medoids)@address, series)
mi_ref = rep(1:3, each=n/3)
mi_ref = rep(1:3, each=n/3)
- expect_
that( mean(mi != mi_ref) <
0.01 )
+ 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)
# Now with a random matrix, compare with (trusted) R version
series = matrix(runif(n*L, min=-7, max=7), nrow=L)
- mi = epclust:::
.computeMedoidsIndices(medoid
s, series)
+ mi = epclust:::
computeMedoidsIndices(bigmemory::as.big.matrix(medoids)@addres
s, series)
mi_ref = R_computeMedoidsIndices(medoids, series)
expect_equal(mi, mi_ref)
})
mi_ref = R_computeMedoidsIndices(medoids, series)
expect_equal(mi, mi_ref)
})