|
1 | 1 | testname <- "Clustering"
|
2 | 2 | setup <- function()
|
3 |
| -{ |
4 |
| - M <- as.matrix(read.table(system.file("cec_tests", "mouse1.data", package="CEC"))) |
5 |
| - C <- as.matrix(read.table(system.file("cec_tests", "centers1.data", package="CEC"))) |
6 |
| - expected <- dget(system.file("cec_tests", "cec1.dp", package="CEC")) |
| 3 | +{ |
| 4 | + data("fourGaussians", package = "CEC") |
| 5 | + centers <- as.matrix(read.table(system.file("cec_tests", "four.gaussians.centers.data", package="CEC"))) |
| 6 | + expected <- dget(system.file("cec_tests", "four.gaussians.result.dp", package="CEC")) |
7 | 7 | }
|
8 | 8 |
|
9 |
| -test.clustering.mouse1 <- function() |
| 9 | +test.clustering.four.gaussians <- function() |
10 | 10 | {
|
11 |
| - CEC <- cec(M, C) |
| 11 | + CEC <- cec(fourGaussians, centers) |
12 | 12 | CEC:::checkNumericVectorEquals(expected$cluster, CEC$cluster, msg="Clustering vector")
|
13 | 13 | CEC:::checkNumericVectorEquals(expected$cost, CEC$cost, msg="Energy")
|
14 | 14 | CEC:::checkNumericMatrixEquals(expected$centers, CEC$centers, msg="Centers")
|
15 |
| - CEC:::checkNumericMatrixEquals(M, CEC$data, msg="Data") |
| 15 | + CEC:::checkNumericMatrixEquals(fourGaussians, CEC$data, msg="Data") |
16 | 16 | CEC:::checkNumericVectorEquals(expected$probability, CEC$probability, msg="Probability")
|
17 | 17 | CEC:::checkNumericVectorEquals(expected$nclusters, CEC$nclusters, msg="Number of clusters")
|
18 | 18 | CEC:::checkNumericVectorEquals(expected$iterations, CEC$iterations, msg="Iterations")
|
|
0 commit comments